add TargetsWithDifferentCMC param

This commit is contained in:
Northmoc
2020-09-16 17:06:19 -04:00
parent b9884a6513
commit f829e218ba
3 changed files with 34 additions and 1 deletions

View File

@@ -189,7 +189,7 @@ public final class InputSelectTargets extends InputSyncronizedBase {
}
}
// If all cards must have different controllers
// If all cards must have same controllers
if (tgt.isSameController()) {
final List<Player> targetedControllers = new ArrayList<>();
for (final GameObject o : targetDepth.keySet()) {
@@ -219,6 +219,21 @@ public final class InputSelectTargets extends InputSyncronizedBase {
}
}
// If all cards must have different CMC
if (tgt.isDifferentCMC()) {
final List<Integer> targetedCMCs = new ArrayList<>();
for (final GameObject o : targetDepth.keySet()) {
if (o instanceof Card) {
final Integer cmc = ((Card) o).getCMC();
targetedCMCs.add(cmc);
}
}
if (targetedCMCs.contains(card.getCMC())) {
showMessage(sa.getHostCard() + " - Cannot target this card (must have different CMC)");
return false;
}
}
if (!choices.contains(card)) {
showMessage(sa.getHostCard() + " - The selected card is not a valid choice to be targeted.");
return false;