[Un-cards] DeckLimit keyword + Cardboard Carapace

This commit is contained in:
Adam Pantel
2021-03-06 15:58:01 -05:00
parent 0312e54590
commit acb21b2a28
10 changed files with 43 additions and 14 deletions

View File

@@ -569,4 +569,14 @@ public final class CardRules implements ICardCharacteristics {
public boolean hasKeyword(final String k) {
return Iterables.contains(mainPart.getKeywords(), k);
}
public Integer getKeywordMagnitude(final String k) {
for (final String inst : mainPart.getKeywords()) {
final String[] parts = inst.split(":");
if (parts[0].equals(k) && StringUtils.isNumeric(parts[1])) {
return Integer.valueOf(parts[1]);
}
}
return null;
}
}

View File

@@ -375,13 +375,7 @@ public enum DeckFormat {
public static Integer canHaveSpecificNumberInDeck(final IPaperCard card) {
// Ideally, this would be parsed during card parsing and set this value
if (card.getRules().hasKeyword("A deck can have up to seven cards named CARDNAME.")) {
return 7;
} else if (card.getRules().hasKeyword("Megalegendary")) {
return 1;
}
return null;
return card.getRules().getKeywordMagnitude("DeckLimit");
}
public static String getPlaneSectionConformanceProblem(final CardPool planes) {