Refactor logic for determining when a card can be a commander into CardRules

This commit is contained in:
drdev
2015-12-08 02:14:36 +00:00
parent d7d6fbc222
commit 64bc5e0484
3 changed files with 13 additions and 8 deletions

View File

@@ -187,6 +187,14 @@ public final class CardRules implements ICardCharacteristics {
}
}
public boolean canBeCommander() {
CardType type = mainPart.getType();
if (type.isLegendary() && type.isCreature()) {
return true;
}
return mainPart.getOracleText().contains("can be your commander");
}
// public Set<String> getSets() { return this.setsPrinted.keySet(); }
// public CardInSet getEditionInfo(final String setCode) {
// final CardInSet result = this.setsPrinted.get(setCode);

View File

@@ -328,10 +328,7 @@ public enum DeckFormat {
if (cardPoolFilter != null && !cardPoolFilter.apply(rules)) {
return false;
}
if (rules.getType().isLegendary() && rules.getType().isCreature()) {
return true;
}
return rules.getOracleText().contains("can be your commander");
return rules.canBeCommander();
}
public Predicate<Deck> isLegalDeckPredicate() {