mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
Fixed NPE in mad ai
This commit is contained in:
parent
55bf5714a0
commit
aa224dee2f
1 changed files with 20 additions and 14 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue