Merge remote-tracking branch 'magefree/master'

This commit is contained in:
Samuel Sandeen 2016-09-02 19:44:51 -04:00
commit 85dc15c5dc
61 changed files with 1443 additions and 702 deletions

View file

@ -159,7 +159,7 @@ public class CardView extends SimpleCardView {
* @param storeZone if true the card zone will be set in the zone attribute.
*/
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);
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), game != null, card.getTokenDescriptor());
// 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;
@ -291,6 +291,7 @@ public class CardView extends SimpleCardView {
} else {
// a created token
this.expansionSetCode = ((PermanentToken) card).getExpansionSetCode();
this.tokenDescriptor = ((PermanentToken) card).getTokenDescriptor();
}
//
// set code und card number for token copies to get the image
@ -332,7 +333,7 @@ public class CardView extends SimpleCardView {
}
public CardView(MageObject object) {
super(object.getId(), "", "0", false, "", true);
super(object.getId(), "", "0", false, "", true, "");
this.name = object.getName();
this.displayName = object.getName();
if (object instanceof Permanent) {
@ -376,7 +377,7 @@ public class CardView extends SimpleCardView {
}
protected CardView() {
super(null, "", "0", false, "", true);
super(null, "", "0", false, "", true, "");
}
public CardView(EmblemView emblem) {
@ -393,7 +394,7 @@ public class CardView extends SimpleCardView {
}
public CardView(boolean empty) {
super(null, "", "0", false, "");
super(null, "", "0", false, "", "");
if (!empty) {
throw new IllegalArgumentException("Not supported.");
}
@ -442,7 +443,7 @@ public class CardView extends SimpleCardView {
}
CardView(Token token) {
super(token.getId(), "", "0", false, "");
super(token.getId(), "", "0", false, "", "");
this.isToken = true;
this.id = token.getId();
this.name = token.getName();
@ -459,6 +460,7 @@ public class CardView extends SimpleCardView {
this.rarity = Rarity.NA;
this.type = token.getTokenType();
this.tokenSetCode = token.getOriginalExpansionSetCode();
this.tokenDescriptor = token.getTokenDescriptor();
}
protected final void setTargets(Targets targets) {

View file

@ -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 SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), card.getTokenDescriptor()));
}
}

View file

@ -81,6 +81,7 @@ public class PermanentView extends CardView {
original = new CardView(((PermanentToken) permanent).getToken());
original.expansionSetCode = permanent.getExpansionSetCode();
tokenSetCode = original.getTokenSetCode();
tokenDescriptor = original.getTokenDescriptor();
} else {
if (card != null) {
// original may not be face down

View file

@ -39,16 +39,18 @@ public class SimpleCardView implements Serializable {
protected UUID id;
protected String expansionSetCode;
protected String tokenSetCode;
protected String tokenDescriptor;
protected String cardNumber;
protected boolean usesVariousArt;
protected boolean gameObject;
public SimpleCardView(UUID id, String expansionSetCode, String cardNumber, boolean usesVariousArt, String tokenSetCode) {
this(id, expansionSetCode, cardNumber, usesVariousArt, tokenSetCode, false);
public SimpleCardView(UUID id, String expansionSetCode, String cardNumber, boolean usesVariousArt, String tokenSetCode, String tokenDescriptor) {
this(id, expansionSetCode, cardNumber, usesVariousArt, tokenSetCode, false, tokenDescriptor);
}
public SimpleCardView(UUID id, String expansionSetCode, String cardNumber, boolean usesVariousArt, String tokenSetCode, boolean isGameObject) {
public SimpleCardView(UUID id, String expansionSetCode, String cardNumber, boolean usesVariousArt, String tokenSetCode, boolean isGameObject, String tokenDescriptor) {
this.id = id;
this.expansionSetCode = expansionSetCode;
this.tokenDescriptor = tokenDescriptor;
this.cardNumber = cardNumber;
this.usesVariousArt = usesVariousArt;
this.tokenSetCode = tokenSetCode;
@ -74,6 +76,10 @@ public class SimpleCardView implements Serializable {
public String getTokenSetCode() {
return tokenSetCode;
}
public String getTokenDescriptor() {
return tokenDescriptor;
}
public boolean isGameObject() {
return gameObject;

View file

@ -44,7 +44,8 @@ public class SimpleCardsView extends LinkedHashMap<UUID, SimpleCardView> {
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(), isGameObject));
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.getTokenSetCode(), isGameObject,
card.getTokenDescriptor()));
}
}