diff --git a/Mage.Sets/src/mage/cards/p/PortalMage.java b/Mage.Sets/src/mage/cards/p/PortalMage.java index c10f7e46ec..320b4134bd 100644 --- a/Mage.Sets/src/mage/cards/p/PortalMage.java +++ b/Mage.Sets/src/mage/cards/p/PortalMage.java @@ -110,7 +110,7 @@ class PortalMageEffect extends OneShotEffect { // Select the new defender TargetDefender target = new TargetDefender(defenders); if (controller.chooseTarget(Outcome.Damage, target, source, game)) { - if (!combatGroupTarget.getDefenderId().equals(target.getFirstTarget())) { + if (combatGroupTarget.getDefenderId() != null && !combatGroupTarget.getDefenderId().equals(target.getFirstTarget())) { if (combatGroupTarget.changeDefenderPostDeclaration(target.getFirstTarget(), game)) { String attacked = ""; Player player = game.getPlayer(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/t/TheEternalWanderer.java b/Mage.Sets/src/mage/cards/t/TheEternalWanderer.java index a760fb1b17..fa1c1142d2 100644 --- a/Mage.Sets/src/mage/cards/t/TheEternalWanderer.java +++ b/Mage.Sets/src/mage/cards/t/TheEternalWanderer.java @@ -212,7 +212,7 @@ class TheEternalWandererAttackRestrictionEffect extends RestrictionEffect { //If there is already a creature attacking The Eternal Wanderer, dont let another creature attack it for(CombatGroup group : game.getCombat().getGroups()){ - if(group.getDefenderId().equals(source.getSourceId())){ + if(group.getDefenderId() != null && group.getDefenderId().equals(source.getSourceId())){ return false; } } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CreaturesAttackingYouCount.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CreaturesAttackingYouCount.java index b9c4352f8d..b28aeac253 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/CreaturesAttackingYouCount.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/CreaturesAttackingYouCount.java @@ -21,7 +21,7 @@ public enum CreaturesAttackingYouCount implements DynamicValue { public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; for (CombatGroup combatGroup : game.getCombat().getGroups()) { - if (combatGroup.getDefenderId().equals(sourceAbility.getControllerId())) { + if (combatGroup.getDefenderId() != null && combatGroup.getDefenderId().equals(sourceAbility.getControllerId())) { count += combatGroup.getAttackers().size(); } } diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/AttackingSameNotBandedPredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/AttackingSameNotBandedPredicate.java index 112dbc3b9a..971b13f600 100644 --- a/Mage/src/main/java/mage/filter/predicate/permanent/AttackingSameNotBandedPredicate.java +++ b/Mage/src/main/java/mage/filter/predicate/permanent/AttackingSameNotBandedPredicate.java @@ -26,6 +26,7 @@ public class AttackingSameNotBandedPredicate implements Predicate { return combatGroup != null && input.isAttacking() && input.getBandedCards().isEmpty() + && combatGroup.getDefenderId() != null && combatGroup.getDefenderId().equals(defenderId); } } diff --git a/Mage/src/main/java/mage/game/combat/CombatGroup.java b/Mage/src/main/java/mage/game/combat/CombatGroup.java index 695f442e4b..d3fe5c3973 100644 --- a/Mage/src/main/java/mage/game/combat/CombatGroup.java +++ b/Mage/src/main/java/mage/game/combat/CombatGroup.java @@ -66,6 +66,10 @@ public class CombatGroup implements Serializable, Copyable { } + /** + * + * @return can be null + */ public UUID getDefenderId() { return defenderId; }