Changes to show name and number of counter on a card.

This commit is contained in:
LevelX2 2013-03-04 00:03:21 +01:00
parent cc96a55523
commit dc131fa8dd
5 changed files with 60 additions and 13 deletions

View file

@ -47,6 +47,8 @@ import mage.target.Targets;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.counters.Counter;
import mage.counters.Counters;
/**
* @author BetaSteward_at_googlemail.com
@ -79,6 +81,7 @@ public class CardView extends SimpleCardView {
protected UUID pairedCard;
protected boolean paid;
protected List<CounterView> counters;
public CardView(Card card, UUID cardId) {
this(card);
@ -121,7 +124,12 @@ public class CardView extends SimpleCardView {
} else {
this.rarity = card.getRarity();
}
if (card.getCounters() != null && !card.getCounters().isEmpty()) {
counters = new ArrayList<CounterView>();
for (Counter counter: card.getCounters().values()) {
counters.add(new CounterView(counter));
}
}
if (card.getSecondCardFace() != null) {
this.secondCardFace = new CardView(card.getSecondCardFace());
}
@ -161,6 +169,16 @@ public class CardView extends SimpleCardView {
this.color = card.getColor();
this.manaCost = card.getManaCost().getSymbols();
this.convertedManaCost = card.getManaCost().convertedManaCost();
// if (card instanceof Card) {
// Counters cardCounters = ((Card) card).getCounters();
// if (cardCounters != null && !cardCounters.isEmpty()) {
// counters = new ArrayList<CounterView>();
// for (Counter counter: cardCounters.values()) {
// counters.add(new CounterView(counter));
// }
// }
// }
if (card instanceof PermanentToken) {
this.rarity = Rarity.COMMON;
this.expansionSetCode = ((PermanentToken) card).getExpansionSetCode();
@ -411,4 +429,8 @@ public class CardView extends SimpleCardView {
public void setPaid(boolean paid) {
this.paid = paid;
}
public List<CounterView> getCounters() {
return counters;
}
}

View file

@ -37,7 +37,7 @@ import mage.game.Game;
*
* @author BetaSteward_at_googlemail.com
*/
public class ExileView extends SimpleCardsView {
public class ExileView extends CardsView {
private static final long serialVersionUID = 1L;
private String 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(), card.getUsesVariousArt()));
this.put(card.getId(), new CardView(card));
}
}