huge rework on subtypes (#3668)

* huge rework on subtypes

* update for coat of arms

* fix test
This commit is contained in:
ingmargoudt 2017-07-16 23:57:39 +02:00 committed by Jeff Wadsworth
parent 81fb4b5d92
commit 09f0c9ad97
185 changed files with 1068 additions and 906 deletions

View file

@ -8,13 +8,14 @@ import mage.abilities.keyword.ChangelingAbility;
import mage.cards.Card;
import mage.cards.FrameStyle;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.game.Game;
import mage.game.events.ZoneChangeEvent;
import mage.util.SubTypeList;
import java.io.Serializable;
import java.util.EnumSet;
import java.util.List;
import java.util.UUID;
public interface MageObject extends MageItem, Serializable {
@ -31,9 +32,13 @@ public interface MageObject extends MageItem, Serializable {
EnumSet<CardType> getCardType();
List<String> getSubtype(Game game);
SubTypeList getSubtype(Game game);
boolean hasSubtype(String subtype, Game game);
boolean hasSubtype(SubType subtype, Game game);
default boolean hasSubtype(String subtype, Game game){
return hasSubtype(SubType.byDescription(subtype), game);
}
EnumSet<SuperType> getSuperType();
@ -171,13 +176,13 @@ public interface MageObject extends MageItem, Serializable {
if (this.isCreature() && otherCard.isCreature()) {
if (this.getAbilities().contains(ChangelingAbility.getInstance())
|| this.getSubtype(game).contains(ChangelingAbility.ALL_CREATURE_TYPE)
|| this.isAllCreatureTypes()
|| otherCard.getAbilities().contains(ChangelingAbility.getInstance())
|| otherCard.getSubtype(game).contains(ChangelingAbility.ALL_CREATURE_TYPE)) {
|| otherCard.isAllCreatureTypes()) {
return true;
}
}
for (String subtype : this.getSubtype(game)) {
for (SubType subtype : this.getSubtype(game)) {
if (otherCard.getSubtype(game).contains(subtype)) {
return true;
}
@ -186,6 +191,10 @@ public interface MageObject extends MageItem, Serializable {
return false;
}
boolean isAllCreatureTypes();
void setIsAllCreatureTypes(boolean value);
default void addCardTypes(EnumSet<CardType> cardType){
getCardType().addAll(cardType);
}