AI: ensure multiple weapons are always checked for [disable] special

If the defender has multiple weapons at the range of the attacker
weapon, choose_defender_weapon calculates the combat outcome and
attacker_combatant_ is set. We still need to check the attack weapon
for the [disable] special in this case.
This commit is contained in:
mattsc 2016-09-12 07:40:31 -07:00
parent 3c98423547
commit cc986bbc50

View file

@ -534,6 +534,12 @@ int battle_context::choose_attacker_weapon(const unit &attacker,
attacker_combatant_ = new combatant(*attacker_stats_);
defender_combatant_ = new combatant(*defender_stats_, prev_def);
attacker_combatant_->fight(*defender_combatant_);
} else {
if (attacker_stats_->disable) {
delete attacker_stats_;
attacker_stats_ = nullptr;
continue;
}
}
if (!best_att_comb || better_combat(*attacker_combatant_, *defender_combatant_,
*best_att_comb, *best_def_comb, harm_weight)) {