Card.java: add exiledCards CardCollection

This commit is contained in:
Northmoc
2022-04-25 11:13:19 -04:00
parent 69377622cc
commit fa3f7715a3

View File

@@ -109,7 +109,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
private final Table<Long, Long, List<String>> hiddenExtrinsicKeywords = TreeBasedTable.create(); private final Table<Long, Long, List<String>> hiddenExtrinsicKeywords = TreeBasedTable.create();
// cards attached or otherwise linked to this card // cards attached or otherwise linked to this card
private CardCollection hauntedBy, devouredCards, exploitedCards, delvedCards, convokedCards, imprintedCards, encodedCards; private CardCollection hauntedBy, devouredCards, exploitedCards, delvedCards, convokedCards, imprintedCards,
exiledCards, encodedCards;
private CardCollection gainControlTargets, chosenCards; private CardCollection gainControlTargets, chosenCards;
private CardCollection mergedCards; private CardCollection mergedCards;
private Map<Long, CardCollection> mustBlockCards = Maps.newHashMap(); private Map<Long, CardCollection> mustBlockCards = Maps.newHashMap();
@@ -1082,6 +1083,31 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
imprintedCards = view.clearCards(imprintedCards, TrackableProperty.ImprintedCards); imprintedCards = view.clearCards(imprintedCards, TrackableProperty.ImprintedCards);
} }
public final CardCollectionView getExiledCards() {
return CardCollection.getView(exiledCards);
}
public final boolean hasExiledCard() {
return FCollection.hasElements(exiledCards);
}
public final boolean hasExiledCard(Card c) {
return FCollection.hasElement(exiledCards, c);
}
public final void addExiledCard(final Card c) {
exiledCards = view.addCard(exiledCards, c, TrackableProperty.ExiledCards);
}
public final void addExiledCards(final Iterable<Card> cards) {
exiledCards = view.addCards(exiledCards, cards, TrackableProperty.ExiledCards);
}
public final void removeExiledCard(final Card c) {
exiledCards = view.removeCard(exiledCards, c, TrackableProperty.ExiledCards);
}
public final void removeExiledCards(final Iterable<Card> cards) {
exiledCards = view.removeCards(exiledCards, cards, TrackableProperty.ExiledCards);
}
public final void clearExiledCards() {
exiledCards = view.clearCards(exiledCards, TrackableProperty.ExiledCards);
}
public final CardCollectionView getEncodedCards() { public final CardCollectionView getEncodedCards() {
return CardCollection.getView(encodedCards); return CardCollection.getView(encodedCards);
} }
@@ -1686,6 +1712,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
return; return;
} }
exiledWith.removeExiledCard(this);
exiledWith.removeUntilLeavesBattlefield(this); exiledWith.removeUntilLeavesBattlefield(this);
exiledWith = null; exiledWith = null;