moved Watchers to Ability and moved Counters to CardState

This commit is contained in:
betasteward 2015-03-01 21:17:23 -05:00
parent 620a3b9a52
commit 632573fc3e
204 changed files with 1516 additions and 347 deletions

View file

@ -50,6 +50,7 @@ import mage.target.Targets;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.game.Game;
/**
* @author BetaSteward_at_googlemail.com
@ -116,21 +117,27 @@ public class CardView extends SimpleCardView {
protected boolean canAttack;
public CardView(Card card) {
this(card, null, false);
this(card, null, null, false);
}
public CardView(Card card, UUID cardId) {
this(card, null, false);
this(card, null, null, false);
this.id = cardId;
}
public CardView(Card card, Game game, UUID cardId) {
this(card, game, null, false);
this.id = cardId;
}
/**
*
* @param card
* @param game
* @param cardId
* @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, UUID cardId, boolean controlled) {
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();
// no information available for face down cards as long it's not a controlled face down morph card
@ -241,9 +248,9 @@ public class CardView extends SimpleCardView {
this.rarity = card.getRarity();
this.isToken = false;
}
if (card.getCounters() != null && !card.getCounters().isEmpty()) {
if (game != null && card.getCounters(game) != null && !card.getCounters(game).isEmpty()) {
counters = new ArrayList<>();
for (Counter counter: card.getCounters().values()) {
for (Counter counter: card.getCounters(game).values()) {
counters.add(new CounterView(counter));
}
}