diff --git a/res/cardsfolder/b/burning_vengeance.txt b/res/cardsfolder/b/burning_vengeance.txt index 7fe0432ac9a..b2263d592ca 100644 --- a/res/cardsfolder/b/burning_vengeance.txt +++ b/res/cardsfolder/b/burning_vengeance.txt @@ -2,7 +2,8 @@ Name:Burning Vengeance ManaCost:2 R Types:Enchantment Text:no text -T:Mode$ ChangesZone | ValidCard$ Card.YouOwn | Origin$ Graveyard | Destination$ Stack | Execute$ TrigDamage | TriggerZones$ Battlefield | TriggerDescription$ Whenever you cast a spell from your graveyard, CARDNAME deals 2 damage to target creature or player. +T:Mode$ SpellCast | ValidCard$ Card.YouOwn+wasCastFromGraveyard | Execute$ TrigDamage | TriggerZones$ Battlefield | TriggerDescription$ Whenever you cast a spell from your graveyard, CARDNAME deals 2 damage to target creature or player. +#T:Mode$ ChangesZone | ValidCard$ Card.YouOwn | Origin$ Graveyard | Destination$ Stack | Execute$ TrigDamage | TriggerZones$ Battlefield | TriggerDescription$ Whenever you cast a spell from your graveyard, CARDNAME deals 2 damage to target creature or player. SVar:TrigDamage:AB$ DealDamage | Cost$ 0| Tgt$ TgtCP | NumDmg$ 2 SVar:RemRandomDeck:True SVar:Rarity:Uncommon diff --git a/res/cardsfolder/c/coal_stoker.txt b/res/cardsfolder/c/coal_stoker.txt index b1a39120089..578eba886f2 100644 --- a/res/cardsfolder/c/coal_stoker.txt +++ b/res/cardsfolder/c/coal_stoker.txt @@ -3,8 +3,7 @@ ManaCost:3 R Types:Creature Elemental Text:no text PT:3/3 -T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Hand | Destination$ Stack | Static$ True | DelayedTrigger$ CastFromHand | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, add R R R to your mana pool. -SVar:CastFromHand:Mode$ ChangesZone | Origin$ Stack | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigMana | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, add R R R to your mana pool. +T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.wasCastFromHand+Self | Execute$ TrigMana | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, add R R R to your mana pool. SVar:TrigMana:AB$Mana | Cost$ 0 | Produced$ R | Amount$ 3 SVar:Rarity:Common SVar:Picture:http://www.wizards.com/global/images/magic/general/coal_stoker.jpg diff --git a/res/cardsfolder/d/dread_cacodemon.txt b/res/cardsfolder/d/dread_cacodemon.txt index 6a9a19c45f7..f0a2e12e2db 100644 --- a/res/cardsfolder/d/dread_cacodemon.txt +++ b/res/cardsfolder/d/dread_cacodemon.txt @@ -3,8 +3,7 @@ ManaCost:7 B B B Types:Creature Demon Text:no text PT:8/8 -T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Hand | Destination$ Stack | Static$ True | DelayedTrigger$ CastFromHand | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, destroy all creatures your opponents control, then tap all other creatures you control. -SVar:CastFromHand:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Stack | Destination$ Battlefield | Execute$ TrigDestroy | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, destroy all creatures your opponents control, then tap all other creatures you control. +T:Mode$ ChangesZone | ValidCard$ Card.wasCastFromHand+Self | Destination$ Battlefield | Execute$ TrigDestroy | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, destroy all creatures your opponents control, then tap all other creatures you control. SVar:TrigDestroy:AB$ DestroyAll | Cost$ 0 | ValidCards$ Creature.YouDontCtrl | SubAbility$ DBTapAll SVar:DBTapAll:DB$TapAll | ValidCards$ Creature.YouCtrl+Other SVar:RemAIDeck:True diff --git a/res/cardsfolder/f/furnace_dragon.txt b/res/cardsfolder/f/furnace_dragon.txt index 791138e8df9..bf82424d9af 100644 --- a/res/cardsfolder/f/furnace_dragon.txt +++ b/res/cardsfolder/f/furnace_dragon.txt @@ -5,8 +5,7 @@ Text:Affinity for artifacts (This spell costs 1 less to cast for each artifact y PT:5/5 K:Flying K:CostChange:Player:Less:1:Self:All:All:Affinity/Artifact -T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Hand | Destination$ Stack | Static$ True | DelayedTrigger$ CastFromHand -SVar:CastFromHand:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Stack | Destination$ Battlefield | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, exile all artifacts. +T:Mode$ ChangesZone | ValidCard$ Card.wasCastFromHand+Self | Destination$ Battlefield | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, exile all artifacts. SVar:TrigExile:AB$ChangeZoneAll | Cost$ 0 | ChangeType$ Artifact | Origin$ Battlefield | Destination$ Exile SVar:Rarity:Rare SVar:Picture:http://www.wizards.com/global/images/magic/general/furnace_dragon.jpg diff --git a/res/cardsfolder/h/hypnox.txt b/res/cardsfolder/h/hypnox.txt index 1eda7265e73..0b6b18ac2c2 100644 --- a/res/cardsfolder/h/hypnox.txt +++ b/res/cardsfolder/h/hypnox.txt @@ -4,8 +4,7 @@ Types:Creature Nightmare Horror Text:no text PT:8/8 K:Flying -T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Hand | Destination$ Stack | Static$ True | DelayedTrigger$ CastFromHand | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, exile all cards from target opponent's hand. -SVar:CastFromHand:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Stack | Destination$ Battlefield | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, exile all cards from target opponent's hand. +T:Mode$ ChangesZone | ValidCard$ Card.wasCastFromHand+Self | Destination$ Battlefield | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, exile all cards from target opponent's hand. SVar:TrigExile:AB$ChangeZoneAll | Cost$ 0 | ValidTgts$ Opponent | ChangeType$ Card.YouDontCtrl | Origin$ Hand | Destination$ Exile | RememberChanged$ True T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Any | Execute$ TrigReturn | TriggerDescription$ When CARDNAME leaves the battlefield, return the exiled cards to their owner's hand. SVar:TrigReturn:AB$ChangeZone | Cost$ 0 | Defined$ Remembered | Origin$ Exile | Destination$ Hand | SubAbility$ DBCleanup diff --git a/res/cardsfolder/i/iname_as_one.txt b/res/cardsfolder/i/iname_as_one.txt index 1fdc71f9fce..caf96f70a08 100644 --- a/res/cardsfolder/i/iname_as_one.txt +++ b/res/cardsfolder/i/iname_as_one.txt @@ -3,8 +3,7 @@ ManaCost:8 B B G G Types:Legendary Creature Spirit Text:no text PT:8/8 -T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Hand | Destination$ Stack | Static$ True | DelayedTrigger$ CastFromHand -SVar:CastFromHand:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Stack | Destination$ Battlefield | Execute$ TrigSearch | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, you may search your library for a Spirit permanent card, put it onto the battlefield, then shuffle your library. +T:Mode$ ChangesZone | ValidCard$ Card.wasCastFromHand+Self | Destination$ Battlefield | Execute$ TrigSearch | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, you may search your library for a Spirit permanent card, put it onto the battlefield, then shuffle your library. SVar:TrigSearch:AB$ChangeZone | Cost$ 0 | Origin$ Library | Destination$ Battlefield | ChangeType$ Spirit.YouCtrl | ChangeNum$ 1 T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Graveyard | Execute$ TrigExile | OptionalDecider$ You | TriggerDescription$ When CARDNAME dies, you may exile it. If you do, return target Spirit permanent card from your graveyard to the battlefield. SVar:TrigExile:AB$ChangeZone | Cost$ 0 | Origin$ Graveyard | Destination$ Exile | ValidCard$ Card.Self | SubAbility$ DBReturn diff --git a/res/cardsfolder/m/myojin_of_cleansing_fire.txt b/res/cardsfolder/m/myojin_of_cleansing_fire.txt index 8e3c92f661f..52296d14848 100644 --- a/res/cardsfolder/m/myojin_of_cleansing_fire.txt +++ b/res/cardsfolder/m/myojin_of_cleansing_fire.txt @@ -3,8 +3,7 @@ ManaCost:5 W W W Types:Legendary Creature Spirit Text:no text PT:4/6 -T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Hand | Destination$ Stack | Static$ True | DelayedTrigger$ CastFromHand | TriggerDescription$ CARDNAME enters the battlefield with a divinity counter on it if you cast it from your hand. -SVar:CastFromHand:Mode$ ChangesZone | Origin$ Stack | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ETBCounter | Static$ True +T:Mode$ ChangesZone | ValidCard$ Card.wasCastFromHand+Self | Destination$ Battlefield | Static$ True | Execute$ ETBCounter | TriggerDescription$ CARDNAME enters the battlefield with a divinity counter on it if you cast it from your hand. SVar:ETBCounter:AB$PutCounter | Cost$ 0 | Defined$ Self | CounterType$ DIVINITY | CounterNum$ 1 S:Mode$ Continuous | Affected$ Card.Self+counters_GE1_DIVINITY | AddKeyword$ Indestructible | Description$ CARDNAME is indestructible as long as it has a divinity counter on it. A:AB$DestroyAll | Cost$ SubCounter<1/DIVINITY> | ValidCards$ Creature.Other | SpellDescription$ Destroy all other creatures. diff --git a/res/cardsfolder/m/myojin_of_infinite_rage.txt b/res/cardsfolder/m/myojin_of_infinite_rage.txt index a8c5abc51fb..9c8b940ceee 100644 --- a/res/cardsfolder/m/myojin_of_infinite_rage.txt +++ b/res/cardsfolder/m/myojin_of_infinite_rage.txt @@ -3,8 +3,7 @@ ManaCost:7 R R R Types:Legendary Creature Spirit Text:no text PT:7/4 -T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Hand | Destination$ Stack | Static$ True | DelayedTrigger$ CastFromHand | TriggerDescription$ CARDNAME enters the battlefield with a divinity counter on it if you cast it from your hand. -SVar:CastFromHand:Mode$ ChangesZone | Origin$ Stack | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ETBCounter | Static$ True +T:Mode$ ChangesZone | ValidCard$ Card.wasCastFromHand+Self | Destination$ Battlefield | Static$ True | Execute$ ETBCounter | TriggerDescription$ CARDNAME enters the battlefield with a divinity counter on it if you cast it from your hand. SVar:ETBCounter:AB$PutCounter | Cost$ 0 | Defined$ Self | CounterType$ DIVINITY | CounterNum$ 1 S:Mode$ Continuous | Affected$ Card.Self+counters_GE1_DIVINITY | AddKeyword$ Indestructible | Description$ CARDNAME is indestructible as long as it has a divinity counter on it. A:AB$DestroyAll | Cost$ SubCounter<1/DIVINITY> | ValidCards$ Land | SpellDescription$ Destroy all lands. diff --git a/res/cardsfolder/m/myojin_of_lifes_web.txt b/res/cardsfolder/m/myojin_of_lifes_web.txt index 47122ee1daa..fa2f2848f3a 100644 --- a/res/cardsfolder/m/myojin_of_lifes_web.txt +++ b/res/cardsfolder/m/myojin_of_lifes_web.txt @@ -3,8 +3,7 @@ ManaCost:6 G G G Types:Legendary Creature Spirit Text:no text PT:8/8 -T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Hand | Destination$ Stack | Static$ True | DelayedTrigger$ CastFromHand | TriggerDescription$ CARDNAME enters the battlefield with a divinity counter on it if you cast it from your hand. -SVar:CastFromHand:Mode$ ChangesZone | Origin$ Stack | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ETBCounter | Static$ True +T:Mode$ ChangesZone | ValidCard$ Card.wasCastFromHand+Self | Destination$ Battlefield | Static$ True | Execute$ ETBCounter | TriggerDescription$ CARDNAME enters the battlefield with a divinity counter on it if you cast it from your hand. SVar:ETBCounter:AB$PutCounter | Cost$ 0 | Defined$ Self | CounterType$ DIVINITY | CounterNum$ 1 S:Mode$ Continuous | Affected$ Card.Self+counters_GE1_DIVINITY | AddKeyword$ Indestructible | Description$ CARDNAME is indestructible as long as it has a divinity counter on it. A:AB$ ChangeZone | Cost$ SubCounter<1/DIVINITY> | Origin$ Hand | Destination$ Battlefield | ChangeType$ Creature | ChangeNum$ X | SpellDescription$ Put any number of creature cards from your hand onto the battlefield. diff --git a/res/cardsfolder/m/myojin_of_nights_reach.txt b/res/cardsfolder/m/myojin_of_nights_reach.txt index 88050b2faa4..b231b65eeac 100644 --- a/res/cardsfolder/m/myojin_of_nights_reach.txt +++ b/res/cardsfolder/m/myojin_of_nights_reach.txt @@ -3,8 +3,7 @@ ManaCost:5 B B B Types:Legendary Creature Spirit Text:no text PT:5/2 -T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Hand | Destination$ Stack | Static$ True | DelayedTrigger$ CastFromHand | TriggerDescription$ CARDNAME enters the battlefield with a divinity counter on it if you cast it from your hand. -SVar:CastFromHand:Mode$ ChangesZone | Origin$ Stack | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ETBCounter | Static$ True +T:Mode$ ChangesZone | ValidCard$ Card.wasCastFromHand+Self | Destination$ Battlefield | Static$ True | Execute$ ETBCounter | TriggerDescription$ CARDNAME enters the battlefield with a divinity counter on it if you cast it from your hand. SVar:ETBCounter:AB$PutCounter | Cost$ 0 | Defined$ Self | CounterType$ DIVINITY | CounterNum$ 1 S:Mode$ Continuous | Affected$ Card.Self+counters_GE1_DIVINITY | AddKeyword$ Indestructible | Description$ CARDNAME is indestructible as long as it has a divinity counter on it. A:AB$ Discard | Cost$ SubCounter<1/DIVINITY> | Defined$ Opponent | Mode$ Hand | SpellDescription$ Each opponent discards his or her hand. diff --git a/res/cardsfolder/m/myojin_of_seeing_winds.txt b/res/cardsfolder/m/myojin_of_seeing_winds.txt index 942602ad99b..a59f63870c7 100644 --- a/res/cardsfolder/m/myojin_of_seeing_winds.txt +++ b/res/cardsfolder/m/myojin_of_seeing_winds.txt @@ -3,8 +3,7 @@ ManaCost:7 U U U Types:Legendary Creature Spirit Text:no text PT:3/3 -T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Hand | Destination$ Stack | Static$ True | DelayedTrigger$ CastFromHand | TriggerDescription$ CARDNAME enters the battlefield with a divinity counter on it if you cast it from your hand. -SVar:CastFromHand:Mode$ ChangesZone | Origin$ Stack | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ ETBCounter | Static$ True +T:Mode$ ChangesZone | ValidCard$ Card.wasCastFromHand+Self | Destination$ Battlefield | Static$ True | Execute$ ETBCounter | TriggerDescription$ CARDNAME enters the battlefield with a divinity counter on it if you cast it from your hand. SVar:ETBCounter:AB$PutCounter | Cost$ 0 | Defined$ Self | CounterType$ DIVINITY | CounterNum$ 1 S:Mode$ Continuous | Affected$ Card.Self+counters_GE1_DIVINITY | AddKeyword$ Indestructible | Description$ CARDNAME is indestructible as long as it has a divinity counter on it. A:AB$ Draw | Cost$ SubCounter<1/DIVINITY> | NumCards$ X | SpellDescription$ Draw a card for each permanent you control. diff --git a/res/cardsfolder/r/reiver_demon.txt b/res/cardsfolder/r/reiver_demon.txt index fd84ff73297..edc78f38220 100644 --- a/res/cardsfolder/r/reiver_demon.txt +++ b/res/cardsfolder/r/reiver_demon.txt @@ -4,8 +4,7 @@ Types:Creature Demon Text:no text PT:6/6 K:Flying -T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Hand | Destination$ Stack | Static$ True | DelayedTrigger$ CastFromHand | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, destroy all nonartifact, nonblack creatures. They can't be regenerated. -SVar:CastFromHand:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Stack | Destination$ Battlefield | Execute$ TrigDestroyAll | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, destroy all nonartifact, nonblack creatures. They can't be regenerated. +T:Mode$ ChangesZone | ValidCard$ Card.wasCastFromHand+Self | Destination$ Battlefield | Execute$ TrigDestroyAll | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, destroy all nonartifact, nonblack creatures. They can't be regenerated. SVar:TrigDestroyAll:AB$DestroyAll | Cost$ 0 | ValidCards$ Creature.nonArtifact+nonBlack | NoRegen$ True SVar:RemAIDeck:True SVar:Rarity:Rare diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 1774413473f..a222877ca54 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -68,6 +68,8 @@ public class Card extends GameEntity implements Comparable { private boolean isDoubleFaced = false; private boolean isFlip = false; + + private Zone castFrom = null; /** * Instantiates a new card. @@ -2768,6 +2770,9 @@ public class Card extends GameEntity implements Comparable { } sb.append("Remove CARDNAME from your deck before playing if you're not playing for ante.\r\n"); } + if(keyword.equals("Rebound")) { + sb.append(keyword).append("\r\n"); + } } return sb; } @@ -7172,6 +7177,18 @@ public class Card extends GameEntity implements Comparable { if (!b) { return false; } + } else if (property.startsWith("wasCastFrom")) { + String strZone = property.substring(11); + Zone realZone = Constant.Zone.smartValueOf(strZone); + if(realZone != this.getCastFrom()) { + return false; + } + } else if (property.startsWith("wasNotCastFrom")) { + String strZone = property.substring(14); + Zone realZone = Constant.Zone.smartValueOf(strZone); + if(realZone == this.getCastFrom()) { + return false; + } } else { if (property.equals("ChosenType")) { if (!this.isType(source.getChosenType())) { @@ -8705,4 +8722,20 @@ public class Card extends GameEntity implements Comparable { this.getCharacteristics().getReplacementEffects().add(replacementEffectCopy); } + /** + * Returns what zone this card was cast from (from what zone it was moved to the stack) + * + * @return the castFrom + */ + public Zone getCastFrom() { + return castFrom; + } + + /** + * @param castFrom0 the castFrom to set + */ + public void setCastFrom(Zone castFrom0) { + this.castFrom = castFrom0; + } + } // end Card class diff --git a/src/main/java/forge/GameAction.java b/src/main/java/forge/GameAction.java index dec3eddc945..4f3795c9b9e 100644 --- a/src/main/java/forge/GameAction.java +++ b/src/main/java/forge/GameAction.java @@ -238,6 +238,13 @@ public class GameAction { c = GameAction.changeZone(prev, zone, c); + if(zone.is(Zone.Stack)) { + c.setCastFrom(prev.getZoneType()); + } + else if(!(zone.is(Zone.Battlefield) && prev.is(Zone.Stack))){ + c.setCastFrom(null); + } + if (c.isAura() && zone.is(Constant.Zone.Battlefield) && ((prev == null) || !prev.is(Constant.Zone.Stack))) { // TODO Need a way to override this for Abilities that put Auras // into play attached to things diff --git a/src/main/java/forge/card/cardfactory/CardFactoryUtil.java b/src/main/java/forge/card/cardfactory/CardFactoryUtil.java index d48f6be9f13..13f61727227 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryUtil.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryUtil.java @@ -2931,7 +2931,7 @@ public class CardFactoryUtil { } } - // Count$FatefulHour..numNotFH> + // Count$FatefulHour.. if (sq[0].contains("FatefulHour")) { if (cardController.getLife() <= 5) { return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c); @@ -2939,6 +2939,17 @@ public class CardFactoryUtil { return CardFactoryUtil.doXMath(Integer.parseInt(sq[2]), m, c); } } + + // Count$wasCastFrom.. + if (sq[0].startsWith("wasCastFrom")) { + String strZone = sq[0].substring(11); + Zone realZone = Zone.smartValueOf(strZone); + if(c.getCastFrom() == realZone) { + return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c); + } else { + return CardFactoryUtil.doXMath(Integer.parseInt(sq[2]), m, c); + } + } if (sq[0].contains("Threshold")) { if (cardController.hasThreshold()) {