Previously the CA would already move multiple leaders if all leaders were to be moved, but it would abandon moving any leader after finding one that should not move.
Note that we do not add an 'ignore_units' option, as allies and enemies are taken into account in different ways and we want to have a way of ignoring each type individually.
... as opposed to lining up if there are allied units in the way.
This changes (fixes) the default behavior. An optional 'no_fan_out' parameter is provided in order to restore the old behavior.
This lets the AI find paths around areas defined by [avoid] tags, rather than being stopped dead by them. See comments in the code for details.
The relevant custom cost function, custom_cost_with_avoid(), can be accessed directly as well.
This adds the correct behavior for the castle_switch, move_to_any_enemy and place_healers CAs. It was already in place for the other former ExpAI CAs (except for recruiting and spread_poison, for which it does not apply).
This automatically also adds this behavior to the Healer Support Micro AI.
This allows restricting each CA individually to only a subset of the units. It also means that several instances of the same CA can be used in the same AI configuration, in order to, for example, force the order in which units are dealt with, or to apply different settings to different units.
Also backtracked the removal of wesnoth.get_recall_units, which is now available as wesnoth.units.find_on_recall - it's just more convenient than passing x=recall to wesnoth.units.find
Without this, the AI always starts with whatever it considers the best unit without taking the level bonus into account. This mostly only matters when one sets high_level_fraction to a very large value (1 or larger) in order to force only high-level recruits. In other cases it makes no, or no significant, difference.
This also sets its default value to zero, in order to have consistent default behavior with versions from before this parameter was introduced.
It also provides a macro so that the ExpAI can be used with custom parameters in a scenario config, and adds high_level_fraction as an optional parameter to the Recruit Rushers Micro AI.
Because unit cost is penalized in the ExpAI, it recruits almost no higher level units. This adds a bonus for such units to be recruited at approximately the ratio defined in 'high_level_fraction'.
There are rating contributions for hexes which heal (not all of which are villages) and others for hexes that provide income (villages). Previously only villages were considered for both types of hexes.
Ths is the enemy type list to be considered if the AI has no information about the enemies to expect, that is, if no enemy units are on the map and no enemy recruit lists can be found. It can be used to prepare AI recruiting for enemy sides that get added later during a scenario.
This is a generalized version of ai_helper.get_reachable_unocc(). It can include or exclude hexes with own units with moves > 0. It also allows passing an optional location set 'avoid_map' with hexes to be excluded.
In principle, this makes get_reachable_unocc() unnecessary, but we keep that function for backward compatibility.
This is done for consistency with similar functions in mainline, and so that the function actual returns what it name says. This breaks backward compatibility, but note that the only practical difference for that is the order in which the arguments are returned, as both 'closest_enemy' and 'location' contain the enemy location in .x/.y format.
This is done for consistency with similar functions in mainline. In principle this breaks backward compatibility. However, while it is theoretically possible for this to happen, this function will generally always return at least the hex the unit is on, so it is very unlikely that this actually makes a difference somewhere.