AI: check whether attack is disabled for units with one attack
The added conditional only checks whether the [disable] tag is present. If so, weapon 0 is not automatically assigned. It is then checked in the following whether the tag is active. This fixes bug 22179.
This commit is contained in:
parent
860e6a13d5
commit
3c98423547
1 changed files with 1 additions and 1 deletions
|
@ -333,7 +333,7 @@ battle_context::battle_context(const unit_map& units,
|
|||
const unit &defender = *units.find(defender_loc);
|
||||
const double harm_weight = 1.0 - aggression;
|
||||
|
||||
if (attacker_weapon == -1 && attacker.attacks().size() == 1 && attacker.attacks()[0].attack_weight() > 0 )
|
||||
if (attacker_weapon == -1 && attacker.attacks().size() == 1 && attacker.attacks()[0].attack_weight() > 0 && !(&attacker.attacks()[0])->get_special_bool("disable", true))
|
||||
attacker_weapon = 0;
|
||||
|
||||
if (attacker_weapon == -1) {
|
||||
|
|
Loading…
Add table
Reference in a new issue