diff --git a/.gitattributes b/.gitattributes index 68ada3ff5e9..082f4e43c12 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5004,6 +5004,7 @@ res/cardsfolder/h/hex_parasite.txt -text res/cardsfolder/h/hexplate_golem.txt svneol=native#text/plain res/cardsfolder/h/hibernation.txt svneol=native#text/plain res/cardsfolder/h/hibernation_sliver.txt svneol=native#text/plain +res/cardsfolder/h/hibernations_end.txt -text res/cardsfolder/h/hickory_woodlot.txt svneol=native#text/plain res/cardsfolder/h/hidden_ancients.txt svneol=native#text/plain res/cardsfolder/h/hidden_gibbons.txt svneol=native#text/plain @@ -11193,6 +11194,7 @@ res/cardsfolder/t/thelon_of_havenwood.txt -text res/cardsfolder/t/thelonite_druid.txt -text res/cardsfolder/t/thelonite_hermit.txt svneol=native#text/plain res/cardsfolder/t/thelonite_monk.txt svneol=native#text/plain +res/cardsfolder/t/thelons_chant.txt -text res/cardsfolder/t/thermal_blast.txt svneol=native#text/plain res/cardsfolder/t/thermal_flux.txt -text res/cardsfolder/t/thermal_glider.txt svneol=native#text/plain @@ -11470,6 +11472,7 @@ res/cardsfolder/t/touch_of_invisibility.txt svneol=native#text/plain res/cardsfolder/t/touch_of_the_eternal.txt -text res/cardsfolder/t/touch_of_vitae.txt -text svneol=unset#text/plain res/cardsfolder/t/touchstone.txt svneol=native#text/plain +res/cardsfolder/t/tourachs_chant.txt -text res/cardsfolder/t/tourachs_gate.txt -text res/cardsfolder/t/tower_above.txt -text res/cardsfolder/t/tower_defense.txt -text @@ -14322,6 +14325,7 @@ src/main/java/forge/card/trigger/TriggerLifeGained.java svneol=native#text/plain src/main/java/forge/card/trigger/TriggerLifeLost.java svneol=native#text/plain src/main/java/forge/card/trigger/TriggerLosesGame.java -text src/main/java/forge/card/trigger/TriggerNewGame.java -text +src/main/java/forge/card/trigger/TriggerPayCumulativeUpkeep.java -text src/main/java/forge/card/trigger/TriggerPhase.java svneol=native#text/plain src/main/java/forge/card/trigger/TriggerPlanarDice.java -text src/main/java/forge/card/trigger/TriggerPlaneswalkedFrom.java -text diff --git a/res/cardsfolder/h/hibernations_end.txt b/res/cardsfolder/h/hibernations_end.txt new file mode 100644 index 00000000000..e8f0ed7b914 --- /dev/null +++ b/res/cardsfolder/h/hibernations_end.txt @@ -0,0 +1,9 @@ +Name:Hibernation's End +ManaCost:4 G +Types:Enchantment +K:Cumulative upkeep:1 +T:Mode$ PayCumulativeUpkeep | ValidCard$ Card.Self | Paid$ True | Execute$ TrigSearch | OptionalDecider$ You | TriggerDescription$ Whenever you pay CARDNAME's cumulative upkeep, you may search your library for a creature card with converted mana cost equal to the number of age counters on CARDNAME and put it onto the battlefield. If you do, shuffle your library. +SVar:TrigSearch:AB$ ChangeZone | Cost$ 0 | ChangeType$ Creature.cmcEQX | References$ X | ChangeNum$ 1 | Origin$ Library | Destination$ Battlefield +SVar:X:Count$CardCounters.AGE +SVar:Picture:http://www.wizards.com/global/images/magic/general/hibernations_end.jpg +Oracle:Cumulative upkeep {1} (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 you pay Hibernation's End's cumulative upkeep, you may search your library for a creature card with converted mana cost equal to the number of age counters on Hibernation's End and put it onto the battlefield. If you do, shuffle your library. diff --git a/res/cardsfolder/t/thelons_chant.txt b/res/cardsfolder/t/thelons_chant.txt new file mode 100644 index 00000000000..81e8f37ad40 --- /dev/null +++ b/res/cardsfolder/t/thelons_chant.txt @@ -0,0 +1,8 @@ +Name:Thelon's Chant +ManaCost:1 G G +Types:Enchantment +K:At the beginning of your upkeep, sacrifice CARDNAME unless you pay G +T:Mode$ ChangesZone | ValidCard$ Swamp | Origin$ Any | Destination$ Battlefield | TriggerZones$ Battlefield | Execute$ TrigDmg | TriggerDescription$ Whenever a player puts a Swamp onto the battlefield, CARDNAME deals 3 damage to that player unless he or she puts a -1/-1 counter on a creature he or she controls. +SVar:TrigDmg:AB$ DealDamage | Cost$ 0 | Defined$ TriggeredCardController | NumDmg$ 3 | UnlessCost$ AddCounter<1/M1M1/Creature.YouCtrl/a creature you control> | UnlessPayer$ TriggeredCardController +SVar:Picture:http://www.wizards.com/global/images/magic/general/thelons_chant.jpg +Oracle:At the beginning of your upkeep, sacrifice Thelon's Chant unless you pay {G}.\nWhenever a player puts a Swamp onto the battlefield, Thelon's Chant deals 3 damage to that player unless he or she puts a -1/-1 counter on a creature he or she controls. diff --git a/res/cardsfolder/t/tourachs_chant.txt b/res/cardsfolder/t/tourachs_chant.txt new file mode 100644 index 00000000000..75f4813ead9 --- /dev/null +++ b/res/cardsfolder/t/tourachs_chant.txt @@ -0,0 +1,8 @@ +Name:Tourach's Chant +ManaCost:1 B B +Types:Enchantment +K:At the beginning of your upkeep, sacrifice CARDNAME unless you pay B +T:Mode$ ChangesZone | ValidCard$ Forest | Origin$ Any | Destination$ Battlefield | TriggerZones$ Battlefield | Execute$ TrigDmg | TriggerDescription$ Whenever a player puts a Forest onto the battlefield, CARDNAME deals 3 damage to that player unless he or she puts a -1/-1 counter on a creature he or she controls.. +SVar:TrigDmg:AB$ DealDamage | Cost$ 0 | Defined$ TriggeredCardController | NumDmg$ 3 | UnlessCost$ AddCounter<1/M1M1/Creature.YouCtrl/a creature you control> | UnlessPayer$ TriggeredCardController +SVar:Picture:http://www.wizards.com/global/images/magic/general/tourachs_chant.jpg +Oracle:At the beginning of your upkeep, sacrifice Tourach's Chant unless you pay {B}.\nWhenever a player puts a Forest onto the battlefield, Tourach's Chant deals 3 damage to that player unless he or she puts a -1/-1 counter on a creature he or she controls. diff --git a/src/main/java/forge/card/trigger/TriggerPayCumulativeUpkeep.java b/src/main/java/forge/card/trigger/TriggerPayCumulativeUpkeep.java new file mode 100644 index 00000000000..f0ce47943c5 --- /dev/null +++ b/src/main/java/forge/card/trigger/TriggerPayCumulativeUpkeep.java @@ -0,0 +1,73 @@ +/* + * Forge: Play Magic: the Gathering. + * Copyright (C) 2011 Forge Team + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package forge.card.trigger; + +import forge.Card; +import forge.card.spellability.SpellAbility; + +/** + *

+ * Trigger_LifeGained class. + *

+ * + * @author Forge + * @version $Id: TriggerLifeGained.java 17802 2012-10-31 08:05:14Z Max mtg $ + */ +public class TriggerPayCumulativeUpkeep extends Trigger { + + /** + *

+ * Constructor for Trigger_LifeGained. + *

+ * + * @param params + * a {@link java.util.HashMap} object. + * @param host + * a {@link forge.Card} object. + * @param intrinsic + * the intrinsic + */ + public TriggerPayCumulativeUpkeep(final java.util.Map params, final Card host, final boolean intrinsic) { + super(params, host, intrinsic); + } + + /** {@inheritDoc} */ + @Override + public final boolean performTest(final java.util.Map runParams2) { + if (this.mapParams.containsKey("Paid")) { + Boolean paid = (Boolean) runParams2.get("CumulativeUpkeepPaid"); + if (this.mapParams.get("Paid").equals("True") ^ paid) { + return false; + } + } + final Card card = (Card) runParams2.get("Card"); + if (this.mapParams.containsKey("ValidCard")) { + if (!card.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(), + this.getHostCard())) { + return false; + } + } + return true; + } + + + /** {@inheritDoc} */ + @Override + public final void setTriggeringObjects(final SpellAbility sa) { + } +} diff --git a/src/main/java/forge/card/trigger/TriggerType.java b/src/main/java/forge/card/trigger/TriggerType.java index 1bf19ef6146..78cf9cd4854 100644 --- a/src/main/java/forge/card/trigger/TriggerType.java +++ b/src/main/java/forge/card/trigger/TriggerType.java @@ -20,6 +20,7 @@ public enum TriggerType { ChangesZone(TriggerChangesZone.class), Clashed(TriggerClashed.class), + PayCumulativeUpkeep(TriggerPayCumulativeUpkeep.class), Flipped(TriggerFlipped.class), Attached(TriggerAttached.class), Destroyed(TriggerDestroyed.class), diff --git a/src/main/java/forge/game/phase/Upkeep.java b/src/main/java/forge/game/phase/Upkeep.java index ffa37a5c570..a72f3650d8f 100644 --- a/src/main/java/forge/game/phase/Upkeep.java +++ b/src/main/java/forge/game/phase/Upkeep.java @@ -37,6 +37,7 @@ import forge.card.spellability.Ability; import forge.card.spellability.AbilityManaPart; import forge.card.spellability.AbilityStatic; import forge.card.spellability.SpellAbility; +import forge.card.trigger.TriggerType; import forge.game.Game; import forge.game.ai.ComputerUtil; import forge.game.ai.ComputerUtilCard; @@ -270,7 +271,10 @@ public class Upkeep extends Phase { @Override public void resolve() { boolean isPaid = controller.getController().payManaOptional(c, upkeepCost, "Cumulative upkeep for " + c, ManaPaymentPurpose.CumulativeUpkeep); - + final HashMap runParams = new HashMap(); + runParams.put("CumulativeUpkeepPaid", (Boolean) isPaid); + runParams.put("Card", this.getSourceCard()); + game.getTriggerHandler().runTrigger(TriggerType.PayCumulativeUpkeep, runParams, false); if(!isPaid) game.getAction().sacrifice(c, null); }