added new helper methods to test for CardType, to get rid of the contains(CardType.XXX) everywhere, put the logic of that in one place and use the interface call

This commit is contained in:
ingmargoudt 2017-03-04 00:16:36 +01:00
parent 6b20d352ca
commit 5a57731968
69 changed files with 151 additions and 120 deletions

View file

@ -82,4 +82,34 @@ public interface MageObject extends MageItem, Serializable {
void setZoneChangeCounter(int value, Game game);
default boolean isCreature(){
return getCardType().contains(CardType.CREATURE);
}
default boolean isArtifact(){
return getCardType().contains(CardType.ARTIFACT);
}
default boolean isLand(){
return getCardType().contains(CardType.LAND);
}
default boolean isEnchantment(){
return getCardType().contains(CardType.ENCHANTMENT);
}
default boolean isInstant(){
return getCardType().contains(CardType.INSTANT);
}
default boolean isSorcery(){
return getCardType().contains(CardType.SORCERY);
}
default boolean isPlaneswalker(){
return getCardType().contains(CardType.PLANESWALKER);
}
}