Merge pull request #2144 from fwannmacher/master

- Fixed issue #2075
This commit is contained in:
LevelX2 2016-08-04 17:51:24 +02:00 committed by GitHub
commit 1c5d4a0f48
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();
Card card = null;
if (!cards.isEmpty()) {
if (controller.chooseUse(Outcome.Benefit, choiceText, source, game)) { if (controller.chooseUse(Outcome.Benefit, choiceText, source, game)) {
Set<Card> filtered = cards.getCards(filter, game); Set<Card> sideboard = controller.getSideboard().getCards(filter, game);
if (filtered.isEmpty()) { List<Card> exile = game.getExile().getAllCards(game);
game.informPlayer(controller, "You have no " + filter.getMessage() + " outside the game (your sideboard).");
} else {
Cards filteredCards = new CardsImpl(); Cards filteredCards = new CardsImpl();
for (Card sideboardCard : filtered) { Card card = null;
for (Card sideboardCard : sideboard) {
filteredCards.add(sideboardCard.getId()); filteredCards.add(sideboardCard.getId());
} }
TargetCard target = new TargetCard(Zone.OUTSIDE, filter); for (Card exileCard : exile) {
target.setNotTarget(true);
if (controller.choose(outcome, filteredCards, target, game)) {
card = controller.getSideboard().get(target.getFirstTarget(), game);
}
}
}
}
// 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")) { if (exileCard.getOwnerId().equals(source.getControllerId()) && exileCard.hasSubtype("Eldrazi")) {
filteredCards.add(exileCard); filteredCards.add(exileCard);
} }
} }
if (filteredCards.isEmpty()) { if (filteredCards.isEmpty()) {
game.informPlayer(controller, "You have no Eldrazi cards in the exile zone."); game.informPlayer(controller, "You have no " + filter.getMessage() + " outside the game (your sideboard) or in exile.");
} else { }
TargetCard target = new TargetCard(Zone.EXILED, filter); else {
TargetCard target = new TargetCard(Zone.OUTSIDE, filter);
target.setNotTarget(true); target.setNotTarget(true);
if (controller.choose(Outcome.Benefit, filteredCards, target, game)) { if (controller.choose(outcome, filteredCards, target, game)) {
card = controller.getSideboard().get(target.getFirstTarget(), game);
if (card == null) {
card = game.getCard(target.getFirstTarget()); card = game.getCard(target.getFirstTarget());
} }
} }
}
if (card != null) { if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false); card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game); controller.revealCards(sourceObject.getIdName(), new CardsImpl(card), game);
} }
}
return true; return true;
} }
return false; return false;