mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Refactor logic for determining when a card can be a commander into CardRules
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user