Reworking card types in preparation for implementing Grist, the Hunger Tide (#7899)

Co-authored-by: Oleg Agafonov <jaydi85@gmail.com>
This commit is contained in:
Evan Kranzler 2021-07-08 23:28:43 -04:00 committed by GitHub
parent 07e1dff10c
commit 572104b8fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1159 changed files with 2704 additions and 2203 deletions

View file

@ -36,7 +36,7 @@ public abstract class MageObjectImpl implements MageObject {
protected ObjectColor color;
protected ObjectColor frameColor;
protected FrameStyle frameStyle;
protected ArrayList<CardType> cardType = new ArrayList<>();
protected List<CardType> cardType = new ArrayList<>();
protected SubTypes subtype = new SubTypes();
protected Set<SuperType> supertype = EnumSet.noneOf(SuperType.class);
protected Abilities<Ability> abilities;
@ -114,7 +114,16 @@ public abstract class MageObjectImpl implements MageObject {
}
@Override
public ArrayList<CardType> getCardType() {
public List<CardType> getCardType(Game game) {
if (game != null) {
// dynamic
MageObjectAttribute mageObjectAttribute = game.getState().getMageObjectAttribute(getId());
if (mageObjectAttribute != null) {
return mageObjectAttribute.getCardType();
}
}
// static
return cardType;
}
@ -202,7 +211,7 @@ public abstract class MageObjectImpl implements MageObject {
public ObjectColor getFrameColor(Game game) {
// For lands, add any colors of mana the land can produce to
// its frame colors while game is active to represent ability changes during the game.
if (this.isLand() && !(this instanceof MockCard)) {
if (this.isLand(game) && !(this instanceof MockCard)) {
ObjectColor cl = frameColor.copy();
Set<ManaType> manaTypes = EnumSet.noneOf(ManaType.class);
for (Ability ab : getAbilities()) {
@ -294,9 +303,6 @@ public abstract class MageObjectImpl implements MageObject {
@Override
public boolean isAllCreatureTypes(Game game) {
if (game == null) {
return this.getAbilities().containsClass(ChangelingAbility.class);
}
return this.getSubtype(game).isAllCreatureTypes();
}
@ -307,7 +313,7 @@ public abstract class MageObjectImpl implements MageObject {
@Override
public void setIsAllCreatureTypes(Game game, boolean value) {
this.getSubtype(game).setIsAllCreatureTypes(value && (this.isTribal() || this.isCreature()));
this.getSubtype(game).setIsAllCreatureTypes(value && (this.isTribal(game) || this.isCreature(game)));
}
@Override