mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 12:31:59 -08:00
moved faceDown property from Card to CardState
This commit is contained in:
parent
d7b9a4a979
commit
9ad8530dee
61 changed files with 378 additions and 224 deletions
|
|
@ -87,7 +87,7 @@ public class CardView extends SimpleCardView {
|
|||
protected boolean transformed;
|
||||
|
||||
protected boolean flipCard;
|
||||
protected boolean morphCard;
|
||||
protected boolean faceDown;
|
||||
|
||||
protected String alternateName;
|
||||
protected String originalName;
|
||||
|
|
@ -138,13 +138,12 @@ public class CardView extends SimpleCardView {
|
|||
* @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.isFaceDown(), card.getUsesVariousArt(), card.getTokenSetCode());
|
||||
this.morphCard = card.isMorphCard();
|
||||
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode());
|
||||
// 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
|
||||
if (card.isFaceDown()) {
|
||||
if (card.isFaceDown(game)) {
|
||||
this.fillEmpty(card, controlled);
|
||||
if (card.isMorphCard() && card instanceof Spell) {
|
||||
if (card instanceof Spell) {
|
||||
// special handling for casting of Morph cards
|
||||
if (controlled) {
|
||||
this.name = card.getName();
|
||||
|
|
@ -242,7 +241,7 @@ public class CardView extends SimpleCardView {
|
|||
this.color = card.getColor();
|
||||
this.canTransform = card.canTransform();
|
||||
this.flipCard = card.isFlipCard();
|
||||
|
||||
this.faceDown = game != null ? card.isFaceDown(game) : false;
|
||||
|
||||
if (card instanceof PermanentToken) {
|
||||
this.isToken = true;
|
||||
|
|
@ -299,7 +298,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
public CardView(MageObject object) {
|
||||
super(object.getId(), "", 0, false, false, "");
|
||||
super(object.getId(), "", 0, false, "");
|
||||
this.name = object.getName();
|
||||
this.displayName = object.getName();
|
||||
if (object instanceof Permanent) {
|
||||
|
|
@ -343,7 +342,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
protected CardView() {
|
||||
super(null, "", 0, false, false, "");
|
||||
super(null, "", 0, false, "");
|
||||
}
|
||||
|
||||
public CardView(EmblemView emblem) {
|
||||
|
|
@ -359,7 +358,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
public CardView(boolean empty) {
|
||||
super(null, "", 0, false, false, "");
|
||||
super(null, "", 0, false, "");
|
||||
if (!empty) {
|
||||
throw new IllegalArgumentException("Not supported.");
|
||||
}
|
||||
|
|
@ -417,7 +416,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
CardView(Token token) {
|
||||
super(token.getId(), "", 0, false, false, "");
|
||||
super(token.getId(), "", 0, false, "");
|
||||
this.isToken = true;
|
||||
this.id = token.getId();
|
||||
this.name = token.getName();
|
||||
|
|
@ -581,7 +580,6 @@ public class CardView extends SimpleCardView {
|
|||
return getName() + " [" + getId() + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFaceDown() {
|
||||
return faceDown;
|
||||
}
|
||||
|
|
@ -696,10 +694,6 @@ public class CardView extends SimpleCardView {
|
|||
return flipCard;
|
||||
}
|
||||
|
||||
public boolean isMorphCard() {
|
||||
return morphCard;
|
||||
}
|
||||
|
||||
public boolean isToRotate() {
|
||||
return rotate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.isFaceDown(), card.getTokenSetCode()));
|
||||
this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,10 +84,7 @@ public class PermanentView extends CardView {
|
|||
} else {
|
||||
if (card != null) {
|
||||
// original may not be face down
|
||||
boolean wasfaceDown = card.isFaceDown();
|
||||
card.setFaceDown(false);
|
||||
original = new CardView(card);
|
||||
card.setFaceDown(wasfaceDown);
|
||||
} else {
|
||||
original = null;
|
||||
}
|
||||
|
|
@ -119,7 +116,7 @@ public class PermanentView extends CardView {
|
|||
this.nameOwner = "";
|
||||
}
|
||||
|
||||
if (permanent.isFaceDown() && card != null) {
|
||||
if (permanent.isFaceDown(game) && card != null) {
|
||||
if (controlled){
|
||||
// must be a morphed or manifested card
|
||||
for (Ability permanentAbility : permanent.getAbilities()) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class RevealedView implements Serializable {
|
|||
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.isFaceDown(), card.getTokenSetCode()));
|
||||
this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,14 +40,12 @@ public class SimpleCardView implements Serializable {
|
|||
protected String expansionSetCode;
|
||||
protected String tokenSetCode;
|
||||
protected int cardNumber;
|
||||
protected boolean faceDown;
|
||||
protected boolean usesVariousArt;
|
||||
|
||||
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean faceDown, boolean usesVariousArt, String tokenSetCode) {
|
||||
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean usesVariousArt, String tokenSetCode) {
|
||||
this.id = id;
|
||||
this.expansionSetCode = expansionSetCode;
|
||||
this.cardNumber = cardNumber;
|
||||
this.faceDown = faceDown;
|
||||
this.usesVariousArt = usesVariousArt;
|
||||
this.tokenSetCode = tokenSetCode;
|
||||
}
|
||||
|
|
@ -64,10 +62,6 @@ public class SimpleCardView implements Serializable {
|
|||
return cardNumber;
|
||||
}
|
||||
|
||||
public boolean isFaceDown() {
|
||||
return faceDown;
|
||||
}
|
||||
|
||||
public boolean getUsesVariousArt() {
|
||||
return usesVariousArt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class SimpleCardsView extends LinkedHashMap<UUID, SimpleCardView> {
|
|||
|
||||
public SimpleCardsView(Collection<Card> cards) {
|
||||
for (Card card: cards) {
|
||||
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class StackAbilityView extends CardView {
|
|||
this.power = ability.getPower().toString();
|
||||
this.toughness = ability.getToughness().toString();
|
||||
String nameToShow;
|
||||
if (sourceCard.isMorphCard() && sourceCard.isFaceDown()) {
|
||||
if (sourceCard.isFaceDown()) {
|
||||
CardView tmpSourceCard = this.getSourceCard();
|
||||
tmpSourceCard.displayName = "Face Down";
|
||||
tmpSourceCard.superTypes.clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue