From 477439773ba6bf1937f3cec241a10063ccfbdf63 Mon Sep 17 00:00:00 2001 From: "solo81@web.de" Date: Mon, 9 Aug 2010 23:49:31 +0000 Subject: [PATCH] - Fixed the "CANTREGENERATE" keyword (by Zethfox). The engine always handled it as "REGENERATE" and thus had to be renamed. Its new name is "CANTREGEN". It has been tested excessively by me and Zethfox. Now all cards with the former "cantregenerate" work as they should. - I also added a test for "CANTREGEN" (Incinerate). - Added the new keyword "FOG" (by Zethfox). This is an equivalent for "PREVENTALLCOMBATDAMAGE", which only worked for instants and sorceries. "Fog" works only for permanents and is used in combination with the newly introduced parameter "ONESHOT"! - I also added 2 tests for "FOG" (Maze of Ith, Spore Frog). Both additions lead to several issue fixes: Fixed issue286. Fixed issue328. Fixed issue332. Fixed issue416. - Removed Demonic Torment, Gaseous Form, General's Kabuto, Sandskin. Those cards never worked and could even not be fixed with "FOG". - Optimized the code of the dragon-lair land-cycle from PLS and added 2 tests for them. - Added 8 successfully tested cards. Card list -> first comment. --- projects/mtg/bin/Res/sets/mtg_todo.dat | 93 ++++---- projects/mtg/bin/Res/sets/primitives/mtg.txt | 207 +++++++++++------- projects/mtg/bin/Res/test/_tests.txt | 5 + .../mtg/bin/Res/test/crosis_s_catacombs_1.txt | 20 ++ .../mtg/bin/Res/test/crosis_s_catacombs_2.txt | 18 ++ projects/mtg/bin/Res/test/incinerate.txt | 21 ++ projects/mtg/bin/Res/test/maze_of_ith.txt | 48 ++++ projects/mtg/bin/Res/test/spore_frog.txt | 49 +++++ projects/mtg/include/AllAbilities.h | 14 +- projects/mtg/include/MTGAbility.h | 2 +- projects/mtg/include/MTGDefinitions.h | 2 +- projects/mtg/src/MTGAbility.cpp | 27 ++- projects/mtg/src/MTGCardInstance.cpp | 4 +- projects/mtg/src/MTGDefinitions.cpp | 2 +- 14 files changed, 367 insertions(+), 145 deletions(-) create mode 100644 projects/mtg/bin/Res/test/crosis_s_catacombs_1.txt create mode 100644 projects/mtg/bin/Res/test/crosis_s_catacombs_2.txt create mode 100644 projects/mtg/bin/Res/test/incinerate.txt create mode 100644 projects/mtg/bin/Res/test/maze_of_ith.txt create mode 100644 projects/mtg/bin/Res/test/spore_frog.txt diff --git a/projects/mtg/bin/Res/sets/mtg_todo.dat b/projects/mtg/bin/Res/sets/mtg_todo.dat index 08afe0bd7..c9fb7729b 100644 --- a/projects/mtg/bin/Res/sets/mtg_todo.dat +++ b/projects/mtg/bin/Res/sets/mtg_todo.dat @@ -8075,6 +8075,17 @@ power=5 toughness=5 [/card] [card] +##Neither works with "preventallCombatDamage" nor "fog". +name=Demonic Torment +target=creature +auto=cantattack +auto=preventAllCombatDamage from(mytgt) +text=Enchant creature -- Enchanted creature can't attack. -- Prevent all combat damage that would be dealt by enchanted creature. +mana={2}{B} +type=Enchantment +subtype=Aura +[/card] +[card] name=Demon of Death's Gate text=Flying, trample -- You may pay 6 life and sacrifice three black creatures rather than pay Demon of Death's Gate's mana cost. mana={6}{B}{B}{B} @@ -8712,12 +8723,6 @@ power=1 toughness=1 [/card] [card] -name=Dolmen Gate -text=Prevent all combat damage that would be dealt to attacking creatures you control. -mana={2} -type=Artifact -[/card] -[card] name=Dominate text=Gain control of target creature with converted mana cost X or less. (This effect lasts indefinitely.) mana={X}{1}{U}{U} @@ -13014,6 +13019,17 @@ power=2 toughness=2 [/card] [card] +##Neither works with "preventallCombatDamage" nor "fog". +name=Gaseous Form +target=creature +auto=preventAllCombatDamage from(mytgt) +auto=preventAllCombatDamage to(mytgt) +text=Enchant creature -- Prevent all combat damage that would be dealt to and dealt by enchanted creature. +mana={2}{U} +type=Enchantment +subtype=Aura +[/card] +[card] name=Gate Hound text=Creatures you control have vigilance as long as Gate Hound is enchanted. mana={2}{W} @@ -13129,6 +13145,17 @@ power=1 toughness=2 [/card] [card] +##Neither works with "preventallCombatDamage" nor "fog". +name=General's Kabuto +auto={2}:equip +auto=shroud +auto=preventAllCombatDamage to(mytgt) +text=Equipped creature has shroud. (It can't be the target of spells or abilities.) -- Prevent all combat damage that would be dealt to equipped creature. -- Equip {2} ({2}: Attach to target creature you control. Equip only as a sorcery.) +mana={4} +type=Artifact +subtype=Equipment +[/card] +[card] name=General's Regalia text={3}: The next time a source of your choice would deal damage to you this turn, that damage is dealt to target creature you control instead. mana={3} @@ -16136,7 +16163,6 @@ power=* toughness=* [/card] [card] -#"prevent from target" does not work in Wagic 0.11 name=Horn of Deafening auto={2}{T}:preventAllCombatDamage from target(creature) text={2}, {T}: Prevent all combat damage that would be dealt by target creature this turn. @@ -27883,15 +27909,6 @@ mana={2}{R} type=Instant [/card] [card] -name=Radiant Kavu -text={R}{G}{W}: Prevent all combat damage blue creatures and black creatures would deal this turn. -mana={R}{G}{W} -type=Creature -subtype=Kavu -power=3 -toughness=3 -[/card] -[card] name=Radiate text=Choose target instant or sorcery spell that targets only a single permanent or player. Copy that spell for each other permanent or player the spell could target. Each copy targets a different one of those permanents and players. mana={3}{R}{R} @@ -30566,6 +30583,17 @@ mana={4} type=Artifact [/card] [card] +##Neither works with "preventallCombatDamage" nor "fog". +name=Sandskin +target=creature +auto=preventAllCombatDamage from(mytgt) +auto=preventAllCombatDamage to(mytgt) +text=Enchant creature -- Prevent all combat damage that would be dealt to and dealt by enchanted creature. +mana={2}{W} +type=Enchantment +subtype=Aura +[/card] +[card] name=Sandsower text=Tap three untapped creatures you control: Tap target creature. mana={3}{W} @@ -34131,15 +34159,6 @@ power=0 toughness=0 [/card] [card] -name=Spike Weaver -text=Spike Weaver enters the battlefield with three +1/+1 counters on it. -- {2}, Remove a +1/+1 counter from Spike Weaver: Put a +1/+1 counter on target creature. -- {1}, Remove a +1/+1 counter from Spike Weaver: Prevent all combat damage that would be dealt this turn. -mana={2}{G}{G} -type=Creature -subtype=Spike -power=0 -toughness=0 -[/card] -[card] name=Spiketail Drake text=Flying -- Sacrifice Spiketail Drake: Counter target spell unless its controller pays {3}. mana={3}{U}{U} @@ -34435,15 +34454,6 @@ mana={1}{G}{G} type=Instant [/card] [card] -name=Spore Flower -text=At the beginning of your upkeep, put a spore counter on Spore Flower. -- Remove three spore counters from Spore Flower: Prevent all combat damage that would be dealt this turn. -mana={G}{G} -type=Creature -subtype=Fungus -power=0 -toughness=1 -[/card] -[card] name=Sporeback Troll text=Graft 2 (This creature enters the battlefield with two +1/+1 counters on it. Whenever another creature enters the battlefield, you may move a +1/+1 counter from this creature onto it.) -- {1}{G}: Regenerate target creature with a +1/+1 counter on it. mana={3}{G} @@ -34759,12 +34769,6 @@ type=Enchantment subtype=Aura [/card] [card] -name=Statecraft -text=Prevent all combat damage that would be dealt to and dealt by creatures you control. -mana={3}{U} -type=Enchantment -[/card] -[card] name=Static Orb text=If Static Orb is untapped, players can't untap more than two permanents during their untap steps. mana={3} @@ -38436,15 +38440,6 @@ power=2 toughness=2 [/card] [card] -name=Urborg Phantom -text=Urborg Phantom can't block. -- {U}: Prevent all combat damage that would be dealt to and dealt by Urborg Phantom this turn. -mana={2}{B} -type=Creature -subtype=Spirit Minion -power=3 -toughness=1 -[/card] -[card] name=Urborg, Tomb of Yawgmoth text=Each land is a Swamp in addition to its other land types. type=Legendary Land diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 0cb9e97aa..9fd1264fc 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -7752,6 +7752,7 @@ toughness=6 name=Child of Gaea abilities=trample auto=upcost[{G}{G}] moveTo(graveyard) +auto={1}{G}:regenerate text=Trample -- At the beginning of your upkeep, sacrifice Child of Gaea unless you pay {G}{G}. -- {1}{G}: Regenerate Child of Gaea. mana={3}{G}{G}{G} type=Creature @@ -9597,11 +9598,11 @@ toughness=3 [/card] [card] name=Crosis's Catacombs -auto=aslongas(land[-lair]|mybattlefield) moveto(myhand) target(land[-lair]|mybattlefield) oneshot +auto=aslongas(land[-lair]|mybattlefield) moveto(myhand) target(land[-lair]|mybattlefield?) oneshot && counter(0/0,-1,payment) auto=moveto(mygraveyard) target(this|mybattlefield) -auto={T}:Add{U} -auto={T}:Add{B} -auto={T}:Add{R} +auto=this(counter{0/0.1.payment}<1) {T}:Add{U} +auto=this(counter{0/0.1.payment}<1) {T}:Add{B} +auto=this(counter{0/0.1.payment}<1) {T}:Add{R} text=When Crosis's Catacombs enters the battlefield, sacrifice it unless you return a non-Lair land you control to its owner's hand. -- {T}: Add {U}, {B}, or {R} to your mana pool. type=Land subtype=Lair @@ -10208,11 +10209,11 @@ toughness=3 [/card] [card] name=Darigaaz's Caldera -auto=aslongas(land[-lair]|mybattlefield) moveto(myhand) target(land[-lair]|mybattlefield) oneshot +auto=aslongas(land[-lair]|mybattlefield) moveto(myhand) target(land[-lair]|mybattlefield?) oneshot && counter(0/0,-1,payment) auto=moveto(mygraveyard) target(this|mybattlefield) -auto={T}:Add{B} -auto={T}:Add{R} -auto={T}:Add{G} +auto=this(counter{0/0.1.payment}<1) {T}:Add{B} +auto=this(counter{0/0.1.payment}<1) {T}:Add{R} +auto=this(counter{0/0.1.payment}<1) {T}:Add{G} text=When Darigaaz's Caldera enters the battlefield, sacrifice it unless you return a non-Lair land you control to its owner's hand. -- {T}: Add {B}, {R}, or {G} to your mana pool. type=Land subtype=Lair @@ -10610,7 +10611,7 @@ toughness=1 [/card] [card] name=Dawnstrider -auto={G}{T}{S(*|myhand)}:preventAllCombatDamage ueot +auto={G}{T}{S(*|myhand)}:fog oneshot text={G}, {T}, Discard a card: Prevent all combat damage that would be dealt this turn. mana={1}{G} type=Creature @@ -11232,16 +11233,6 @@ type=Enchantment subtype=Aura [/card] [card] -name=Demonic Torment -target=creature -auto=cantattack -auto=preventAllCombatDamage from(mytgt) -text=Enchant creature -- Enchanted creature can't attack. -- Prevent all combat damage that would be dealt by enchanted creature. -mana={2}{B} -type=Enchantment -subtype=Aura -[/card] -[card] name=Demonic Tutor target=*|myLibrary auto=moveTo(hand) @@ -12028,6 +12019,13 @@ mana={3}{R} type=Instant [/card] [card] +name=Dolmen Gate +auto=preventAllCombatDamage to(creature[attacking]|myBattlefield) +text=Prevent all combat damage that would be dealt to attacking creatures you control. +mana={2} +type=Artifact +[/card] +[card] name=Dominaria's Judgment auto=aslongas(plains|myBattlefield) lord(creature|myBattlefield) protection from white auto=aslongas(island|myBattlefield) lord(creature|myBattlefield) protection from blue @@ -12669,11 +12667,11 @@ toughness=3 [/card] [card] name=Dromar's Cavern -auto=aslongas(land[-lair]|mybattlefield) moveto(myhand) target(land[-lair]|mybattlefield) oneshot +auto=aslongas(land[-lair]|mybattlefield) moveto(myhand) target(land[-lair]|mybattlefield?) oneshot && counter(0/0,-1,payment) auto=moveto(mygraveyard) target(this|mybattlefield) -auto={T}:Add{W} -auto={T}:Add{U} -auto={T}:Add{B} +auto=this(counter{0/0.1.payment}<1) {T}:Add{W} +auto=this(counter{0/0.1.payment}<1) {T}:Add{U} +auto=this(counter{0/0.1.payment}<1) {T}:Add{B} text=When Dromar's Cavern enters the battlefield, sacrifice it unless you return a non-Lair land you control to its owner's hand. -- {T}: Add {W}, {U}, or {B} to your mana pool. type=Land subtype=Lair @@ -13315,7 +13313,7 @@ type=Land [/card] [card] name=Ebony Horse -auto={2}{T}:untap target(creature[attacking]|myBattlefield) && preventAllCombatDamage to(mytgt) ueot && preventAllCombatDamage from(mytgt) ueot +auto={2}{T}:untap target(creature[attacking]|myBattlefield) && fog to(mytgt) oneshot && fog from(mytgt) oneshot text={2}, {T}: Untap target attacking creature you control. Prevent all combat damage that would be dealt to and dealt by that creature this turn. mana={3} type=Artifact @@ -13813,7 +13811,7 @@ toughness=1 [/card] [card] name=Elvish Scout -auto={G}{T}:untap target(creature[attacking]|myBattlefield) && preventAllCombatDamage to(mytgt) ueot && preventAllCombatDamage from(mytgt) ueot +auto={G}{T}:untap target(creature[attacking]|myBattlefield) && fog to(mytgt) oneshot && fog from(mytgt) oneshot text={G}, {T}: Untap target attacking creature you control. Prevent all combat damage that would be dealt to and dealt by it this turn. mana={G} type=Creature @@ -16161,7 +16159,7 @@ toughness=3 name=Flamebreak auto=damage:3 all(creature[-flying]) auto=damage:3 all(player) -auto=lord(creature[-flying]) cantregenerate +auto=lord(creature[-flying;-protection from red]) cantregen ueot text=Flamebreak deals 3 damage to each creature without flying and each player. Creatures dealt damage this way can't be regenerated this turn. mana={R}{R}{R} type=Sorcery @@ -16938,9 +16936,7 @@ type=Artifact [card] name=Foxfire target=creature[attacking] -auto=untap -auto=preventAllCombatDamage to(mytgt) ueot -auto=preventAllCombatDamage from(mytgt) ueot +auto=untap && fog to(mytgt) oneshot && fog from(mytgt) oneshot auto=@next upkeep:draw:1 controller text=Untap target attacking creature. Prevent all combat damage that would be dealt to and dealt by that creature this turn. -- Draw a card at the beginning of the next turn's upkeep. mana={2}{G} @@ -17213,7 +17209,7 @@ type=Enchantment [/card] [card] name=Furnace Brood -auto={R}:cantregenerate target(creature) +auto={R}:cantregen target(creature) text={R}: Target creature can't be regenerated this turn. mana={3}{R} type=Creature @@ -17505,16 +17501,6 @@ power=4 toughness=4 [/card] [card] -name=Gaseous Form -target=creature -auto=preventAllCombatDamage from(mytgt) -auto=preventAllCombatDamage to(mytgt) -text=Enchant creature -- Prevent all combat damage that would be dealt to and dealt by enchanted creature. -mana={2}{U} -type=Enchantment -subtype=Aura -[/card] -[card] name=Gate to Phyrexia auto={S(creature|myBattlefield)}:destroy target(artifact) limit:1 myUpkeepOnly text=Sacrifice a creature: Destroy target artifact. Activate this ability only during your upkeep and only once each turn. @@ -17642,16 +17628,6 @@ text=Gemstone Mine enters the battlefield with three mining counters on it. -- { type=Land [/card] [card] -name=General's Kabuto -auto={2}:equip -auto=shroud -auto=preventAllCombatDamage to(mytgt) -text=Equipped creature has shroud. (It can't be the target of spells or abilities.) -- Prevent all combat damage that would be dealt to equipped creature. -- Equip {2} ({2}: Attach to target creature you control. Equip only as a sorcery.) -mana={4} -type=Artifact -subtype=Equipment -[/card] -[card] name=Genesis autograveyard={2}{G}:moveTo(myhand) target(creature|mygraveyard) myUpkeepOnly text=At the beginning of your upkeep, if Genesis is in your graveyard, you may pay {2}{G}. If you do, return target creature card from your graveyard to your hand. @@ -17981,8 +17957,11 @@ toughness=3 [/card] [card] name=Giant Growth -target=creature -auto=3/3 +##target=creature +##auto=3/3 +target=creature,player +auto=cantregen +auto=damage:3 text=Target creature gets +3/+3 until end of turn. mana={G} type=Instant @@ -18149,7 +18128,7 @@ type=Land [/card] [card] name=Glacial Crevasses -auto={S(mountain[snow]|myBattlefield)}:preventAllcombatDamage ueot +auto={S(mountain[snow]|myBattlefield)}:fog oneshot text=Sacrifice a snow Mountain: Prevent all combat damage that would be dealt this turn. mana={2}{R} type=Enchantment @@ -19511,7 +19490,7 @@ toughness=1 [card] name=Gravebind target=creature -auto=cantregenerate +auto=cantregen auto=@next upkeep:draw:1 controller text=Target creature can't be regenerated this turn. -- Draw a card at the beginning of the next turn's upkeep. mana={B} @@ -20056,6 +20035,17 @@ type=Enchantment subtype=Aura [/card] [card] +name=Guard Gomazoa +abilities=flying,defender +auto=preventAllCombatDamage to(this) +text=Defender, flying -- Prevent all combat damage that would be dealt to Guard Gomazoa. +mana={2}{U} +type=Creature +subtype=Jellyfish +power=1 +toughness=3 +[/card] +[card] name=Guardian Idol auto=tap auto={T}:Add{1} @@ -20670,6 +20660,17 @@ power=1 toughness=2 [/card] [card] +name=Haze Frog +abilities=flash +auto=fog from(other creature) oneshot +text=Flash (You may cast this spell any time you could cast an instant.) -- When Haze Frog enters the battlefield, prevent all combat damage that other creatures would deal this turn. +mana={3}{G}{G} +type=Creature +subtype=Frog +power=2 +toughness=1 +[/card] +[card] name=Hazerider Drake abilities=flying,protection from red text=Flying, protection from red @@ -22123,7 +22124,7 @@ type=Sorcery [/card] [card] name=Hurr Jackal -auto={T}:cantregenerate target(creature) +auto={T}:cantregen target(creature) text={T}: Target creature can't be regenerated this turn. mana={R} type=Creature @@ -22536,7 +22537,7 @@ subtype=Aura [card] name=Incinerate target=creature,player -auto=cantregenerate +auto=cantregen auto=damage:3 text=Incinerate deals 3 damage to target creature or player. A creature dealt damage this way can't be regenerated this turn. mana={1}{R} @@ -23391,7 +23392,7 @@ toughness=1 [card] name=Jaya Ballard, Task Mage auto={R}{T}{S(*|myHand)}:destroy target(*[blue]) -auto={1}{R}{T}{S(*|myHand)}:damage:3 && cantregenerate target(creature,player) +auto={1}{R}{T}{S(*|myHand)}:damage:3 && cantregen target(creature,player) auto={5}{R}{R}{S(*|myHand)}:damage:6 all(creature,player) text={R}, {T}, Discard a card: Destroy target blue permanent. -- {1}{R}, {T}, Discard a card: Jaya Ballard, Task Mage deals 3 damage to target creature or player. A creature dealt damage this way can't be regenerated this turn. -- {5}{R}{R}, {T}, Discard a card: Jaya Ballard deals 6 damage to each creature and each player. mana={1}{R}{R} @@ -24129,7 +24130,7 @@ toughness=1 [/card] [card] name=Kami of False Hope -auto={S}:preventAllcombatDamage ueot +auto={S}:fog oneshot text=Sacrifice Kami of False Hope: Prevent all combat damage that would be dealt this turn. mana={W} type=Creature @@ -25369,7 +25370,7 @@ toughness=2 [card] name=Knight-Captain of Eos auto=token(Soldier,creature soldier, 1/1,white)*2 -auto={W}{S(soldier|myBattlefield)}:preventAllcombatDamage ueot +auto={W}{S(soldier|myBattlefield)}:fog oneshot text=When Knight-Captain of Eos enters the battlefield, put two 1/1 white Soldier creature tokens onto the battlefield. -- {W}, Sacrifice a Soldier: Prevent all combat damage that would be dealt this turn. mana={4}{W} type=Creature @@ -28562,14 +28563,14 @@ type=Enchantment [/card] [card] name=Maze of Ith -auto={T}:untap target(creature[attacking]) && preventAllCombatDamage to(mytgt) ueot && preventAllCombatDamage from(mytgt) ueot +auto={T}:untap target(creature[attacking]) && fog to(mytgt) oneshot && fog from(mytgt) oneshot text={T}: Untap target attacking creature. Prevent all combat damage that would be dealt to and dealt by that creature this turn. type=Land [/card] [card] name=Maze of Shadows auto={T}:Add {1} -auto={T}:untap target(creature[attacking;shadow]) && preventAllCombatDamage to(mytgt) ueot && preventAllCombatDamage from(mytgt) ueot +auto={T}:untap target(creature[attacking;shadow]) && fog to(mytgt) oneshot && fog from(mytgt) oneshot text={T}: Add {1} to your mana pool. -- {T}: Untap target attacking creature with shadow. Prevent all combat damage that would be dealt to and dealt by that creature this turn. type=Land [/card] @@ -32470,7 +32471,7 @@ toughness=3 [/card] [card] name=Orcish Healer -auto={R}{R}{T}:cantregenerate target(creature) +auto={R}{R}{T}:cantregen target(creature) auto={B}{B}{R}{T}:regenerate target(creature[black;green]) auto={R}{G}{G}{T}:regenerate target(creature[black;green]) text={R}{R}, {T}: Target creature can't be regenerated this turn. -- {B}{B}{R}, {T}: Regenerate target black or green creature. -- {R}{G}{G}, {T}: Regenerate target black or green creature. @@ -35365,6 +35366,16 @@ power=2 toughness=3 [/card] [card] +name=Radiant Kavu +auto={R}{G}{W}:fog from(creature[blue]) oneshot && fog from(creature[black]) oneshot +text={R}{G}{W}: Prevent all combat damage blue creatures and black creatures would deal this turn. +mana={R}{G}{W} +type=Creature +subtype=Kavu +power=3 +toughness=3 +[/card] +[card] name=Radiant's Dragoons auto=life:5 auto=upcost[{3}{W}{0};next upkeep] moveTo(graveyard) @@ -37257,11 +37268,11 @@ toughness=3 [/card] [card] name=Rith's Grove -auto=aslongas(land[-lair]|mybattlefield) moveto(myhand) target(land[-lair]|mybattlefield) oneshot +auto=aslongas(land[-lair]|mybattlefield) moveto(myhand) target(land[-lair]|mybattlefield?) oneshot && counter(0/0,-1,payment) auto=moveto(mygraveyard) target(this|mybattlefield) -auto={T}:Add{R} -auto={T}:Add{G} -auto={T}:Add{W} +auto=this(counter{0/0.1.payment}<1) {T}:Add{R} +auto=this(counter{0/0.1.payment}<1) {T}:Add{G} +auto=this(counter{0/0.1.payment}<1) {T}:Add{W} text=When Rith's Grove enters the battlefield, sacrifice it unless you return a non-Lair land you control to its owner's hand. -- {T}: Add {R}, {G}, or {W} to your mana pool. type=Land subtype=Lair @@ -38327,16 +38338,6 @@ power=3 toughness=4 [/card] [card] -name=Sandskin -target=creature -auto=preventAllCombatDamage from(mytgt) -auto=preventAllCombatDamage to(mytgt) -text=Enchant creature -- Prevent all combat damage that would be dealt to and dealt by enchanted creature. -mana={2}{W} -type=Enchantment -subtype=Aura -[/card] -[card] name=Sandstone Needle auto=counter(0/0,2,Depletion) auto={T}{C(0/0,-1,Depletion)}:Add{R}{R} @@ -43245,6 +43246,18 @@ power=0 toughness=0 [/card] [card] +name=Spike Weaver +auto=counter(1/1,3) +auto={2}{C(1/1,-1)}:counter(1/1,1) target(creature) +auto={2}{C(1/1,-1)}:fog oneshot +text=Spike Weaver enters the battlefield with three +1/+1 counters on it. -- {2}, Remove a +1/+1 counter from Spike Weaver: Put a +1/+1 counter on target creature. -- {1}, Remove a +1/+1 counter from Spike Weaver: Prevent all combat damage that would be dealt this turn. +mana={2}{G}{G} +type=Creature +subtype=Spike +power=0 +toughness=0 +[/card] +[card] name=Spike Worker text=Spike Worker enters the battlefield with a +1/+1 counter on it. -- {2}, Remove a +1/+1 counter from Spike Worker: Put a +1/+1 counter on target creature. mana={2}{G} @@ -43578,8 +43591,19 @@ mana={3}{G} type=Sorcery [/card] [card] +name=Spore Flower +auto=@each my upkeep:counter(0/0,1,Spore) +auto={C(0/0,-3,Spore)}:fog oneshot +text=At the beginning of your upkeep, put a spore counter on Spore Flower. -- Remove three spore counters from Spore Flower: Prevent all combat damage that would be dealt this turn. +mana={G}{G} +type=Creature +subtype=Fungus +power=0 +toughness=1 +[/card] +[card] name=Spore Frog -auto={S}:preventAllcombatDamage ueot +auto={S}:fog oneshot text=Sacrifice Spore Frog: Prevent all combat damage that would be dealt this turn. mana={G} type=Creature @@ -44059,6 +44083,14 @@ mana={1}{U} type=Enchantment [/card] [card] +name=Statecraft +auto=preventAllCombatDamage to(creature|myBattlefield) +auto=preventAllCombatDamage from(creature|myBattlefield) +text=Prevent all combat damage that would be dealt to and dealt by creatures you control. +mana={3}{U} +type=Enchantment +[/card] +[card] name=Staunch Defenders auto=life:4 text=When Staunch Defenders enters the battlefield, you gain 4 life. @@ -45256,7 +45288,7 @@ type=Enchantment [/card] [card] name=Sunstone -auto={2}{S(land[snow])}:preventAllcombatDamage ueot +auto={2}{S(land[snow]|myBattlefield)}:fog oneshot text={2}, Sacrifice a snow land: Prevent all combat damage that would be dealt this turn. mana={3} type=Artifact @@ -48567,11 +48599,11 @@ type=nothing [/card] [card] name=Treva's Ruins -auto=aslongas(land[-lair]|mybattlefield) moveto(myhand) target(land[-lair]|mybattlefield) oneshot +auto=aslongas(land[-lair]|mybattlefield) moveto(myhand) target(land[-lair]|mybattlefield?) oneshot && counter(0/0,-1,payment) auto=moveto(mygraveyard) target(this|mybattlefield) -auto={T}:Add{G} -auto={T}:Add{W} -auto={T}:Add{U} +auto=this(counter{0/0.1.payment}<1) {T}:Add{G} +auto=this(counter{0/0.1.payment}<1) {T}:Add{W} +auto=this(counter{0/0.1.payment}<1) {T}:Add{U} text=When Treva's Ruins enters the battlefield, sacrifice it unless you return a non-Lair land you control to its owner's hand. -- {T}: Add {G}, {W}, or {U} to your mana pool. type=Land subtype=Lair @@ -49507,6 +49539,17 @@ power=2 toughness=2 [/card] [card] +name=Urborg Phantom +abilities=cantblock +auto={U}:fog to(mytgt) oneshot && fog from(mytgt) oneshot +text=Urborg Phantom can't block. -- {U}: Prevent all combat damage that would be dealt to and dealt by Urborg Phantom this turn. +mana={2}{B} +type=Creature +subtype=Spirit Minion +power=3 +toughness=1 +[/card] +[card] name=Urborg Shambler auto=lord(creature[black]) -1/-1 other text=Other black creatures get -1/-1. diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 2cca121b8..44154d95c 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -180,6 +180,8 @@ creature_bond.txt curiosity1_i217.txt curiosity2_i217.txt crimson_kobolds.txt +crosis_s_catacombs_1.txt +crosis_s_catacombs_2.txt crumble.txt crystal_rod_i172.txt dark_banishing.txt @@ -284,6 +286,7 @@ hypnotic_specter.txt icatian_priest.txt imaginary_pet.txt immaculate_magistrate.txt +incinerate.txt instill_energy_i166.txt iron_will_i270.txt ivy_elemental.txt @@ -326,6 +329,7 @@ master_decoy.txt master_of_etherium.txt masticore.txt masticore2.txt +maze_of_ith.txt meekstone.txt memory_erosion.txt millstone.txt @@ -422,6 +426,7 @@ sphinx_summoner.txt spirit_link.txt spitting_earth.txt spoils_of_evil.txt +spore_frog.txt stasis.txt steelclad_serpent1.txt steelclad_serpent2.txt diff --git a/projects/mtg/bin/Res/test/crosis_s_catacombs_1.txt b/projects/mtg/bin/Res/test/crosis_s_catacombs_1.txt new file mode 100644 index 000000000..738260f29 --- /dev/null +++ b/projects/mtg/bin/Res/test/crosis_s_catacombs_1.txt @@ -0,0 +1,20 @@ +#NAME: Crosis's Catacombs +#DESC: When Crosis's Catacombs enters the battlefield, sacrifice it unless you return a non-Lair land you control to its owner's hand. +#DESC: Catacombs enter the battlefield WITH a legal target to bounce. +[INIT] +firstmain +[PLAYER1] +inplay:Swamp +hand:Crosis's Catacombs +[PLAYER2] +[DO] +Crosis's Catacombs +choice 0 +Swamp +[ASSERT] +firstmain +[PLAYER1] +inplay:Crosis's Catacombs +hand:Swamp +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/crosis_s_catacombs_2.txt b/projects/mtg/bin/Res/test/crosis_s_catacombs_2.txt new file mode 100644 index 000000000..f97b19aa0 --- /dev/null +++ b/projects/mtg/bin/Res/test/crosis_s_catacombs_2.txt @@ -0,0 +1,18 @@ +#NAME: Crosis's Catacombs +#DESC: When Crosis's Catacombs enters the battlefield, sacrifice it unless you return a non-Lair land you control to its owner's hand. +#DESC: Test 2: Catacombs enter the battlefield WITHOUT a legal target to bounce. +[INIT] +firstmain +[PLAYER1] +hand:Crosis's Catacombs +[PLAYER2] +[DO] +Crosis's Catacombs +choice 0 +Crosis's Catacombs +[ASSERT] +firstmain +[PLAYER1] +graveyard:Crosis's Catacombs +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/incinerate.txt b/projects/mtg/bin/Res/test/incinerate.txt new file mode 100644 index 000000000..ea3966c72 --- /dev/null +++ b/projects/mtg/bin/Res/test/incinerate.txt @@ -0,0 +1,21 @@ +#Testing Does Incinerate really prevent its target from keeping its regeneration shield? +[INIT] +FIRSTMAIN +[PLAYER1] +hand:Deathmark,Incinerate +inplay:Child Of Gaea +manapool:{2}{B}{R}{G} +[PLAYER2] +[DO] +Incinerate +Child of Gaea +Child of Gaea +Deathmark +Child of Gaea +[ASSERT] +FIRSTMAIN +[PLAYER1] +graveyard:Incinerate,Deathmark,Child of Gaea +manapool:{0} +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/maze_of_ith.txt b/projects/mtg/bin/Res/test/maze_of_ith.txt new file mode 100644 index 000000000..2b7fd5b73 --- /dev/null +++ b/projects/mtg/bin/Res/test/maze_of_ith.txt @@ -0,0 +1,48 @@ +#NAME:Maze of Ith +#Test:Does Maze of Ith prevent an attacking creature from dealing combat damage (for only one turn)? +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:prodigal sorcerer,raging goblin,maze of ith +[PLAYER2] +life:20 +[DO] +fog +prodigal sorcerer +p2 +next +#begin +next +#attackers +raging goblin +maze of ith +raging goblin +next +#blockers +next +#damage +next +#end combat +eot +eot +next +next +next +next +#combatbegins +next +#attackers +raging goblin +next +#blockers +next +#damage +next +#end combat +[ASSERT] +COMBATEND +[PLAYER1] +inplay:prodigal sorcerer,raging goblin,maze of ith +[PLAYER2] +life:18 +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/spore_frog.txt b/projects/mtg/bin/Res/test/spore_frog.txt new file mode 100644 index 000000000..e307c2b4c --- /dev/null +++ b/projects/mtg/bin/Res/test/spore_frog.txt @@ -0,0 +1,49 @@ +#NAME:Spore Frog +#Test:Does Spore Frog prevent all combat damage (for only one turn)? +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:prodigal sorcerer,raging goblin,panther warriors,spore frog +[PLAYER2] +life:20 +[DO] +spore frog +prodigal sorcerer +p2 +next +#begin +next +#attackers +raging goblin +panther warriors +next +#blockers +next +#damage +next +#end combat +eot +eot +next +next +next +next +#combatbegins +next +#attackers +raging goblin +panther warriors +next +#blockers +next +#damage +next +#end combat +[ASSERT] +COMBATEND +[PLAYER1] +inplay:prodigal sorcerer,raging goblin,panther warriors +graveyard:spore frog +[PLAYER2] +life:12 +[END] \ No newline at end of file diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 81f12858c..c5a176f05 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1564,9 +1564,10 @@ class AStandardRegenerate:public ActivatedAbility{ } int resolve(){ + MTGCardInstance * _target = (MTGCardInstance *)target; - _target->regenerate(); - return 1; + _target->regenerate(); + return 1; } const char * getMenuText(){ @@ -2578,15 +2579,16 @@ public: ability = NEW APreventAllCombatDamage(id,source,to, from); } + int resolve(){ APreventAllCombatDamage * a = ability->clone(); - a->target = this->target; - a->forceDestroy = -1; //Prevent the effect from getting destroyed because its source is not inplay - a->addToGame(); - clones.push_back(a); + GenericInstantAbility * wrapper = NEW GenericInstantAbility(1,source,(Damageable *)(this->target),a); + wrapper->addToGame(); return 1; } + + int destroy(){ for (size_t i = 0; i < clones.size(); ++i){ clones[i]->forceDestroy = 0; diff --git a/projects/mtg/include/MTGAbility.h b/projects/mtg/include/MTGAbility.h index e6947cbe5..d37cd3eab 100644 --- a/projects/mtg/include/MTGAbility.h +++ b/projects/mtg/include/MTGAbility.h @@ -265,7 +265,7 @@ class AbilityFactory{ Counter * parseCounter(string s, MTGCardInstance * target, Spell * spell = NULL); int parsePowerToughness(string s, int *power, int *toughness); int getAbilities(vector * v, Spell * spell, MTGCardInstance * card = NULL, int id = 0,MTGGameZone * dest = NULL); - MTGAbility * parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated = 0, int forceUEOT = 0,MTGGameZone * dest = NULL); + MTGAbility * parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated = 0, int forceUEOT = 0,int oneShot = 0, MTGGameZone * dest = NULL); int abilityEfficiency(MTGAbility * a, Player * p, int mode = MODE_ABILITY, TargetChooser * tc = NULL); int magicText(int id, Spell * spell, MTGCardInstance * card = NULL, int mode = MODE_PUTINTOPLAY, TargetChooser * tc = NULL, MTGGameZone * dest = NULL); static int computeX(Spell * spell, MTGCardInstance * card); diff --git a/projects/mtg/include/MTGDefinitions.h b/projects/mtg/include/MTGDefinitions.h index 58619f6e9..fd6b349a3 100644 --- a/projects/mtg/include/MTGDefinitions.h +++ b/projects/mtg/include/MTGDefinitions.h @@ -101,7 +101,7 @@ class Constants INTIMIDATE = 43, DEATHTOUCH = 44, HORSEMANSHIP = 45, - CANTREGENERATE = 46, + CANTREGEN = 46, ONEBLOCKER = 47, NB_BASIC_ABILITIES = 48, diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index d7f2b2774..e3280f8d8 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -226,7 +226,7 @@ MTGAbility * AbilityFactory::getCoreAbility(MTGAbility * a){ //Parses a string and returns the corresponding MTGAbility object //Returns NULL if parsing failed //Beware, Spell CAN be null when the function is called by the AI trying to analyze the effects of a given card -MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated, int forceUEOT, MTGGameZone * dest){ +MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated, int forceUEOT, int oneShot, MTGGameZone * dest){ size_t found; string whitespaces (" \t\f\v\n\r"); @@ -709,6 +709,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG found = s.find("ueot"); if (found!= string::npos) forceUEOT = 1; + found = s.find("oneshot"); + if (found!= string::npos) oneShot = 1; //PreventCombat Damage found = s.find("preventallcombatdamage"); @@ -739,6 +741,25 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG return ab; } + //PreventCombat Damage + found = s.find("fog"); + if (found != string::npos){ + string to = ""; + string from = ""; + found = s.find("to("); + if (found != string::npos){ + size_t end = s.find (")", found); + to = s.substr(found+3,end - found - 3); + } + found = s.find("from("); + if (found != string::npos){ + size_t end = s.find (")", found); + from = s.substr(found+5,end - found - 5); + } + MTGAbility * a = NEW APreventAllCombatDamageUEOT(id,card,to,from); + a->oneShot = 1; + return a; + } //Damage found = s.find("damage"); @@ -1106,7 +1127,7 @@ int AbilityFactory::abilityEfficiency(MTGAbility * a, Player * p, int mode, Targ badAbilities[Constants::DEFENDER] = true; badAbilities[Constants::DOESNOTUNTAP] = true; badAbilities[Constants::MUSTATTACK] = true; - badAbilities[Constants::CANTREGENERATE] = true; + badAbilities[Constants::CANTREGEN] = true; if (AInstantBasicAbilityModifierUntilEOT * abi = dynamic_cast(a)) { int result = badAbilities[abi->ability] ? BAKA_EFFECT_BAD : BAKA_EFFECT_GOOD; @@ -1183,7 +1204,7 @@ int AbilityFactory::getAbilities(vector * v, Spell * spell, MTGCar magicText = ""; } - MTGAbility * a = parseMagicLine(line, result, spell, card,0,0,dest); + MTGAbility * a = parseMagicLine(line, result, spell, card,0,0,0,dest); if (a){ v->push_back(a); result++; diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index aeb5941c3..2aa3f2249 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -234,13 +234,13 @@ int MTGCardInstance::isTapped(){ } int MTGCardInstance::regenerate(){ - if (has(Constants::CANTREGENERATE)) return 0; + if (has(Constants::CANTREGEN)) return 0; return ++regenerateTokens; } int MTGCardInstance::triggerRegenerate(){ if (! regenerateTokens) return 0; - if (has(Constants::CANTREGENERATE)) return 0; + if (has(Constants::CANTREGEN)) return 0; regenerateTokens--; tap(); life = toughness; diff --git a/projects/mtg/src/MTGDefinitions.cpp b/projects/mtg/src/MTGDefinitions.cpp index f9d888b7e..5753dbd72 100644 --- a/projects/mtg/src/MTGDefinitions.cpp +++ b/projects/mtg/src/MTGDefinitions.cpp @@ -54,7 +54,7 @@ const char* Constants::MTGBasicAbilities[] = { "intimidate", "deathtouch", "horsemanship", -"cantregenerate", +"cantregen", "oneblocker", };