mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
add TargetsWithDifferentCMC param
This commit is contained in:
@@ -347,6 +347,9 @@ public final class AbilityFactory {
|
||||
if (mapParams.containsKey("TargetsWithDifferentControllers")) {
|
||||
abTgt.setDifferentControllers(true);
|
||||
}
|
||||
if (mapParams.containsKey("TargetsWithDifferentCMC")) {
|
||||
abTgt.setDifferentCMC(true);
|
||||
}
|
||||
if (mapParams.containsKey("DividedAsYouChoose")) {
|
||||
abTgt.calculateStillToDivide(mapParams.get("DividedAsYouChoose"), null, null);
|
||||
abTgt.setDividedAsYouChoose(true);
|
||||
|
||||
@@ -62,6 +62,7 @@ public class TargetRestrictions {
|
||||
private boolean uniqueTargets = false;
|
||||
private boolean singleZone = false;
|
||||
private boolean differentControllers = false;
|
||||
private boolean differentCMC = false;
|
||||
private boolean sameController = false;
|
||||
private boolean withoutSameCreatureType = false;
|
||||
private boolean withSameCreatureType = false;
|
||||
@@ -105,6 +106,7 @@ public class TargetRestrictions {
|
||||
this.uniqueTargets = target.isUniqueTargets();
|
||||
this.singleZone = target.isSingleZone();
|
||||
this.differentControllers = target.isDifferentControllers();
|
||||
this.differentCMC = target.isDifferentCMC();
|
||||
this.sameController = target.isSameController();
|
||||
this.withoutSameCreatureType = target.isWithoutSameCreatureType();
|
||||
this.withSameCreatureType = target.isWithSameCreatureType();
|
||||
@@ -675,6 +677,19 @@ public class TargetRestrictions {
|
||||
this.randomTarget = random;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the differentCMC
|
||||
*/
|
||||
public boolean isDifferentCMC() {
|
||||
return differentCMC;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param different the differentCMC to set
|
||||
*/
|
||||
public void setDifferentCMC(boolean different) {
|
||||
this.differentCMC = different;
|
||||
}
|
||||
/**
|
||||
* @return the differentControllers
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user