From 09126d321a4b871b653e613193b39594b1c49df1 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 11 Aug 2013 20:24:57 +0200 Subject: [PATCH] * Fixed NPE bug during blocker declaration (fixes #308). --- Mage/src/mage/game/combat/CombatGroup.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Mage/src/mage/game/combat/CombatGroup.java b/Mage/src/mage/game/combat/CombatGroup.java index 758f2c10c8..2255d62df8 100644 --- a/Mage/src/mage/game/combat/CombatGroup.java +++ b/Mage/src/mage/game/combat/CombatGroup.java @@ -56,6 +56,11 @@ public class CombatGroup implements Serializable, Copyable { protected UUID defendingPlayerId; protected boolean defenderIsPlaneswalker; + /** + * @param defenderId the player that controls the defending permanents + * @param defenderIsPlaneswalker is the defending permanent a planeswalker + * @param defendingPlayerId regular controller of the defending permanents + */ public CombatGroup(UUID defenderId, boolean defenderIsPlaneswalker, UUID defendingPlayerId) { this.defenderId = defenderId; this.defenderIsPlaneswalker = defenderIsPlaneswalker; @@ -63,14 +68,15 @@ public class CombatGroup implements Serializable, Copyable { } public CombatGroup(final CombatGroup group) { - this.blocked = group.blocked; - this.defenderId = group.defenderId; - this.defenderIsPlaneswalker = group.defenderIsPlaneswalker; this.attackers.addAll(group.attackers); this.blockers.addAll(group.blockers); this.blockerOrder.addAll(group.blockerOrder); this.attackerOrder.addAll(group.attackerOrder); this.players.putAll(group.players); + this.blocked = group.blocked; + this.defenderId = group.defenderId; + this.defendingPlayerId = group.defendingPlayerId; + this.defenderIsPlaneswalker = group.defenderIsPlaneswalker; } public boolean hasFirstOrDoubleStrike(Game game) { @@ -381,7 +387,7 @@ public class CombatGroup implements Serializable, Copyable { } public boolean canBlock(Permanent blocker, Game game) { - // you can't block if combat group attacks another player + // player can't block if another player is attacked if (!defendingPlayerId.equals(blocker.getControllerId()) ) { return false; }