Add cmcLE in ChooseCardNameEffect and CardFacePredicates
- Dominant language
- Java
- Stars
- 2.7k
- Forks
- 1.1k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 163
Description
Currently we have checks for cmc to be equal to something "cncEQ" but nothing for less than or equal.
I've implemented the solution but am not a project contributor. Here is the code:
In ChooseCardNameEffect.java at line 101 add:
`
else if (valid.contains("cmcLE") && !StringUtils.isNumeric(valid.split("cmcLE")[1])) {
String s = valid.split("cmcLE")[1];
valid = valid.replace(s, String.valueOf(AbilityUtils.calculateAmount(host, s, sa)));
}
`
In CardFacePredicates at line 106 add:
`
} else if (m.contains("cmcLE")) {
int i = Integer.parseInt(m.substring(5));
if (!hasCMC_LE(input, i)) return false;
`
And also in CardFacePredicates at line 129 add:
`
static protected boolean hasCMC_LE(ICardFace input, final int value) {
ManaCost cost = input.getManaCost();
return cost != null && cost.getCMC() <= value;
}
`
I've tested the code and it works fine. Since it is an extra feature and not a change to existing logic it fits in nicely with existing code.
Contributor guide
Assessment
This issue has not been assessed yet.