- Removed "CARD ZONE" from tooltip when it is not necessary

This commit is contained in:
fwannmacher 2016-08-08 18:30:42 -03:00 committed by fwann
parent 00b6327859
commit a052830628
4 changed files with 14 additions and 9 deletions

View file

@ -144,7 +144,7 @@ public class CardView extends SimpleCardView {
* the card
*/
public CardView(Card card, Game game, boolean controlled) {
this(card, game, controlled, false);
this(card, game, controlled, false, false);
}
/**
@ -156,22 +156,27 @@ public class CardView extends SimpleCardView {
* the card
* @param showFaceDownCard if true and the card is not on the battlefield,
* also a face down card is shown in the view, face down cards will be shown
* @param storeZone if true the card zone will be set in the zone attribute.
*/
public CardView(Card card, Game game, boolean controlled, boolean showFaceDownCard) {
public CardView(Card card, Game game, boolean controlled, boolean showFaceDownCard, boolean storeZone) {
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null);
// no information available for face down cards as long it's not a controlled face down morph card
// 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());
Zone cardZone = game.getState().getZone(card.getId());
if (card.isFaceDown(game)) {
showFaceUp = false;
if (!Zone.BATTLEFIELD.equals(zone)) {
if (!Zone.BATTLEFIELD.equals(cardZone)) {
if (showFaceDownCard) {
showFaceUp = true;
}
}
}
if (storeZone) {
this.zone = cardZone;
}
}
// boolean showFaceUp = game == null || !card.isFaceDown(game) || (!game.getState().getZone(card.getId()).equals(Zone.BATTLEFIELD) && showFaceDownCard);

View file

@ -66,9 +66,9 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
}
}
public CardsView(Game game, Collection<? extends Card> cards, boolean showFaceDown) {
public CardsView(Game game, Collection<? extends Card> cards, boolean showFaceDown, boolean storeZone) {
for (Card card : cards) {
this.put(card.getId(), new CardView(card, game, false, showFaceDown));
this.put(card.getId(), new CardView(card, game, false, showFaceDown, storeZone));
}
}

View file

@ -109,9 +109,9 @@ public class GameView implements Serializable {
if (object != null) {
if (object instanceof Permanent) {
boolean controlled = ((Permanent) object).getControllerId().equals(createdForPlayerId);
stack.put(stackObject.getId(), new StackAbilityView(game, (StackAbility) stackObject, ((Permanent) object).getName(), new CardView(((Permanent) object), game, controlled, false)));
stack.put(stackObject.getId(), new StackAbilityView(game, (StackAbility) stackObject, ((Permanent) object).getName(), new CardView(((Permanent) object), game, controlled, false, false)));
} else {
stack.put(stackObject.getId(), new StackAbilityView(game, (StackAbility) stackObject, card.getName(), new CardView(card, game, false, false)));
stack.put(stackObject.getId(), new StackAbilityView(game, (StackAbility) stackObject, card.getName(), new CardView(card, game, false, false, false)));
}
} else {
stack.put(stackObject.getId(), new StackAbilityView(game, (StackAbility) stackObject, "", new CardView(card)));

View file

@ -836,7 +836,7 @@ public class GameController implements GameCallback {
// So always show face up for selection
// boolean showFaceDown = targetZone != null && targetZone.equals(Zone.PICK);
boolean showFaceDown = true;
getGameSession(playerId).target(question, new CardsView(game, cards.getCards(game), showFaceDown), targets, required, options);
getGameSession(playerId).target(question, new CardsView(game, cards.getCards(game), showFaceDown, true), targets, required, options);
} else if (perms != null) {
CardsView permsView = new CardsView();
for (Permanent perm : perms) {