Fixed NPE in mad ai

This commit is contained in:
magenoxx 2012-05-09 11:24:49 +04:00
parent 55bf5714a0
commit aa224dee2f

View file

@ -1120,23 +1120,29 @@ public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements
} }
private boolean isEffectiveAttacker(Game game, UUID attackingPlayerId, UUID defenderId, Permanent attacker, int life, int poison) { private boolean isEffectiveAttacker(Game game, UUID attackingPlayerId, UUID defenderId, Permanent attacker, int life, int poison) {
SurviveInfo info = CombatUtil.getCombatInfo(game, attackingPlayerId, defenderId, attacker); try {
if (info.isAttackerDied()) { SurviveInfo info = CombatUtil.getCombatInfo(game, attackingPlayerId, defenderId, attacker);
if (info.isAttackerDied()) {
return false;
}
if (info.getDefender().getLife() < life) {
return true;
}
if (info.getDefender().getCounters().getCount(CounterType.POISON) > poison && poison < 10) {
return true;
}
if (info.isTriggered()) {
return true;
}
} catch (Exception e) {
// swallow exception and return false
logger.error(e);
return false; return false;
} }
if (info.getDefender().getLife() < life) {
return true;
}
if (info.getDefender().getCounters().getCount(CounterType.POISON) > poison && poison < 10) {
return true;
}
if (info.isTriggered()) {
return true;
}
return false; return false;
} }