diff --git a/forge-game/src/main/java/forge/game/replacement/ReplaceProduceMana.java b/forge-game/src/main/java/forge/game/replacement/ReplaceProduceMana.java index b914ae53b1b..90abfa87fd6 100644 --- a/forge-game/src/main/java/forge/game/replacement/ReplaceProduceMana.java +++ b/forge-game/src/main/java/forge/game/replacement/ReplaceProduceMana.java @@ -1,10 +1,14 @@ package forge.game.replacement; import forge.game.card.Card; +import forge.game.card.CardFactoryUtil; import forge.game.spellability.SpellAbility; +import forge.util.Expressions; import java.util.Map; +import org.apache.commons.lang3.StringUtils; + /** * TODO: Write javadoc for this type. * @@ -37,6 +41,22 @@ public class ReplaceProduceMana extends ReplacementEffect { } } + if (hasParam("ManaAmount")) { + String full = getParam("ManaAmount"); + String operator = full.substring(0, 2); + String operand = full.substring(2); + int intoperand = 0; + try { + intoperand = Integer.parseInt(operand); + } catch (NumberFormatException e) { + intoperand = CardFactoryUtil.xCount(getHostCard(), getHostCard().getSVar(operand)); + } + int manaAmount = StringUtils.countMatches((String) runParams.get("Mana"), " ") + 1; + if (!Expressions.compare(manaAmount, operator, intoperand)) { + return false; + } + } + if (this.getMapParams().containsKey("ValidCard")) { if (!matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidCard").split(","), this.getHostCard())) { return false; diff --git a/forge-gui/res/cardsfolder/upcoming/damping_sphere.txt b/forge-gui/res/cardsfolder/upcoming/damping_sphere.txt new file mode 100644 index 00000000000..d3ccff78259 --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/damping_sphere.txt @@ -0,0 +1,11 @@ +Name:Damping Sphere +ManaCost:2 +Types:Artifact +R:Event$ ProduceMana | ActiveZones$ Battlefield | ValidCard$ Land | ManaAmount$ GE2 | ManaReplacement$ ProduceC | Description$ If a land is tapped for mana, it produces {C} instead of any other type and amount. +SVar:ProduceC:Any->C +S:Mode$ RaiseCost | Activator$ Player | Type$ Spell | Amount$ X | AffectedAmount$ True | Description$ Each spell a player casts costs {1} more to cast for each other spell that player has cast this turn. +SVar:X:Count$ThisTurnCast_Card.YouCtrl +SVar:RemAIDeck:True +SVar:NonStackingEffect:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/damping_sphere.jpg +Oracle:If a land is tapped for two or more mana, it produces {C} instead of any other type and amount.\nEach spell a player casts costs {1} more to cast for each other spell that player has cast this turn.