mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-27 03:26:04 +00:00
Default AI: fix bug causing units with max_moves=0 not to attack
The support parameter in the attack evaluation quantifies how much power the AI can bring to an attack hex. This is supposed to include the attacking unit itself. However, in some circumstances (such as when the unit cannot move for one reason or another) this unit is not accounted for. If no other units can get to this hex either, support is (erroneously) set to zero, resulting in an attack score of zero, which in turn results in no attack. Skipping the multiplication of the score by support in this case does not affect comparison with other attacks here, as this is by definition the only attack possible on the given hex. Note that the '!is_surrounded' conditional is also covered by 'support != 0' and can therefore be deleted. This fixes bug #23720.
This commit is contained in:
parent
8d6e513671
commit
e7bd4bc4ef
@ -19,12 +19,13 @@ Example contents.
|
||||
[/rasection]
|
||||
|
||||
|
||||
[rasection="Additions to the AI"]
|
||||
[rasection="Additions and changes to the AI"]
|
||||
[list]
|
||||
[*]A new candidate action (CA), called [wiki=RCA_AI#The_Candidate_Actions_.28CAs.29_of_the_main_loop_Stage_in_the_RCA_AI]high XP attack[/wiki], has been added to all general Wesnoth AIs in mainline, fixing a short-coming in the default AI's combat CA. Previously, the AI would only attack units 1 experience point (XP) from leveling under very specific and rarely occurring circumstances. It was possible to exploit this, for example, for blocking vital passages or keeping key units alive without these units ever being attacked, making scenarios much easier than they were intended.
|
||||
|
||||
The new CA fixes this hole and will generally, but not blindly, attack such units now. The attack logic is explained [url=https://github.com/wesnoth/wesnoth/blob/master/data/ai/lua/ca_high_xp_attack.lua#L5]here[/url]. Since the new behavior is accomplished not by changing the existing attack code, but by adding a new candidate action, the previous behavior can be restored by removing the high_xp_attack CA, in case this is desired in specific scenarios.
|
||||
[*]For content creators, a [wiki=Micro_AIs#Assassin_Squad_Micro_AI_.28ai_type.3Dassassin.29]new Micro AI[/wiki], controlling individual assassins or an entire assassin squad has been added. It is already being used in Heir to the Throne scenario 8, 'The Princess of Wesnoth'.
|
||||
[*]A long standing bug which caused units with zero maximum moves not to attack adjacent enemies under certain circumstances has been fixed. This also (sometimes) affected units which could not move due to other circumstances (such as terrain).
|
||||
[/list]
|
||||
[/rasection]
|
||||
|
||||
|
@ -4,6 +4,7 @@ Version 1.13.5+dev:
|
||||
attacks on enemy units so close to leveling that the default AI's combat CA
|
||||
would not attack them.
|
||||
* New Micro AI: Assassin Squad AI
|
||||
* Fix bug #23720, AI units with max_moves=0 do not attack.
|
||||
* Campaigns:
|
||||
* Eastern Invasion:
|
||||
* Fixed broken village encounters.
|
||||
|
@ -304,7 +304,7 @@ double attack_analysis::rating(double aggression, const readonly_context& ai_obj
|
||||
}
|
||||
}
|
||||
|
||||
if(!leader_threat && vulnerability*terrain_quality > 0.0 && !is_surrounded) {
|
||||
if(!leader_threat && vulnerability*terrain_quality > 0.0 && support != 0) {
|
||||
value *= support/(vulnerability*terrain_quality);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user