From d5326d61c0e1883fa8ae7d0df914502304c7cbb7 Mon Sep 17 00:00:00 2001 From: swordshine Date: Sun, 1 Jun 2014 08:37:09 +0000 Subject: [PATCH] - Added Snowfall --- .gitattributes | 1 + forge-game/src/main/java/forge/game/phase/Upkeep.java | 1 + .../java/forge/game/spellability/AbilityManaPart.java | 8 ++++++++ .../java/forge/game/spellability/SpellAbility.java | 9 +++++++++ forge-gui/res/cardsfolder/s/snowfall.txt | 11 +++++++++++ 5 files changed, 30 insertions(+) create mode 100644 forge-gui/res/cardsfolder/s/snowfall.txt diff --git a/.gitattributes b/.gitattributes index 0db379606c7..a3fdd62401a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12169,6 +12169,7 @@ forge-gui/res/cardsfolder/s/snow_devil.txt svneol=native#text/plain forge-gui/res/cardsfolder/s/snow_fortress.txt svneol=native#text/plain forge-gui/res/cardsfolder/s/snow_hound.txt svneol=native#text/plain forge-gui/res/cardsfolder/s/snowblind.txt -text +forge-gui/res/cardsfolder/s/snowfall.txt -text forge-gui/res/cardsfolder/s/snuff_out.txt svneol=native#text/plain forge-gui/res/cardsfolder/s/soar.txt -text forge-gui/res/cardsfolder/s/soaring_hope.txt svneol=native#text/plain diff --git a/forge-game/src/main/java/forge/game/phase/Upkeep.java b/forge-game/src/main/java/forge/game/phase/Upkeep.java index bb03cc4eaeb..e3a275e414b 100644 --- a/forge-game/src/main/java/forge/game/phase/Upkeep.java +++ b/forge-game/src/main/java/forge/game/phase/Upkeep.java @@ -164,6 +164,7 @@ public class Upkeep extends Phase { c.addCounter(CounterType.AGE, 1, true); String cost = CardFactoryUtil.multiplyCost(k[1], c.getCounters(CounterType.AGE)); final Cost upkeepCost = new Cost(cost, true); + this.setCumulativeupkeep(true); boolean isPaid = controller.getController().payManaOptional(c, upkeepCost, this, sb.toString(), ManaPaymentPurpose.CumulativeUpkeep); final HashMap runParams = new HashMap(); runParams.put("CumulativeUpkeepPaid", (Boolean) isPaid); diff --git a/forge-game/src/main/java/forge/game/spellability/AbilityManaPart.java b/forge-game/src/main/java/forge/game/spellability/AbilityManaPart.java index 2a5fd0f7b0a..8e0aea91a3e 100644 --- a/forge-game/src/main/java/forge/game/spellability/AbilityManaPart.java +++ b/forge-game/src/main/java/forge/game/spellability/AbilityManaPart.java @@ -284,6 +284,14 @@ public class AbilityManaPart implements java.io.Serializable { if (restriction.equals("nonSpell")) { return !sa.isSpell(); } + + if (restriction.equals("CumulativeUpkeep")) { + if (sa.isCumulativeupkeep()) { + return true; + } else { + continue; + } + } if (restriction.startsWith("CostContainsX")) { if (sa.isXCost()) { diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbility.java b/forge-game/src/main/java/forge/game/spellability/SpellAbility.java index 048e6d21e30..37299bde9a1 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbility.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbility.java @@ -90,6 +90,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit private boolean delve = false; private boolean offering = false; private boolean morphup = false; + private boolean cumulativeupkeep = false; private int totalManaSpent = 0; /** The pay costs. */ @@ -1728,6 +1729,14 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit this.madness = madness; } + public boolean isCumulativeupkeep() { + return cumulativeupkeep; + } + + public void setCumulativeupkeep(boolean cumulativeupkeep) { + this.cumulativeupkeep = cumulativeupkeep; + } + // Return whether this spell tracks what color mana is spent to cast it for the sake of the effect public boolean tracksManaSpent() { if (this.hostCard == null || this.hostCard.getRules() == null) { return false; } diff --git a/forge-gui/res/cardsfolder/s/snowfall.txt b/forge-gui/res/cardsfolder/s/snowfall.txt new file mode 100644 index 00000000000..ce86999d46a --- /dev/null +++ b/forge-gui/res/cardsfolder/s/snowfall.txt @@ -0,0 +1,11 @@ +Name:Snowfall +ManaCost:2 U +Types:Enchantment +K:Cumulative upkeep:U +T:Mode$ TapsForMana | ValidCard$ Island | Execute$ TrigMana | Static$ True | OptionalDecider$ TriggeredCardController | TriggerDescription$ Whenever an Island is tapped for mana, its controller may add {U} to his or her mana pool. If that Island is snow, its controller may add {U}{U} to his or her mana pool instead. Spend this mana only to pay cumulative upkeep costs. (in addition to the mana the land produces) +SVar:TrigMana:DB$ Mana | Produced$ U | Amount$ 1 | Defined$ TriggeredCardController | RestrictValid$ CumulativeUpkeep | ConditionDefined$ TriggeredCard | ConditionPresent$ Land.Snow | ConditionCompare$ EQ0 | SubAbility$ DBMana +SVar:DBMana:DB$ Mana | Produced$ U | Amount$ 2 | Defined$ TriggeredCardController | RestrictValid$ CumulativeUpkeep | ConditionDefined$ TriggeredCard | ConditionPresent$ Land.Snow | ConditionCompare$ GE1 +SVar:RemRandomDeck:True +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/snowfall.jpg +Oracle:Cumulative upkeep {U} (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.)\nWhenever an Island is tapped for mana, its controller may add {U} to his or her mana pool. If that Island is snow, its controller may add {U}{U} to his or her mana pool instead. Spend this mana only to pay cumulative upkeep costs. (in addition to the mana the land produces)