Skip to content

Commit

Permalink
AI: ensure multiple weapons are always checked for [disable] special
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mattsc committed Sep 12, 2016
1 parent 3c98423 commit cc986bb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/actions/attack.cpp
Expand Up @@ -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)) {
Expand Down

0 comments on commit cc986bb

Please sign in to comment.