mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
moved Watchers to Ability and moved Counters to CardState
This commit is contained in:
parent
620a3b9a52
commit
632573fc3e
204 changed files with 1516 additions and 347 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ public class GameView implements Serializable {
|
|||
}
|
||||
else {
|
||||
// Spell
|
||||
stack.put(stackObject.getId(), new CardView((Spell)stackObject, null, stackObject.getControllerId().equals(createdForPlayerId)));
|
||||
stack.put(stackObject.getId(), new CardView((Spell)stackObject, game, null, stackObject.getControllerId().equals(createdForPlayerId)));
|
||||
checkPaid(stackObject.getId(), (Spell)stackObject);
|
||||
}
|
||||
//stackOrder.add(stackObject.getId());
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class PermanentView extends CardView {
|
|||
private final boolean attachedToPermanent;
|
||||
|
||||
public PermanentView(Permanent permanent, Card card, UUID createdForPlayerId, Game game) {
|
||||
super(permanent, null, permanent.getControllerId().equals(createdForPlayerId));
|
||||
super(permanent, game, null, permanent.getControllerId().equals(createdForPlayerId));
|
||||
this.controlled = permanent.getControllerId().equals(createdForPlayerId);
|
||||
this.rules = permanent.getRules();
|
||||
this.tapped = permanent.isTapped();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue