CardFacePredicates: cmcEQ -> ManaCost

This commit is contained in:
Northmoc
2022-01-09 19:46:59 -05:00
parent a90f04c0fd
commit 28aebca071

View File

@@ -98,16 +98,10 @@ public final class CardFacePredicates {
} }
if (k.length > 1) { if (k.length > 1) {
for (final String m : k[1].split("\\+")) { for (final String m : k[1].split("\\+")) {
if (m.contains("cmc")) { if (m.contains("ManaCost")) {
if (m.startsWith("cmcEQ")) { String manaCost = m.substring(8);
String numS = m.substring(m.length()-1); if (!hasManaCost(input, manaCost)) {
int x = Integer.parseInt(numS); return false;
if (!hasCMC(input, x)) {
return false;
}
} else {
System.err.println("CardFacePredicates needs additional code to support this cmc " +
"calculation");
} }
} else if (!hasProperty(input, m)) { } else if (!hasProperty(input, m)) {
return false; return false;
@@ -124,9 +118,8 @@ public final class CardFacePredicates {
} else return input.getType().hasStringType(v); } else return input.getType().hasStringType(v);
} }
static protected boolean hasCMC(ICardFace input, final int value) { static protected boolean hasManaCost(ICardFace input, final String mC) {
ManaCost cost = input.getManaCost(); return mC.equals(input.getManaCost().getShortString());
return cost != null && cost.getCMC() == value;
} }
} }