mirror of
https://github.com/magefree/mage.git
synced 2026-01-23 03:39:54 -08:00
Improved the handling of image files for handling also different images of non basic lands (e.g. Fallen Empires).
This commit is contained in:
parent
efe5611c76
commit
f72e1a1038
11 changed files with 51 additions and 33 deletions
|
|
@ -86,7 +86,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
public CardView(Card card) {
|
||||
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown());
|
||||
super(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.isFaceDown(), Character.isDigit(card.getClass().getName().charAt(card.getClass().getName().length()-1)));
|
||||
|
||||
// no information available for face down cards
|
||||
if (this.faceDown) {
|
||||
|
|
@ -142,7 +142,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
public CardView(MageObject card) {
|
||||
super(card.getId(), "", 0, false);
|
||||
super(card.getId(), "", 0, false, false);
|
||||
|
||||
this.name = card.getName();
|
||||
if (card instanceof Permanent) {
|
||||
|
|
@ -178,11 +178,11 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
protected CardView() {
|
||||
super(null, "", 0, false);
|
||||
super(null, "", 0, false, false);
|
||||
}
|
||||
|
||||
public CardView(boolean empty) {
|
||||
super(null, "", 0, false);
|
||||
super(null, "", 0, false, false);
|
||||
if (!empty) {
|
||||
throw new IllegalArgumentException("Not supported.");
|
||||
}
|
||||
|
|
@ -212,7 +212,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
|
||||
CardView(Token token) {
|
||||
super(token.getId(), "", 0, false);
|
||||
super(token.getId(), "", 0, false, false);
|
||||
this.id = token.getId();
|
||||
this.name = token.getName();
|
||||
this.rules = token.getAbilities().getRules(this.name);
|
||||
|
|
|
|||
|
|
@ -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()));
|
||||
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))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.isFaceDown()));
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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(), card.isFaceDown()));
|
||||
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()));
|
||||
}
|
||||
for (Permanent permanent: state.getBattlefield().getAllPermanents()) {
|
||||
if (showInBattlefield(permanent, state)) {
|
||||
|
|
|
|||
|
|
@ -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.isFaceDown()));
|
||||
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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,12 +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)
|
||||
|
||||
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean faceDown) {
|
||||
public SimpleCardView(UUID id, String expansionSetCode, int cardNumber, boolean faceDown, boolean useCardNumber) {
|
||||
this.id = id;
|
||||
this.expansionSetCode = expansionSetCode;
|
||||
this.cardNumber = cardNumber;
|
||||
this.faceDown = faceDown;
|
||||
this.useCardNumber = useCardNumber;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
|
|
@ -63,4 +65,8 @@ public class SimpleCardView implements Serializable {
|
|||
public boolean isFaceDown() {
|
||||
return faceDown;
|
||||
}
|
||||
|
||||
public boolean useCardNumber() {
|
||||
return useCardNumber;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()));
|
||||
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))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue