Redesigned handling of various art for cards.

This commit is contained in:
LevelX2 2012-11-27 15:24:29 +01:00
parent 96738632d1
commit 4b2e6a8bc0
15 changed files with 82 additions and 49 deletions

View file

@ -47,7 +47,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Mode;
import mage.game.permanent.PermanentCard;
/**
* @author BetaSteward_at_googlemail.com
@ -87,10 +86,7 @@ public class CardView extends SimpleCardView {
}
public CardView(Card card) {
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown(),
(card instanceof PermanentCard ?
Character.isDigit(((PermanentCard) card).getCard().getClass().getName().charAt(((PermanentCard) card).getCard().getClass().getName().length()-1))
:Character.isDigit(card.getClass().getName().charAt(card.getClass().getName().length()-1))));
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown(), card.getUsesVariousArt());
// no information available for face down cards
if (this.faceDown) {

View file

@ -47,7 +47,7 @@ public class ExileView extends SimpleCardsView {
this.name = exileZone.getName();
this.id = exileZone.getId();
for (Card card: exileZone.getCards(game)) {
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown(), Character.isDigit(card.getClass().getName().charAt(card.getClass().getName().length()-1))));
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown(), card.getUsesVariousArt()));
}
}

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(), Character.isDigit(card.getClass().getName().charAt(card.getClass().getName().length()-1)), card.isFaceDown()));
this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.isFaceDown()));
}
}

View file

@ -72,7 +72,7 @@ public class PlayerView implements Serializable {
this.isActive = (player.getId().equals(state.getActivePlayerId()));
this.hasLeft = player.hasLeft();
for (Card card: player.getGraveyard().getCards(game)) {
graveyard.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), Character.isDigit(card.getClass().getName().charAt(card.getClass().getName().length()-1)), card.isFaceDown()));
graveyard.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.isFaceDown()));
}
for (Permanent permanent: state.getBattlefield().getAllPermanents()) {
if (showInBattlefield(permanent, state)) {

View file

@ -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(), Character.isDigit(card.getClass().getName().charAt(card.getClass().getName().length()-1)), card.isFaceDown()));
this.cards.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.isFaceDown()));
}
}

View file

@ -40,14 +40,14 @@ public class SimpleCardView implements Serializable {
protected String expansionSetCode;
protected int cardNumber;
protected boolean faceDown;
protected boolean useCardNumber; // for building the image name (different images for the same card)
protected boolean usesVariousArt;
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean faceDown, boolean useCardNumber) {
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean faceDown, boolean usesVariousArt) {
this.id = id;
this.expansionSetCode = expansionSetCode;
this.cardNumber = cardNumber;
this.faceDown = faceDown;
this.useCardNumber = useCardNumber;
this.usesVariousArt = usesVariousArt;
}
public UUID getId() {
@ -66,7 +66,7 @@ public class SimpleCardView implements Serializable {
return faceDown;
}
public boolean useCardNumber() {
return useCardNumber;
public boolean getUsesVariousArt() {
return usesVariousArt;
}
}

View file

@ -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(), Character.isDigit(card.getClass().getName().charAt(card.getClass().getName().length()-1))));
this.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown(), card.getUsesVariousArt()));
}
}