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:
mattsc 2016-09-12 07:02:05 -07:00
parent 860e6a13d5
commit 3c98423547

View file

@ -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) {