The castle switch CA stores the leader move because the evaluation is expensive. If the leader was killed in between storing and reevaluation of the CA, this would previously cause an on-screen error message and the CA to be blacklisted for the turn.
This fixes#6440.
An integral part of this MAI is that it moves weaker units out of the way for stronger ones. Units without moves are taken into account by giving them a very high rating. This was previously only done on what's considered the AI's territory (the AI side of the bottleneck) which works fine most of the time since the AI does not try to move onto enemy territory. However, it breaks down on more open maps, where there are way for units to move around the bottleneck, as AI territory is not always well defined on them. However, there is no need to restrict this to AI territory only.
This fixes#6599.
The passed filter needs to be enclosed in an [and] tag, otherwise the check for visibility might not work correctly, for example if the filter contains a top level [or] tag.
The whitespace-fixing script seems to be slightly different depending on the platform.
Even though it produces no effect in the CI, it made these changes locally on my Mac.
I'm committing them now so as to avoid unrelated files being changed in other pull requests.
The MAI was set up to be blacklisted if no attacks were found, but that did not always work. In addition, removing attacks from the wolves also means that no other CA can use them for other attacks instead.
- Unit formulas are replaced by inline MicroAIs or candidate actions placed in the unit's [ai] tag.
- The stationed_guardian MicroAI was chosen as the closest match to the guardian FormulaAI. It's not a perfect fit, but it's pretty close.
- The goto and patrol MicroAIs are fairly obvious substitutes for the respective unit formulas.
- The priority test in unit formulas is replaced by fairly basic inline non-external CAs with differing scores.
- The side formulas (opening.fai) have been converted to a separate Lua stage using a new opening.lua. However, that's only a partial conversion. The move and attack functionalities of opening.fai are missing from opening.lua; instead the built-in move, move leader to keep, and combat CAs are used.
- The scouting FormulaAI CA has been ported to Lua. It remains a very basic AI, probably not well-suited to genera use.
- The level up attack FormulaAI CA has been ported to Lua. Like the new scouting CA, this is mostly intended to serve as an example.
- The t_string type is now a schema built-in type and no longer attempts a regex match.
- You can also specify that non-t_string types may be optionally-translatable; this case supports a regex match on the string (but note that the translation mark is not part of the match).
- Error messages involving keys with very large values ( > 128 characters) will now truncate the value.
- To account for occasional cases where the schema is intentionally violated, the --validate command-line option now automatically defines the SCHEMA_VALIDATION preprocessor define.
A key validates as type t_string if one of the following is true:
- The key is not present
- The key has at least one segment with a translation mark
- The key is blank (an empty string)
Any type other than t_string is not allowed to be translatable by default, unless you specify allow_translatable=yes in the [type] tag.
An optionally-translatable string could also be defined as a union of t_string and some other type.
This adjusts to the change in e7b5996e98.
The micro ai itself is unchanged, it's still controlled by `tusker_type` and
`tusklet_type`, it simply needed the new unit ids to be used in this scenario.
This is part of removing Formula AI uses from mainline. These are just small experimental additions to the default AI that have been superseded by more recent additions to the AI.
attack_range: the patrol interrupts its route to attack enemies within this distance, not just enemies that it happens to end up next to
attack_invisible_enemies: include invisible enemies when considering whether there are enemies within attack_range
The default behavior is unchanged.
Some Micro AIs save information in unit variables. Examples are the patrol and messenger AIs, which save the next waypoint for a unit. This needs to be done as a synced command, so that the information is not lost when continuing a game from a replay.