- Added Damping Sphere

This commit is contained in:
swordshine
2018-04-06 16:05:08 +08:00
parent 59057e69a3
commit 633a1d644a
2 changed files with 31 additions and 0 deletions

View File

@@ -1,10 +1,14 @@
package forge.game.replacement; package forge.game.replacement;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.card.CardFactoryUtil;
import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbility;
import forge.util.Expressions;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang3.StringUtils;
/** /**
* TODO: Write javadoc for this type. * 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 (this.getMapParams().containsKey("ValidCard")) {
if (!matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidCard").split(","), this.getHostCard())) { if (!matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidCard").split(","), this.getHostCard())) {
return false; return false;

View File

@@ -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.