When the returned value of the compare function is `0` the order is
preserved. Before the sort, the order between joining clients and
non-joining clients differ.
Now everything important (which is used later on) is included in the
comparison. If still `0` is returned it's not importent which element is
taken.
Another solution would be to have one array per category.
On a rejoined client the data isn't the same anymore. But it's equal.
Likely this is because the data isn't aquired at the same turn.
This could also be solved more generally by copying all data which is
pushed to the AI. Or by using the same serializer for AI as for the rest
of the simulation.
Up to now `eslint-plugin-brace-rules` was used to enforce a common brace
style for JavaScript code. This plugin was however updated the last time
over 9 years ago and will be incompatible with ESLint v10, as that
[removes `context.getSourceCode()`][1], the plugin relies on.
To keep the eslint config working with ESLint v10, this replaces
`eslint-plugin-brace-rules` with the [`@stylistic/brace-style`][2] rule
from `@stylistic/eslint-plugin`, a package we already use.
While `@stylistic/brace-style` doesn't offer an option to format braces
in exactly the same way as before, the "allman" style seems to be the
one closest to the existing code.
[1]: https://eslint.org/blog/2025/11/eslint-v10.0.0-alpha.0-released/#removed-deprecated-rule-context-members
[2]: https://eslint.style/rules/brace-style
Adds a randomly male and female Civilian unit which replaces the old "Female Citizen" for each civ.
New actors, new portraits, some new body textures, but the same stats as the old Female Citizen.
Updates maps, technologies, skirmish templates, et al. including the Tutorials.
Co-Authored By: Itms
Reviewed By: Vantha
There is a call to `warn` in this function. That caused infinite
recursion.
Everywhere the function is imported it's aliased as `aiWarn`. So just
export it with that name and remove the aliasing.
Introduced in: #8255
During the eslint 8 cycle the formatting rules were split out [1],
deprecating the corresponding rules in core.
This replaces all rules that where moved to @stylistic/eslint-plugin [2]
and accounts for the difference in the indenting rule behaviour.
To allow the pre-commit import hack to continue to work with the
stylisitc plugin for a recent nodejs version to be used.
[1] https://eslint.org/blog/2023/10/deprecating-formatting-rules/
[2] https://eslint.style/packages/default
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
Those bugs stood out to me as I was experimenting with migrating petra
to ES6 classes. Since this give the code stronger typing, those kind of
errors stand out immediately.
For example, autoResearch is a function, thus referring to it by name
will always return the same result. In other cases the referenced
variables simply don't exist.
Reported by: @Langbart
Differential revision: https://code.wildfiregames.com/D4936
Refs. #6385 by fixing a part of it (the attack plan).
This was SVN commit r27551.
In 2f24006afb, the siege state for no trainer was not assigned to
variable but used in condition.
Making use of that state actually.
Differential revision: D4367
Patch by: @JCWasmx86
This was SVN commit r26053.
The HQ should only care about high-level stuff, hence something like
managing/looping individual bases is now done in a `BasesManager`,
similar to the `AttackManager`.
Differential revision: https://code.wildfiregames.com/D4192
Comments by: @Angen
Fixes: #6185
This was SVN commit r25876.
This patch decreases the popScaling so that the easy AI difficulties
have lower targeted population.
And it also decreases the size & priority of the attacks from the easy
an very easy AI.
Refs: #6149
Differential revision: D3997
Patch by: @marder
Tested by: @Langbart
Comments by: @wraitii, @Freagarach
This was SVN commit r25600.
Let PetraAI use MatchesClassList more.
Differential revision: https://code.wildfiregames.com/D2150
Reviewed by: Angen
Comments by: Stan
This was SVN commit r25584.
Remove Champion class from siege functions related to melee elephants.
Improve mobile dropsite code by replacing Elephant class with Unit
class.
Remove code related to fact support elephants can build as it is not
case anymore.
Differential Revision: https://code.wildfiregames.com/D2964
Patch by: Nescio
Reviewed by: Angen
This was SVN commit r24027.
A blacksmith is a person, a forge is the blacksmith's workshop.
This renames templates and corrects simulation and sound files.
Patch by: @Nescio.
Differential Revision: D2971
Approved by @genava55, @Gallaecio, @wraitii.
This was SVN commit r23998.
This class is an AI hint that such units are to be treated as moving
fast, e.g. war dogs, or cavalry.
This makes it easier to introduce camels and chariots correctly.
Further work is required to make the AI unit choices less hardcoded.
Patch by: Nescio
Reviewed By: Angen, wraitii
Differential Revision: https://code.wildfiregames.com/D2251
This was SVN commit r23916.
template_structure_economic_market.xml → Market
template_structure_military_dock.xml → Dock
<Market/TradeType> node → Trade
requirement for bartering: BarterMarket → Barter
Change Petra accordingly
Also changing:
Renamed the Gates class to Gate, LongWall to WallLong (cf.
WallTower), and StoneWall to Wall, to match their template file names.
Adjusted AI code, technologies, and templates accordingly.
Entity build restrictions:
renamed Apadana to Palace;
replaced UniqueStructure with IshtarGate and TempleOfVesta.
added Council to the (unbuildable) spart_gerousia.xml, since
it's functionally identical to athen_prytaneion.xml.
Introduced the following classes:
Council, IshtarGate, Library, TempleOfVesta, and Theater, to
match their build restrictions.
WallMedium and WallShort, to complement the already existing
WallLong and WallTower classes.
Stoa, TempleOfMars, and TriumphalArch, for completeness.
Made the ArmyCamp, Colony, Gate, Lighthouse, Naval, Palace,
Palisade, SiegeWall, and StoneWall classes visible.
Deleted the now unused Apadana, Kennel, SpecialBuilding classes.
Removed the Village class from outposts and palisades, because those
are not supposed to count towards the phase technology requirements.
Slightly rephrased the phase technology requirements tooltips.
Corrected the <GenericName> of the various palisade files.
Updated Structure tooltips from D2578 that have not already been
committed elsewhere.
Patch By: Nescio
Differenital Revision: D2892
This was SVN commit r23865.
Branches introduced in f1610ce4fa had commented part to consider
stonewalls as blocking targets only if there have been siege units in
army.
Commented part was removed in ade8bcc0b8.
Differential Revision: https://code.wildfiregames.com/D2804
This was SVN commit r23760.
Avoid trying to attack unattackable entities based on restricted classes
from Attack component.
Differential Revision: https://code.wildfiregames.com/D2111
Patch by: Freagarach
Reviewed by: Angen
This was SVN commit r23759.
Move duplicating code to functions.
Cleaner, nicer, easier to extend.
Differential Revision: https://code.wildfiregames.com/D2655
This was SVN commit r23536.
Petra reached maxed population and started spamming attack requests.
Reported at forum
https://wildfiregames.com/forum/index.php?/topic/27319-ai-chat-spamming/.
Cause of problem was that with given population scaling and current
rounding minimal requested size of units dropped to 0.
What leaded to allow to start without units because minimum count have
been reached.
This change requires at least one unit if minimum size is not 0 before
adjustment by pop scaling , what we need to not block attacks with
heroes or healers for example.
Now in case Petra is not able to produce units, aborts plan correctly.
Differential Revision: https://code.wildfiregames.com/D2462
This was SVN commit r23235.
The objective of 3362c591f5 to have only one global for multiple AIs is
still achieved by not changing the resulting object structure.
The advantage of not using the pattern is to have less parental scopes,
i.e. more localization and separation of concerns.
This resembles the successful simulation script component system.
The stated benefits of the Augmentation pattern were never used, because
there are (luckily) no such private variables or globals passed as
arguments.
Fixes an ESLint warning about using PETRA before it is defined, refs
#5524, D1993.
Fixes the missing level of indentation if indentation should represent
scoping proportionally.
Remove superfluous, thus misleading name PetraBot in PETRA.PetraBot
assignment.
Differential Revision: https://code.wildfiregames.com/D2103
Patch By: Krinkle
Related comments by: Yves, wraitii, Philip, leper on #0ad-dev on
December 2013, see #2322
Source was:
http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html
This was SVN commit r22803.