Skip to content

Add cmcLE in ChooseCardNameEffect and CardFacePredicates #7580

@DanKitzman

Description

@DanKitzman

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.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions