diff --git a/Mage/src/mage/game/combat/Combat.java b/Mage/src/mage/game/combat/Combat.java index afa94cb982..4650ae1993 100644 --- a/Mage/src/mage/game/combat/Combat.java +++ b/Mage/src/mage/game/combat/Combat.java @@ -773,15 +773,17 @@ public class Combat implements Serializable, Copyable { } } - public void removeFromCombat(UUID creatureId, Game game) { + public boolean removeFromCombat(UUID creatureId, Game game) { + boolean result = false; Permanent creature = game.getPermanent(creatureId); if (creature != null) { creature.setAttacking(false); creature.setBlocking(0); for (CombatGroup group : groups) { - group.remove(creatureId); + result |= group.remove(creatureId); } } + return result; } public void endCombat(Game game) { diff --git a/Mage/src/mage/game/combat/CombatGroup.java b/Mage/src/mage/game/combat/CombatGroup.java index a1c0a969ec..465f543286 100644 --- a/Mage/src/mage/game/combat/CombatGroup.java +++ b/Mage/src/mage/game/combat/CombatGroup.java @@ -492,18 +492,22 @@ public class CombatGroup implements Serializable, Copyable { return defenderIsPlaneswalker; } - public void remove(UUID creatureId) { + public boolean remove(UUID creatureId) { + boolean result = false; if (attackers.contains(creatureId)) { attackers.remove(creatureId); - } - if (blockers.contains(creatureId)) { - blockers.remove(creatureId); - - //20100423 - 509.2a - if (blockerOrder.contains(creatureId)) { - blockerOrder.remove(creatureId); + result = true; + } else { + if (blockers.contains(creatureId)) { + blockers.remove(creatureId); + result = true; + //20100423 - 509.2a + if (blockerOrder.contains(creatureId)) { + blockerOrder.remove(creatureId); + } } } + return result; } public void acceptBlockers(Game game) { diff --git a/Mage/src/mage/game/permanent/PermanentImpl.java b/Mage/src/mage/game/permanent/PermanentImpl.java index 005bc39112..9279e4b0dc 100644 --- a/Mage/src/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/mage/game/permanent/PermanentImpl.java @@ -817,7 +817,8 @@ public abstract class PermanentImpl> extends CardImpl public boolean sacrifice(UUID sourceId, Game game) { //20091005 - 701.13 if (!game.replaceEvent(GameEvent.getEvent(EventType.SACRIFICE_PERMANENT, objectId, sourceId, controllerId))) { - if (moveToZone(Zone.GRAVEYARD, sourceId, game, true)) { + // Commander replacement effect does not prevent successful sacrifice + if (moveToZone(Zone.GRAVEYARD, sourceId, game, true) || game.getState().getZone(this.getId()).equals(Zone.COMMAND)) { Player player = game.getPlayer(getControllerId()); if (player != null) { game.informPlayers(new StringBuilder(player.getName()).append(" sacrificed ").append(this.getName()).toString()); @@ -976,7 +977,11 @@ public abstract class PermanentImpl> extends CardImpl @Override public boolean removeFromCombat(Game game) { - game.getCombat().removeFromCombat(objectId, game); + if (this.isAttacking() || this.blocking > 0) { + if (game.getCombat().removeFromCombat(objectId, game)) { + game.informPlayers(new StringBuilder(this.getName()).append(" removed from combat").toString()); + } + } return true; }