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

@ -191,7 +191,7 @@ public class Spell extends StackObjImpl implements Card {
if (controller == null) {
return false;
}
if (this.getCardType().contains(CardType.INSTANT) || this.getCardType().contains(CardType.SORCERY)) {
if (this.isInstant() || this.isSorcery()) {
int index = 0;
result = false;
boolean legalParts = false;
@ -239,7 +239,7 @@ public class Spell extends StackObjImpl implements Card {
}
counter(null, game);
return false;
} else if (this.getCardType().contains(CardType.ENCHANTMENT) && this.getSubtype(game).contains("Aura")) {
} else if (this.isEnchantment() && this.getSubtype(game).contains("Aura")) {
if (ability.getTargets().stillLegal(ability, game)) {
updateOptionalCosts(0);
boolean bestow = ability instanceof BestowAbility;
@ -432,7 +432,7 @@ public class Spell extends StackObjImpl implements Card {
@Override
public String getLogName() {
if (faceDown) {
if (getCardType().contains(CardType.CREATURE)) {
if (this.isCreature()) {
return "face down creature spell";
} else {
return "face down spell";