mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
fixed some NPEs with AIs
This commit is contained in:
parent
a4f0789fac
commit
ecbd843fb7
2 changed files with 11 additions and 4 deletions
|
|
@ -737,8 +737,11 @@ public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements
|
|||
UUID opponentId = game.getCombat().getDefenders().iterator().next();
|
||||
String attackers = "";
|
||||
for (UUID attackerId: combat.getAttackers()) {
|
||||
attackers = "[" + game.getCard(attackerId).getName() + "]";
|
||||
this.declareAttacker(attackerId, opponentId, game);
|
||||
Permanent attacker = game.getPermanent(attackerId);
|
||||
if (attacker != null) {
|
||||
attackers = "[" + attacker.getName() + "]";
|
||||
this.declareAttacker(attackerId, opponentId, game);
|
||||
}
|
||||
}
|
||||
logger.info("declare attackers: " + (attackers.isEmpty() ? "none" : attackers));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ import mage.game.Game;
|
|||
import mage.game.combat.Combat;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.game.turn.BeginCombatStep;
|
||||
|
|
@ -703,8 +704,11 @@ public class ComputerPlayer2 extends ComputerPlayer<ComputerPlayer2> implements
|
|||
if (i < combat.getGroups().size()) {
|
||||
for (UUID blockerId: combat.getGroups().get(i).getBlockers()) {
|
||||
this.declareBlocker(blockerId, groups.get(i).getAttackers().get(0), game);
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("blocking with:" + game.getPermanent(blockerId).getName());
|
||||
if (logger.isDebugEnabled()) {
|
||||
Permanent blocker = game.getPermanent(blockerId);
|
||||
if (blocker != null)
|
||||
logger.debug("blocking with:" + blocker.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue