diff --git a/Mage.Sets/src/mage/sets/darkascension/CurseOfEchoes.java b/Mage.Sets/src/mage/sets/darkascension/CurseOfEchoes.java index dd08ebaf846..bab24b5133c 100644 --- a/Mage.Sets/src/mage/sets/darkascension/CurseOfEchoes.java +++ b/Mage.Sets/src/mage/sets/darkascension/CurseOfEchoes.java @@ -167,8 +167,9 @@ class CurseOfEchoesEffect extends OneShotEffect { @Override public String getText(Mode mode) { - StringBuilder sb = new StringBuilder(); - sb.append("Copy target ").append(mode.getTargets().get(0).getTargetName()).append(". You may choose new targets for the copy"); - return sb.toString(); + if (mode.getTargets().size() > 0) { + return "Copy target " + mode.getTargets().get(0).getTargetName() + ". You may choose new targets for the copy"; + } + return "No target"; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java index 780ba36a976..0d42a862724 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ClashEffect.java @@ -165,6 +165,7 @@ public class ClashEffect extends OneShotEffect implements MageSingleton { // decide to put the cards on top or on the buttom of library in turn order beginning with the active player in turn order PlayerList playerList = game.getPlayerList().copy(); playerList.setCurrent(game.getActivePlayerId()); + Player nextPlayer; do { Player current = playerList.getCurrent(game); if (cardController != null && current.getId().equals(controller.getId())) { @@ -173,7 +174,8 @@ public class ClashEffect extends OneShotEffect implements MageSingleton { if (cardOpponent != null && current.getId().equals(opponent.getId())) { topOpponent = current.chooseUse(Outcome.Detriment, "Put " + cardOpponent.getLogName() + " back on top of your library? (otherwise it goes to bottom)", source, game); } - } while (!playerList.getNext(game).getId().equals(game.getActivePlayerId())); + nextPlayer = playerList.getNext(game); + } while (nextPlayer != null && !nextPlayer.getId().equals(game.getActivePlayerId())); // put the cards back to library if (cardController != null) { controller.moveCardToLibraryWithInfo(cardController, source.getSourceId(), game, Zone.LIBRARY, topController, true); diff --git a/Mage/src/main/java/mage/abilities/effects/common/TransformSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/TransformSourceEffect.java index cb872c30840..a2efe876170 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/TransformSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/TransformSourceEffect.java @@ -32,6 +32,8 @@ import mage.abilities.effects.OneShotEffect; import mage.constants.Outcome; import mage.game.Game; import mage.game.permanent.Permanent; +import mage.game.permanent.PermanentToken; +import org.apache.log4j.Logger; /** * @@ -39,6 +41,8 @@ import mage.game.permanent.Permanent; */ public class TransformSourceEffect extends OneShotEffect { + private static final Logger logger = Logger.getLogger(TransformSourceEffect.class); + private boolean withoutTrigger; private boolean fromDayToNight; @@ -82,7 +86,11 @@ public class TransformSourceEffect extends OneShotEffect { } if (!game.isSimulation()) { if (fromDayToNight) { - game.informPlayers(permanent.getIdName() + " transforms into " + permanent.getSecondCardFace().getIdName()); + if (permanent.getSecondCardFace() != null) { + game.informPlayers(permanent.getIdName() + " transforms into " + permanent.getSecondCardFace().getIdName()); + } else { + logger.error("Can't get SecondCardFace " + permanent.getName() + " Token: " + (permanent instanceof PermanentToken ? "Yes" : "No")); + } } else { game.informPlayers(permanent.getSecondCardFace().getIdName() + " transforms into " + permanent.getIdName()); } diff --git a/Mage/src/main/java/mage/game/draft/DraftPlayer.java b/Mage/src/main/java/mage/game/draft/DraftPlayer.java index 1e87b0db1f3..14e61b04562 100644 --- a/Mage/src/main/java/mage/game/draft/DraftPlayer.java +++ b/Mage/src/main/java/mage/game/draft/DraftPlayer.java @@ -1,16 +1,16 @@ /* * Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR @@ -20,12 +20,11 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.game.draft; import java.util.ArrayList; @@ -69,12 +68,12 @@ public class DraftPlayer { public void prepareDeck() { if (!hiddenCards.isEmpty()) { Set cardsToDeck = new HashSet<>(); - for(Card card: deck.getSideboard()) { + for (Card card : deck.getSideboard()) { if (!hiddenCards.contains(card.getId())) { cardsToDeck.add(card); } } - for(Card card: cardsToDeck) { + for (Card card : cardsToDeck) { deck.getSideboard().remove(card); deck.getCards().add(card); } @@ -90,7 +89,7 @@ public class DraftPlayer { if (hiddenCards != null) { this.hiddenCards = hiddenCards; } - synchronized(booster) { + synchronized (booster) { booster.remove(card); } picking = false; @@ -101,13 +100,15 @@ public class DraftPlayer { // booster = set.createBooster(); // } // } - public void setBooster(List booster) { this.booster = booster; } public List getBooster() { - synchronized(booster) { + if (booster == null) { + return null; + } + synchronized (booster) { return new ArrayList<>(booster); } }