mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
Identifier are shown for Looked at and revealed cards view
This commit is contained in:
parent
cb666a87ca
commit
bafd27f5b3
20 changed files with 58 additions and 56 deletions
|
|
@ -114,20 +114,19 @@ public class CardView extends SimpleCardView {
|
|||
protected boolean isPlayable;
|
||||
protected boolean isChoosable;
|
||||
protected boolean selected;
|
||||
protected boolean canAttack;
|
||||
protected boolean gameObject;
|
||||
protected boolean canAttack;
|
||||
|
||||
public CardView(Card card) {
|
||||
this(card, null, null, false);
|
||||
this(card, null, false);
|
||||
}
|
||||
|
||||
public CardView(Card card, UUID cardId) {
|
||||
this(card, null, null, false);
|
||||
this(card, null, false);
|
||||
this.id = cardId;
|
||||
}
|
||||
|
||||
public CardView(Card card, Game game, UUID cardId) {
|
||||
this(card, game, null, false);
|
||||
this(card, game, false);
|
||||
this.id = cardId;
|
||||
}
|
||||
|
||||
|
|
@ -135,15 +134,12 @@ public class CardView extends SimpleCardView {
|
|||
*
|
||||
* @param card
|
||||
* @param game
|
||||
* @param cardId not used?
|
||||
* @param controlled is the card view created for the card controller - used for morph / face down cards to know which player may see information for the card
|
||||
*/
|
||||
public CardView(Card card, Game game, UUID cardId, boolean controlled) {
|
||||
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode());
|
||||
public CardView(Card card, Game game, boolean controlled) {
|
||||
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
|
||||
this.gameObject = game != null;
|
||||
|
||||
// TODO: Better handle this in Framework (but currently I'm not sure how to do it there) LevelX2
|
||||
if (game != null && card.isFaceDown(game)) {
|
||||
this.fillEmpty(card, controlled);
|
||||
if (card instanceof Spell) {
|
||||
|
|
@ -301,7 +297,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
public CardView(MageObject object) {
|
||||
super(object.getId(), "", 0, false, "");
|
||||
super(object.getId(), "", 0, false, "", true);
|
||||
this.name = object.getName();
|
||||
this.displayName = object.getName();
|
||||
if (object instanceof Permanent) {
|
||||
|
|
@ -345,11 +341,12 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
protected CardView() {
|
||||
super(null, "", 0, false, "");
|
||||
super(null, "", 0, false, "", true);
|
||||
}
|
||||
|
||||
public CardView(EmblemView emblem) {
|
||||
this(true);
|
||||
this.gameObject = true;
|
||||
this.id = emblem.getId();
|
||||
this.mageObjectType = MageObjectType.EMBLEM;
|
||||
this.name = emblem.getName();
|
||||
|
|
@ -368,13 +365,6 @@ public class CardView extends SimpleCardView {
|
|||
fillEmpty(null, false);
|
||||
}
|
||||
|
||||
|
||||
public CardView(String name) {
|
||||
this(true);
|
||||
this.name = name;
|
||||
this.displayName = name;
|
||||
}
|
||||
|
||||
private void fillEmpty(Card card, boolean controlled) {
|
||||
this.name = "Face Down";
|
||||
this.displayName = name;
|
||||
|
|
@ -736,8 +726,5 @@ public class CardView extends SimpleCardView {
|
|||
public void setCanAttack(boolean canAttack) {
|
||||
this.canAttack = canAttack;
|
||||
}
|
||||
|
||||
public boolean isGameObject() {
|
||||
return gameObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class CardsView extends LinkedHashMap<UUID, CardView> {
|
|||
|
||||
public CardsView(Game game, Collection<? extends Card> cards) {
|
||||
for (Card card: cards) {
|
||||
this.put(card.getId(), new CardView(card, game, null, false));
|
||||
this.put(card.getId(), new CardView(card, game, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import mage.game.command.Commander;
|
|||
public class CommanderView extends CardView implements CommandObjectView, Serializable{
|
||||
|
||||
public CommanderView(Commander commander, Card sourceCard, Game game) {
|
||||
super(sourceCard, game, null, false);
|
||||
super(sourceCard, game, false);
|
||||
this.mageObjectType = MageObjectType.COMMANDER;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ public class DeckView implements Serializable {
|
|||
|
||||
public DeckView(Deck deck) {
|
||||
name = deck.getName();
|
||||
cards = new SimpleCardsView(deck.getCards());
|
||||
sideboard = new SimpleCardsView(deck.getSideboard());
|
||||
cards = new SimpleCardsView(deck.getCards(), false);
|
||||
sideboard = new SimpleCardsView(deck.getSideboard(), false);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ public class DraftPickView implements Serializable {
|
|||
protected int timeout;
|
||||
|
||||
public DraftPickView(DraftPlayer player, int timeout) {
|
||||
this.booster = new SimpleCardsView(player.getBooster());
|
||||
this.picks = new SimpleCardsView(player.getDeck().getSideboard());
|
||||
this.booster = new SimpleCardsView(player.getBooster(), false);
|
||||
this.picks = new SimpleCardsView(player.getDeck().getSideboard(), false);
|
||||
this.picking = player.isPicking();
|
||||
this.timeout = timeout;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class ExileView extends CardsView {
|
|||
this.name = exileZone.getName();
|
||||
this.id = exileZone.getId();
|
||||
for (Card card: exileZone.getCards(game)) {
|
||||
this.put(card.getId(), new CardView(card, game, card.getId(), false));
|
||||
this.put(card.getId(), new CardView(card, game, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ public class GameView implements Serializable {
|
|||
}
|
||||
else {
|
||||
// Spell
|
||||
stack.put(stackObject.getId(), new CardView((Spell)stackObject, game, null, stackObject.getControllerId().equals(createdForPlayerId)));
|
||||
stack.put(stackObject.getId(), new CardView((Spell)stackObject, game, stackObject.getControllerId().equals(createdForPlayerId)));
|
||||
checkPaid(stackObject.getId(), (Spell)stackObject);
|
||||
}
|
||||
//stackOrder.add(stackObject.getId());
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class LookedAtView implements Serializable {
|
|||
public LookedAtView(String name, Cards cards, Game game) {
|
||||
this.name = name;
|
||||
for (Card card: cards.getCards(game)) {
|
||||
this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
this.cards.put(card.getId(), new CardView(card, game, card.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class PermanentView extends CardView {
|
|||
private final boolean attachedToPermanent;
|
||||
|
||||
public PermanentView(Permanent permanent, Card card, UUID createdForPlayerId, Game game) {
|
||||
super(permanent, game, null, permanent.getControllerId().equals(createdForPlayerId));
|
||||
super(permanent, game, permanent.getControllerId().equals(createdForPlayerId));
|
||||
this.controlled = permanent.getControllerId().equals(createdForPlayerId);
|
||||
this.rules = permanent.getRules(game);
|
||||
this.tapped = permanent.isTapped();
|
||||
|
|
|
|||
|
|
@ -95,12 +95,12 @@ public class PlayerView implements Serializable {
|
|||
|
||||
this.hasLeft = player.hasLeft();
|
||||
for (Card card: player.getGraveyard().getCards(game)) {
|
||||
graveyard.put(card.getId(), new CardView(card, game, card.getId(), false));
|
||||
graveyard.put(card.getId(), new CardView(card, game, false));
|
||||
}
|
||||
for (ExileZone exileZone : game.getExile().getExileZones()) {
|
||||
for (Card card : exileZone.getCards(game)) {
|
||||
if (player.getId().equals(card.getOwnerId())) {
|
||||
exile.put(card.getId(), new CardView(card, game, card.getId(), false)); // unnown if it's allowed to look under a face down card
|
||||
exile.put(card.getId(), new CardView(card, game, false)); // unnown if it's allowed to look under a face down card
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,12 +40,12 @@ import mage.game.Game;
|
|||
public class RevealedView implements Serializable {
|
||||
|
||||
private final String name;
|
||||
private final SimpleCardsView cards = new SimpleCardsView();
|
||||
private final CardsView cards = new CardsView();
|
||||
|
||||
public RevealedView(String name, Cards cards, Game game) {
|
||||
this.name = name;
|
||||
for (Card card: cards.getCards(game)) {
|
||||
this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
this.cards.put(card.getId(), new CardView(card, game, card.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ public class RevealedView implements Serializable {
|
|||
return name;
|
||||
}
|
||||
|
||||
public SimpleCardsView getCards() {
|
||||
public CardsView getCards() {
|
||||
return cards;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,13 +41,18 @@ public class SimpleCardView implements Serializable {
|
|||
protected String tokenSetCode;
|
||||
protected int cardNumber;
|
||||
protected boolean usesVariousArt;
|
||||
protected boolean gameObject;
|
||||
|
||||
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean usesVariousArt, String tokenSetCode) {
|
||||
this(id, expansionSetCode, cardNumber, usesVariousArt, tokenSetCode, false);
|
||||
}
|
||||
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean usesVariousArt, String tokenSetCode, boolean isGameObject) {
|
||||
this.id = id;
|
||||
this.expansionSetCode = expansionSetCode;
|
||||
this.cardNumber = cardNumber;
|
||||
this.usesVariousArt = usesVariousArt;
|
||||
this.tokenSetCode = tokenSetCode;
|
||||
this.gameObject = isGameObject;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
|
|
@ -69,5 +74,8 @@ public class SimpleCardView implements Serializable {
|
|||
public String getTokenSetCode() {
|
||||
return tokenSetCode;
|
||||
}
|
||||
|
||||
|
||||
public boolean isGameObject() {
|
||||
return gameObject;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ public class SimpleCardsView extends LinkedHashMap<UUID, SimpleCardView> {
|
|||
|
||||
public SimpleCardsView() {}
|
||||
|
||||
public SimpleCardsView(Collection<Card> cards) {
|
||||
public SimpleCardsView(Collection<Card> cards, boolean isGameObject) {
|
||||
for (Card card: cards) {
|
||||
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), isGameObject));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue