diff --git a/Mage/src/mage/constants/Zone.java b/Mage/src/mage/constants/Zone.java index 52e6164223..b5318c939a 100644 --- a/Mage/src/mage/constants/Zone.java +++ b/Mage/src/mage/constants/Zone.java @@ -5,9 +5,19 @@ package mage.constants; * @author North */ public enum Zone { + HAND, GRAVEYARD, LIBRARY, BATTLEFIELD, STACK, EXILED, ALL, OUTSIDE, PICK, COMMAND; public boolean match(Zone zone) { return (this == zone || this == ALL || zone == ALL); } + + @Override + public String toString() { + if (this.equals(EXILED)) { + return "exile zone"; + } + return super.toString(); //To change body of generated methods, choose Tools | Templates. + } + } diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index 6924f3e92b..5998477bbe 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -2873,19 +2873,12 @@ public abstract class PlayerImpl implements Player, Serializable { public UUID getCommanderId() { return this.commanderId; } -// -// @Override -// public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) { -// return moveCards(cards, fromZone, toZone, source, game, true); -// } @Override public boolean moveCards(Cards cards, Zone fromZone, Zone toZone, Ability source, Game game) { Set cardList = new HashSet<>(); for (UUID cardId : cards) { - if (fromZone == null) { - fromZone = game.getState().getZone(cardId); - } + fromZone = game.getState().getZone(cardId); if (fromZone.equals(Zone.BATTLEFIELD)) { Permanent permanent = game.getPermanent(cardId); if (permanent != null) { @@ -2901,10 +2894,6 @@ public abstract class PlayerImpl implements Player, Serializable { return moveCards(cardList, fromZone, toZone, source, game); } -// @Override -// public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) { -// return moveCards(card, fromZone, toZone, source, game, true); -// } @Override public boolean moveCards(Card card, Zone fromZone, Zone toZone, Ability source, Game game) { Set cardList = new HashSet<>(); @@ -2914,10 +2903,6 @@ public abstract class PlayerImpl implements Player, Serializable { return moveCards(cardList, fromZone, toZone, source, game); } -// @Override -// public boolean moveCards(Set cards, Zone fromZone, Zone toZone, Ability source, Game game) { -// return moveCards(cards, fromZone, toZone, source, game, true); -// } @Override public boolean moveCards(Set cards, Zone fromZone, Zone toZone, Ability source, Game game) { if (cards.isEmpty()) { @@ -2987,22 +2972,19 @@ public abstract class PlayerImpl implements Player, Serializable { public boolean moveCardToHandWithInfo(Card card, UUID sourceId, Game game, boolean withName) { boolean result = false; Zone fromZone = game.getState().getZone(card.getId()); + if (fromZone.equals(Zone.BATTLEFIELD) && !(card instanceof Permanent)) { + card = game.getPermanent(card.getId()); + } if (card.moveToZone(Zone.HAND, sourceId, game, false)) { if (card instanceof PermanentCard) { card = game.getCard(card.getId()); } if (!game.isSimulation()) { - StringBuilder sb = new StringBuilder(this.getLogName()).append(" puts ").append(withName ? card.getLogName() : (card.isFaceDown(game) ? "a face down card" : "a card")); - switch (fromZone) { - case EXILED: - sb.append(" from exile zone "); - break; - default: - sb.append(fromZone != null ? new StringBuilder(" from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(" ") : ""); - break; - } - sb.append(card.getOwnerId().equals(this.getId()) ? "into his or her hand" : "into its owner's hand"); - game.informPlayers(sb.toString()); + game.informPlayers(this.getLogName() + " puts " + + (withName ? card.getLogName() : (card.isFaceDown(game) ? "a face down card" : "a card")) + + " from " + fromZone.toString().toLowerCase(Locale.ENGLISH) + " " + + (card.getOwnerId().equals(this.getId()) ? "into his or her hand" : "into its owner's hand") + ); } result = true; }