- Fixed issue #2075

This commit is contained in:
fwannmacher 2016-08-04 09:51:30 -03:00 committed by fwann
parent 1346949368
commit 9b5a02c09c
3 changed files with 45 additions and 37 deletions

View file

@ -17,6 +17,7 @@ import mage.client.util.GUISizeHelper;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.MageObjectType; import mage.constants.MageObjectType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.Zone;
import mage.utils.CardUtil; import mage.utils.CardUtil;
import mage.view.CardView; import mage.view.CardView;
import mage.view.CounterView; import mage.view.CounterView;
@ -344,6 +345,11 @@ public class GuiDisplayUtil {
buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.TOOLTIP)); buffer.append(ManaSymbols.replaceSymbolsWithHTML(legal, ManaSymbols.Type.TOOLTIP));
} }
Zone zone = card.getZone();
if (zone != null) {
buffer.append("<p style='margin: 2px'><b>Card Zone:</b> ").append(zone).append("</p>");
}
buffer.append("<br></body></html>"); buffer.append("<br></body></html>");
return buffer; return buffer;
} }

View file

@ -111,6 +111,8 @@ public class CardView extends SimpleCardView {
protected boolean controlledByOwner = true; protected boolean controlledByOwner = true;
protected Zone zone;
protected boolean rotate; protected boolean rotate;
protected boolean hideInfo; // controls if the tooltip window is shown (eg. controlled face down morph card) 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 // TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2
boolean showFaceUp = true; boolean showFaceUp = true;
if (game != null) { if (game != null) {
zone = game.getState().getZone(card.getId());
if (card.isFaceDown(game)) { if (card.isFaceDown(game)) {
showFaceUp = false; showFaceUp = false;
if (!Zone.BATTLEFIELD.equals(game.getState().getZone(card.getId()))) { if (!Zone.BATTLEFIELD.equals(zone)) {
if (showFaceDownCard) { if (showFaceDownCard) {
showFaceUp = true; showFaceUp = true;
} }
@ -708,6 +711,10 @@ public class CardView extends SimpleCardView {
return controlledByOwner; return controlledByOwner;
} }
public Zone getZone() {
return zone;
}
public boolean isFlipCard() { public boolean isFlipCard() {
return flipCard; return flipCard;
} }

View file

@ -27,6 +27,7 @@
*/ */
package mage.sets.eldritchmoon; package mage.sets.eldritchmoon;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import mage.MageObject; import mage.MageObject;
@ -72,7 +73,7 @@ public class CoaxFromTheBlindEternities extends CardImpl {
class CoaxFromTheBlindEternitiesEffect extends OneShotEffect { 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"); private static final FilterCard filter = new FilterCard("Eldrazi card");
@ -99,46 +100,40 @@ class CoaxFromTheBlindEternitiesEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game); MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) { if (controller != null && sourceObject != null) {
Cards cards = controller.getSideboard(); if (controller.chooseUse(Outcome.Benefit, choiceText, source, game)) {
Card card = null; Set<Card> sideboard = controller.getSideboard().getCards(filter, game);
if (!cards.isEmpty()) { List<Card> exile = game.getExile().getAllCards(game);
if (controller.chooseUse(Outcome.Benefit, choiceText, source, game)) { Cards filteredCards = new CardsImpl();
Set<Card> filtered = cards.getCards(filter, game); Card card = null;
if (filtered.isEmpty()) {
game.informPlayer(controller, "You have no " + filter.getMessage() + " outside the game (your sideboard)."); for (Card sideboardCard : sideboard) {
} else { filteredCards.add(sideboardCard.getId());
Cards filteredCards = new CardsImpl(); }
for (Card sideboardCard : filtered) { for (Card exileCard : exile) {
filteredCards.add(sideboardCard.getId()); if (exileCard.getOwnerId().equals(source.getControllerId()) && exileCard.hasSubtype("Eldrazi")) {
} filteredCards.add(exileCard);
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 (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 if (card != null) {
Cards filteredCards = new CardsImpl(); card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
for (Card exileCard : game.getExile().getAllCards(game)) { controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
if (exileCard.getOwnerId().equals(source.getControllerId()) && exileCard.hasSubtype("Eldrazi")) {
filteredCards.add(exileCard);
} }
} }
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 true;
} }
return false; return false;