mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- NPE guard.
This commit is contained in:
@@ -107,13 +107,15 @@ public class MustBlockAi extends SpellAbilityAi {
|
|||||||
if (source.hasKeyword(Keyword.PROVOKE) && blocker.isTapped()) {
|
if (source.hasKeyword(Keyword.PROVOKE) && blocker.isTapped()) {
|
||||||
// Don't provoke if the attack is potentially lethal
|
// Don't provoke if the attack is potentially lethal
|
||||||
Combat combat = ai.getGame().getCombat();
|
Combat combat = ai.getGame().getCombat();
|
||||||
|
if (combat != null) {
|
||||||
Player defender = combat.getDefenderPlayerByAttacker(source);
|
Player defender = combat.getDefenderPlayerByAttacker(source);
|
||||||
if (combat != null && combat.getAttackingPlayer().equals(ai)
|
if (defender != null && combat.getAttackingPlayer().equals(ai)
|
||||||
&& defender.canLoseLife() && !defender.cantLoseForZeroOrLessLife()
|
&& defender.canLoseLife() && !defender.cantLoseForZeroOrLessLife()
|
||||||
&& ComputerUtilCombat.lifeThatWouldRemain(defender, combat) <= 0) {
|
&& ComputerUtilCombat.lifeThatWouldRemain(defender, combat) <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sa.getTargets().add(blocker);
|
sa.getTargets().add(blocker);
|
||||||
chance = true;
|
chance = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user