From 18c48841fc5ed925be98ed7cb946449e6e5be2bc Mon Sep 17 00:00:00 2001 From: Sloth Date: Fri, 8 Feb 2013 20:59:55 +0000 Subject: [PATCH] - Added the script option "UnlessCost$ CardManaCost". - Added Pendrell Flux. --- .gitattributes | 1 + res/cardsfolder/p/pendrell_flux.txt | 14 +++++++++++ .../card/abilityfactory/AbilityFactory.java | 24 +++++++++---------- 3 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 res/cardsfolder/p/pendrell_flux.txt diff --git a/.gitattributes b/.gitattributes index 9579a2d5667..76b7b5588e5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7503,6 +7503,7 @@ res/cardsfolder/p/pemmins_aura.txt svneol=native#text/plain res/cardsfolder/p/pendelhaven.txt svneol=native#text/plain res/cardsfolder/p/pendelhaven_elder.txt svneol=native#text/plain res/cardsfolder/p/pendrell_drake.txt svneol=native#text/plain +res/cardsfolder/p/pendrell_flux.txt -text res/cardsfolder/p/pendrell_mists.txt svneol=native#text/plain res/cardsfolder/p/pennon_blade.txt svneol=native#text/plain res/cardsfolder/p/pentad_prism.txt svneol=native#text/plain diff --git a/res/cardsfolder/p/pendrell_flux.txt b/res/cardsfolder/p/pendrell_flux.txt new file mode 100644 index 00000000000..0192940d634 --- /dev/null +++ b/res/cardsfolder/p/pendrell_flux.txt @@ -0,0 +1,14 @@ +Name:Pendrell Flux +ManaCost:1 U +Types:Enchantment Aura +Text:no text +K:Enchant creature +A:SP$ Attach | Cost$ 1 U | ValidTgts$ Creature | TgtPrompt$ Select target creature | AILogic$ Curse +S:Mode$ Continuous | Affected$ Creature.AttachedBy | AddTrigger$ TrigPhase | AddSVar$ TrigPendrellFlux & DBCoralSacrifice & DBCoralCleanup | Description$ Enchanted creature has "At the beginning of your upkeep, sacrifice this creature unless you pay its mana cost." +SVar:TrigPhase:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Execute$ TrigPendrellFlux | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of your upkeep, sacrifice this creature unless you pay its mana cost. +SVar:TrigPendrellFlux:DB$ Sacrifice | Defined$ Self | UnlessCost$ CardManaCost | UnlessPayer$ You +SVar:Rarity:Common +SVar:Picture:http://www.wizards.com/global/images/magic/general/pendrell_flux.jpg +SetInfo:USG|Common|http://magiccards.info/scans/en/us/87.jpg +Oracle:Enchant creature\nEnchanted creature has "At the beginning of your upkeep, sacrifice this creature unless you pay its mana cost." +End \ No newline at end of file diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactory.java b/src/main/java/forge/card/abilityfactory/AbilityFactory.java index d0dc3260f7f..f6bd0387d5e 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactory.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactory.java @@ -1389,18 +1389,18 @@ public class AbilityFactory { // The cost String unlessCost = sa.getParam("UnlessCost").trim(); - - try { - String unlessVar = Integer.toString(AbilityFactory.calculateAmount(source, sa.getParam("UnlessCost").replace(" ", ""), sa)); - unlessCost = unlessVar; - } catch (final NumberFormatException n) { - } //This try/catch method enables UnlessCost to parse any svar name - //instead of just X for cards like Draco. If there's a better way - //feel free to change it. Old code follows: - - /*if (unlessCost.equals("X")) { - unlessCost = Integer.toString(AbilityFactory.calculateAmount(source, params.get("UnlessCost"), sa)); - }*/ + + if (unlessCost.equals("CardManaCost")) { + unlessCost = source.getManaCost().toString(); + } else { + try { + String unlessVar = Integer.toString(AbilityFactory.calculateAmount(source, sa.getParam("UnlessCost").replace(" ", ""), sa)); + unlessCost = unlessVar; + } catch (final NumberFormatException n) { + } //This try/catch method enables UnlessCost to parse any svar name + //instead of just X for cards like Draco. + } + final Cost cost = new Cost(source, unlessCost, true); final Ability ability = new AbilityStatic(source, cost, null) {