mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
fix some possible NPEs (when combat = null)
This commit is contained in:
@@ -180,14 +180,16 @@ public class CombatUtil {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attacker.hasStartOfKeyword("CantBeBlockedByAmount GT") && !combat.getBlockers(attacker).isEmpty()) {
|
if ( combat != null ) {
|
||||||
return false;
|
if (attacker.hasStartOfKeyword("CantBeBlockedByAmount GT") && !combat.getBlockers(attacker).isEmpty()) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Rule 802.4a: A player can block only creatures attacking him or a planeswalker he controls
|
// Rule 802.4a: A player can block only creatures attacking him or a planeswalker he controls
|
||||||
Player attacked = combat.getDefendingPlayerRelatedTo(attacker);
|
Player attacked = combat.getDefendingPlayerRelatedTo(attacker);
|
||||||
if (attacked != null && attacked != defendingPlayer) {
|
if (attacked != null && attacked != defendingPlayer) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return CombatUtil.canBeBlocked(attacker, defendingPlayer);
|
return CombatUtil.canBeBlocked(attacker, defendingPlayer);
|
||||||
}
|
}
|
||||||
@@ -493,7 +495,7 @@ public class CombatUtil {
|
|||||||
*/
|
*/
|
||||||
public static boolean canBlock(final Card attacker, final Card blocker, final Combat combat) {
|
public static boolean canBlock(final Card attacker, final Card blocker, final Combat combat) {
|
||||||
|
|
||||||
if ((attacker == null) || (blocker == null)) {
|
if (attacker == null || blocker == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user