diff --git a/Mage.Sets/src/mage/cards/f/FlameOfAnor.java b/Mage.Sets/src/mage/cards/f/FlameOfAnor.java index c285bf91067..19fc14d2f12 100644 --- a/Mage.Sets/src/mage/cards/f/FlameOfAnor.java +++ b/Mage.Sets/src/mage/cards/f/FlameOfAnor.java @@ -33,6 +33,7 @@ public final class FlameOfAnor extends CardImpl { // Choose one. If you control a Wizard as you cast this spell, you may choose two instead. this.getSpellAbility().getModes().setMoreCondition(condition); + this.getSpellAbility().getModes().setMoreLimit(2); this.getSpellAbility().getModes().setChooseText( "Choose one. If you control a Wizard as you cast this spell, you may choose two instead." ); diff --git a/Mage/src/main/java/mage/abilities/Modes.java b/Mage/src/main/java/mage/abilities/Modes.java index 6fb4f30d168..bff1f93530a 100644 --- a/Mage/src/main/java/mage/abilities/Modes.java +++ b/Mage/src/main/java/mage/abilities/Modes.java @@ -38,6 +38,7 @@ public class Modes extends LinkedHashMap implements Copyable private int maxPawPrints; private Filter maxModesFilter; // calculates the max number of available modes private Condition moreCondition; // allows multiple modes choose (example: choose one... if condition, you may choose both) + private int moreLimit = Integer.MAX_VALUE; // if multiple modes are allowed, this limits how many additional modes may be chosen (usually doesn't need to change) private boolean limitUsageByOnce = false; // limit mode selection to once per game private boolean limitUsageResetOnNewTurn = false; // reset once per game limit on new turn, example: Galadriel, Light of Valinor @@ -73,6 +74,7 @@ public class Modes extends LinkedHashMap implements Copyable this.maxPawPrints = modes.maxPawPrints; this.maxModesFilter = modes.maxModesFilter; // can't change so no copy needed this.moreCondition = modes.moreCondition; + this.moreLimit = modes.moreLimit; this.limitUsageByOnce = modes.limitUsageByOnce; this.limitUsageResetOnNewTurn = modes.limitUsageResetOnNewTurn; @@ -197,7 +199,7 @@ public class Modes extends LinkedHashMap implements Copyable return count; } - public int getSelectedPawPrints(){ + public int getSelectedPawPrints() { return this.selectedModes.stream() .mapToInt(modeID -> get(modeID).getPawPrintValue()) .sum(); @@ -241,9 +243,9 @@ public class Modes extends LinkedHashMap implements Copyable return realMaxModes; } - // use case: make two modes chooseable (all cards that use this currently go from one to two) + // use case: make more modes chooseable if (moreCondition != null && moreCondition.apply(game, source)) { - realMaxModes = 2; + realMaxModes = this.moreLimit; } // use case: limit max modes by opponents (example: choose one or more... each mode must target a different player) @@ -292,10 +294,10 @@ public class Modes extends LinkedHashMap implements Copyable } public void addMode(Mode mode) { - if (this.maxPawPrints > 0 && mode.getPawPrintValue() == 0){ + if (this.maxPawPrints > 0 && mode.getPawPrintValue() == 0) { throw new IllegalArgumentException("Mode must have nonzero pawprints value in a pawprints mode set."); } - if (this.maxPawPrints == 0 && mode.getPawPrintValue() > 0){ + if (this.maxPawPrints == 0 && mode.getPawPrintValue() > 0) { throw new IllegalArgumentException("Cannot add pawprints mode to non-pawprints mode set."); } this.put(mode.getId(), mode); @@ -305,6 +307,10 @@ public class Modes extends LinkedHashMap implements Copyable this.moreCondition = moreCondition; } + public void setMoreLimit(int moreLimit) { + this.moreLimit = moreLimit; + } + private boolean isAlreadySelectedModesOutdated(Game game, Ability source) { return this.isLimitUsageResetOnNewTurn() && getOnceTurnNum(game, source) != game.getTurnNum(); @@ -552,7 +558,7 @@ public class Modes extends LinkedHashMap implements Copyable if (isLimitUsageByOnce() && nonAvailableModes.contains(mode.getId())) { continue; } - if (getMaxPawPrints() > 0 && getSelectedPawPrints() + mode.getPawPrintValue() > getMaxPawPrints()){ + if (getMaxPawPrints() > 0 && getSelectedPawPrints() + mode.getPawPrintValue() > getMaxPawPrints()) { continue; } availableModes.add(mode); @@ -574,7 +580,7 @@ public class Modes extends LinkedHashMap implements Copyable } sb.append("choose "); } - if (this.getMaxPawPrints() > 0){ + if (this.getMaxPawPrints() > 0) { sb.append("up to ").append(CardUtil.numberToText(this.getMaxPawPrints())).append(" {P} worth of modes"); } else if (this.getMinModes() == 0 && this.getMaxModes(null, null) == 1) { sb.append("up to one"); @@ -620,7 +626,7 @@ public class Modes extends LinkedHashMap implements Copyable sb.append(mode.getCost().getText()); sb.append(" — "); } else if (mode.getPawPrintValue() > 0) { - for (int i = 0; i < mode.getPawPrintValue(); ++i){ + for (int i = 0; i < mode.getPawPrintValue(); ++i) { sb.append("{P}"); } sb.append(" — ");