- 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;
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;