* AI: improved work with "must attack" player effects, with pay to attack blockers
@@ -461,26 +461,23 @@ public class Combat implements Serializable, Copyable<Combat> {
creaturesForcedToAttack.put(creature.getId(), defendersForcedToAttack);
// No need to attack a special defender
if (defendersForcedToAttack.isEmpty()) {
- if (defenders.size() == 1) {
- player.declareAttacker(creature.getId(), defenders.iterator().next(), game, false);
+ if (defendersCostlessAttackable.size() == 1) {
+ player.declareAttacker(creature.getId(), defendersCostlessAttackable.iterator().next(), game, false);
} else {
- if (!player.isHuman()) { // computer only for multiple defenders
- player.declareAttacker(creature.getId(), defenders.iterator().next(), game, false);
- } else { // human players only for multiple defenders
- TargetDefender target = new TargetDefender(defenders, creature.getId());
+ TargetDefender target = new TargetDefender(defendersCostlessAttackable, creature.getId());
target.setRequired(true);
- target.setTargetName("planeswalker or player for " + creature.getLogName() + " to attack");
+ target.setTargetName("planeswalker or player for " + creature.getLogName() + " to attack (must attack effect)");
if (player.chooseTarget(Outcome.Damage, target, null, game)) {
player.declareAttacker(creature.getId(), target.getFirstTarget(), game, false);
}
}
- }
} else {
if (defendersForcedToAttack.size() == 1) {
player.declareAttacker(creature.getId(), defendersForcedToAttack.iterator().next(), game, false);
} else {
TargetDefender target = new TargetDefender(defendersForcedToAttack, creature.getId());
target.setRequired(true);
+ target.setTargetName("planeswalker or player for " + creature.getLogName() + " to attack (must attack effect)");
if (player.chooseTarget(Outcome.Damage, target, null, game)) {
player.declareAttacker(creature.getId(), target.getFirstTarget(), game, false);
}
