From 9b5a02c09cb657144d0b65d7ed1f3ca5b1e62590 Mon Sep 17 00:00:00 2001 From: fwannmacher Date: Thu, 4 Aug 2016 09:51:30 -0300 Subject: [PATCH] - Fixed issue #2075 --- .../mage/client/util/gui/GuiDisplayUtil.java | 6 ++ Mage.Common/src/mage/view/CardView.java | 9 ++- .../CoaxFromTheBlindEternities.java | 67 +++++++++---------- 3 files changed, 45 insertions(+), 37 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java index 3676095d1a..8cc83f0589 100644 --- a/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java +++ b/Mage.Client/src/main/java/mage/client/util/gui/GuiDisplayUtil.java @@ -17,6 +17,7 @@ import mage.client.util.GUISizeHelper; import mage.constants.CardType; import mage.constants.MageObjectType; import mage.constants.Rarity; +import mage.constants.Zone; import mage.utils.CardUtil; import mage.view.CardView; import mage.view.CounterView; @@ -344,6 +345,11 @@ public class GuiDisplayUtil { buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.TOOLTIP)); } + Zone zone = card.getZone(); + if (zone != null) { + buffer.append("

Card Zone: ").append(zone).append("

"); + } + buffer.append("
"); return buffer; } diff --git a/Mage.Common/src/mage/view/CardView.java b/Mage.Common/src/mage/view/CardView.java index 989c161296..df89c3c8ce 100644 --- a/Mage.Common/src/mage/view/CardView.java +++ b/Mage.Common/src/mage/view/CardView.java @@ -111,6 +111,8 @@ public class CardView extends SimpleCardView { protected boolean controlledByOwner = true; + protected Zone zone; + protected boolean rotate; protected boolean hideInfo; // controls if the tooltip window is shown (eg. controlled face down morph card) @@ -161,9 +163,10 @@ public class CardView extends SimpleCardView { // TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2 boolean showFaceUp = true; if (game != null) { + zone = game.getState().getZone(card.getId()); if (card.isFaceDown(game)) { showFaceUp = false; - if (!Zone.BATTLEFIELD.equals(game.getState().getZone(card.getId()))) { + if (!Zone.BATTLEFIELD.equals(zone)) { if (showFaceDownCard) { showFaceUp = true; } @@ -708,6 +711,10 @@ public class CardView extends SimpleCardView { return controlledByOwner; } + public Zone getZone() { + return zone; + } + public boolean isFlipCard() { return flipCard; } diff --git a/Mage.Sets/src/mage/sets/eldritchmoon/CoaxFromTheBlindEternities.java b/Mage.Sets/src/mage/sets/eldritchmoon/CoaxFromTheBlindEternities.java index 355f42ff2e..b09d3e2917 100644 --- a/Mage.Sets/src/mage/sets/eldritchmoon/CoaxFromTheBlindEternities.java +++ b/Mage.Sets/src/mage/sets/eldritchmoon/CoaxFromTheBlindEternities.java @@ -27,6 +27,7 @@ */ package mage.sets.eldritchmoon; +import java.util.List; import java.util.Set; import java.util.UUID; import mage.MageObject; @@ -72,7 +73,7 @@ public class CoaxFromTheBlindEternities extends CardImpl { class CoaxFromTheBlindEternitiesEffect extends OneShotEffect { - private static final String choiceText = "Choose a Eldrazi card you own from outside the game (sideboard), and put it into your hand?"; + private static final String choiceText = "Choose a Eldrazi card you own from outside the game (sideboard) or in exile, and put it into your hand?"; private static final FilterCard filter = new FilterCard("Eldrazi card"); @@ -99,46 +100,40 @@ class CoaxFromTheBlindEternitiesEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (controller != null && sourceObject != null) { - Cards cards = controller.getSideboard(); - Card card = null; - if (!cards.isEmpty()) { - if (controller.chooseUse(Outcome.Benefit, choiceText, source, game)) { - Set filtered = cards.getCards(filter, game); - if (filtered.isEmpty()) { - game.informPlayer(controller, "You have no " + filter.getMessage() + " outside the game (your sideboard)."); - } else { - Cards filteredCards = new CardsImpl(); - for (Card sideboardCard : filtered) { - filteredCards.add(sideboardCard.getId()); - } - TargetCard target = new TargetCard(Zone.OUTSIDE, filter); - target.setNotTarget(true); - if (controller.choose(outcome, filteredCards, target, game)) { - card = controller.getSideboard().get(target.getFirstTarget(), game); + if (controller.chooseUse(Outcome.Benefit, choiceText, source, game)) { + Set sideboard = controller.getSideboard().getCards(filter, game); + List exile = game.getExile().getAllCards(game); + Cards filteredCards = new CardsImpl(); + Card card = null; + + for (Card sideboardCard : sideboard) { + filteredCards.add(sideboardCard.getId()); + } + for (Card exileCard : exile) { + if (exileCard.getOwnerId().equals(source.getControllerId()) && exileCard.hasSubtype("Eldrazi")) { + filteredCards.add(exileCard); + } + } + + if (filteredCards.isEmpty()) { + game.informPlayer(controller, "You have no " + filter.getMessage() + " outside the game (your sideboard) or in exile."); + } + else { + TargetCard target = new TargetCard(Zone.OUTSIDE, filter); + target.setNotTarget(true); + if (controller.choose(outcome, filteredCards, target, game)) { + card = controller.getSideboard().get(target.getFirstTarget(), game); + if (card == null) { + card = game.getCard(target.getFirstTarget()); } } } - } - // Choose a card from exile - Cards filteredCards = new CardsImpl(); - for (Card exileCard : game.getExile().getAllCards(game)) { - if (exileCard.getOwnerId().equals(source.getControllerId()) && exileCard.hasSubtype("Eldrazi")) { - filteredCards.add(exileCard); + + if (card != null) { + card.moveToZone(Zone.HAND, source.getSourceId(), game, false); + controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game); } } - if (filteredCards.isEmpty()) { - game.informPlayer(controller, "You have no Eldrazi cards in the exile zone."); - } else { - TargetCard target = new TargetCard(Zone.EXILED, filter); - target.setNotTarget(true); - if (controller.choose(Outcome.Benefit, filteredCards, target, game)) { - card = game.getCard(target.getFirstTarget()); - } - } - if (card != null) { - card.moveToZone(Zone.HAND, source.getSourceId(), game, false); - controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game); - } return true; } return false;