These functions are not used anywhere, and they have other issues besides the one fixed in this commit – they're implied to return all moves, but they only return one move for each possibly destination hex. However, this will make them at least be minimally usable.
I used level 3 deprecation because this is something that was intended for internal use in the ai_helper module, and the ai_helper module itself is not an officially stable API
Nowdays ability.value and similar attributes can also contain formulas
(That for example make a heal amount dependent on the remaining hitpointsthe unit has
)
With this the lua ai code should no longer crash in these cases.
Ensures that files either use tabs for indentation or spaces for indentation,
but don't switch between the two within the same file.
This doesn't fix the whitespace, it's a simple check to flag it up
on the assumption that it's better to use an editor or code formatter
to clean up the file.
Elsewhere in the CI we use the luacheck tool - while that can detect
mixing tabs and spaces in a single line's indent, it doesn't check for
inconsistent indentation within a file.
The method used in the battle_outcome() function is somewhat simplified compared to the default engine calculation and faster in the vast majority of cases, but it can become extremely slow when the combined number of strikes of the attacker and defender is very large.
The new method avoids a lot of path finding that the previous method did, esp. on large maps with many units and/or enemies, leading to significant speed improvements in some cases.
This fixes#6504
This fixes#4924. Note, however, that the recruit rushers CA is set up for single-leader sides and does not work with multiple leaders, so this is of limited use.
Many of the operations of the recruit rushers CA are expensive and are therefore cached. For the most part, this cache can be kept from turn to turn, but in case there are events that change, for example, the map or the recruit list, this parameter can be used to force a reset of the cache each turn.
While most data in recruit_data can stay persistent from turn to turn, some of recruit_data.recruit, such as enemy_types, needs to be updated each turn.
This removes the need for the Generic Recruit Engine and makes Recruit Rushers a "clean" candidate action. In the process, it fixes a bug of data leakage between the Experimental AIs of different sides.
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.