diff --git a/projects/mtg/bin/Res/sets/CFX/_cards.dat b/projects/mtg/bin/Res/sets/CFX/_cards.dat index 169e8c337..1709eb5e4 100644 --- a/projects/mtg/bin/Res/sets/CFX/_cards.dat +++ b/projects/mtg/bin/Res/sets/CFX/_cards.dat @@ -461,6 +461,18 @@ subtype=Rhino Monk Soldier toughness=3 [/card] [card] +text=When Rhox Meditant comes into play, if you control a green permanent, draw a card. +auto=aslongas(*[green]|myinplay) draw:1 +id=159634 +name=Rhox Meditant +rarity=C +type=Creature +mana={3}{W} +power=2 +subtype=Rhino Monk +toughness=4 +[/card] +[card] text={R}{W}, {T}: Sacellum Archers deals 2 damage to target attacking or blocking creature. auto={R}{W}{T}:damage:2 target(creature[attacking;blocking]) id=179488 diff --git a/projects/mtg/bin/Res/sets/CFX/todo.dat b/projects/mtg/bin/Res/sets/CFX/todo.dat index 77f6cad63..d6689ca0e 100644 --- a/projects/mtg/bin/Res/sets/CFX/todo.dat +++ b/projects/mtg/bin/Res/sets/CFX/todo.dat @@ -606,18 +606,6 @@ rarity=U type=Land [/card] [card] -text=When Rhox Meditant comes into play, if you control a green permanent, draw a card. -auto=aslongas(*[green]|myinplay) draw:1 -id=159634 -name=Rhox Meditant -rarity=C -type=Creature -mana={3}{W} -power=2 -subtype=Rhino Monk -toughness=4 -[/card] -[card] text=When Rotting Rats comes into play, each player discards a card. Unearth {1}{B} ({1}{B}: Return this card from your graveyard to play. It gains haste. Remove it from the game at end of turn or if it would leave play. Unearth only as a sorcery.) id=150833 name=Rotting Rats diff --git a/projects/mtg/bin/Res/sets/ONS/_cards.dat b/projects/mtg/bin/Res/sets/ONS/_cards.dat index c5558d0eb..2297f8624 100644 --- a/projects/mtg/bin/Res/sets/ONS/_cards.dat +++ b/projects/mtg/bin/Res/sets/ONS/_cards.dat @@ -818,7 +818,7 @@ subtype=Zombie Cleric power=1 toughness=1 text={T}: Each player loses 1 life for each Zombie in play. -auto={T}:foreach(Zombie) life:-1 opponent && life:-1 controller +auto={T}:foreach(Zombie) life:-1 opponent && foreach(Zombie) life:-1 controller rarity=C [/card] [card] @@ -999,7 +999,7 @@ subtype=Elf power=1 toughness=1 text={T}: You gain 1 life for each Elf in play. -auto=foreach(Elf)life:1 +auto={T}:foreach(Elf) life:1 rarity=C [/card] [card] diff --git a/projects/mtg/bin/Res/sets/USG/_cards.dat b/projects/mtg/bin/Res/sets/USG/_cards.dat index ab4420298..fe1abb69b 100644 --- a/projects/mtg/bin/Res/sets/USG/_cards.dat +++ b/projects/mtg/bin/Res/sets/USG/_cards.dat @@ -704,6 +704,18 @@ power=1 toughness=3 [/card] [card] +text=At the beginning of your upkeep, if you have a card in hand, return Imaginary Pet to its owner's hand. +auto=@each my upkeep:aslongas(*|myhand) moveTo(myHand) +id=5772 +name=Imaginary Pet +rarity=R +type=Creature +mana={1}{U} +power=4 +subtype=Illusion +toughness=4 +[/card] +[card] text={T}: Add {U} to your mana pool. auto={T}:add {U} id=8326 @@ -999,6 +1011,18 @@ type=Instant mana={B} [/card] [card] +text=At the beginning of your upkeep, if you control another nonland permanent, sacrifice Reclusive Wight. +auto=@each my upkeep:aslongas(*[-land]|mybattlefield) other bury +id=8803 +name=Reclusive Wight +rarity=U +type=Creature +mana={3}{B} +power=4 +subtype=Zombie Minion +toughness=4 +[/card] +[card] text=Enchant creature Enchanted creature has first strike. target=creature auto=first strike diff --git a/projects/mtg/bin/Res/sets/USG/todo.dat b/projects/mtg/bin/Res/sets/USG/todo.dat index a46b15123..2efae67a4 100644 --- a/projects/mtg/bin/Res/sets/USG/todo.dat +++ b/projects/mtg/bin/Res/sets/USG/todo.dat @@ -822,18 +822,7 @@ rarity=R type=Sorcery mana={2}{B}{B} [/card] -[card] -text=At the beginning of your upkeep, if you have a card in hand, return Imaginary Pet to its owner's hand. -auto=@each my upkeep:aslongas(*|myhand) moveTo(myHand) -id=5772 -name=Imaginary Pet -rarity=R -type=Creature -mana={1}{U} -power=4 -subtype=Illusion -toughness=4 -[/card] + [card] text={T}: Destroy target creature with power 4 or greater. id=5678 @@ -1266,18 +1255,7 @@ rarity=R type=Enchantment mana={3}{U}{U} [/card] -[card] -text=At the beginning of your upkeep, if you control another nonland permanent, sacrifice Reclusive Wight. -auto=@each my upkeep:aslongas(*[-land]|mybattlefield) other bury -id=8803 -name=Reclusive Wight -rarity=U -type=Creature -mana={3}{B} -power=4 -subtype=Zombie Minion -toughness=4 -[/card] + [card] text=Prevent all damage that would be dealt this turn to up to two target creatures. id=9716 diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index d060bf33c..00ed373fe 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -63,6 +63,7 @@ composite_golem.txt control_magic.txt control_magic2.txt control_magic3.txt +corrupt.txt counsel_of_the_soratami.txt counterspell.txt counterspell2.txt @@ -104,6 +105,8 @@ hannas_custody.txt howl_of_the_night_pack.txt hymn_of_rebirth.txt icatian_priest.txt +imaginary_pet.txt +immaculate_magistrate.txt jump.txt keldon_warlord.txt keldon_warlord2.txt @@ -138,15 +141,20 @@ protomatter_powder.txt pygmy_troll.txt pyroclasm.txt rampant_growth.txt +reclusive_wight.txt +reclusive_wight2.txt recover.txt regal_force.txt resurrection.txt +rhox_meditant.txt +rhox_meditant2.txt righteous_cause.txt rootwalla.txt royal_assassin.txt sedge_sliver.txt seismic_assault.txt siege_gang_commander.txt +shepherd_of_rot.txt shivan_hellkite.txt shock.txt slate_of_ancestry.txt @@ -161,6 +169,7 @@ stasis.txt steelclad_serpent1.txt steelclad_serpent2.txt stillmoon_cavalier.txt +stronghold_discipline.txt sword_to_plowshares.txt telekinetic_sliver.txt terror.txt diff --git a/projects/mtg/bin/Res/test/corrupt.txt b/projects/mtg/bin/Res/test/corrupt.txt new file mode 100644 index 000000000..58152c285 --- /dev/null +++ b/projects/mtg/bin/Res/test/corrupt.txt @@ -0,0 +1,20 @@ +#Bug: corrupt does not damage player +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:8331,8330,8332 +hand:Corrupt +manapool:{5}{B} +[PLAYER2] +[DO] +corrupt +p2 +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:8331,8330,8332 +graveyard:Corrupt +life:23 +[PLAYER2] +life:17 +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/imaginary_pet.txt b/projects/mtg/bin/Res/test/imaginary_pet.txt new file mode 100644 index 000000000..c2d705419 --- /dev/null +++ b/projects/mtg/bin/Res/test/imaginary_pet.txt @@ -0,0 +1,17 @@ +#Bug: Imaginary pet does not work +[INIT] +SECONDMAIN +[PLAYER1] +[PLAYER2] +inplay:imaginary pet +hand:forest +[DO] +eot +next +next +[ASSERT] +DRAW +[PLAYER1] +[PLAYER2] +hand:forest,imaginary pet +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/immaculate_magistrate.txt b/projects/mtg/bin/Res/test/immaculate_magistrate.txt new file mode 100644 index 000000000..2cdb9c5ad --- /dev/null +++ b/projects/mtg/bin/Res/test/immaculate_magistrate.txt @@ -0,0 +1,27 @@ +#Bug:immaculate magistrate puts counters on itself instead of target +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:immaculate magistrate,llanowar elves,grizzly bears +[PLAYER2] +[DO] +immaculate magistrate +grizzly bears +next +#begin +next +#attackers +grizzly bears +next +#blockers +next +#damge +next +#combatend +[ASSERT] +COMBATEND +[PLAYER1] +inplay:immaculate magistrate,llanowar elves,grizzly bears +[PLAYER2] +life:16 +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/reclusive_wight.txt b/projects/mtg/bin/Res/test/reclusive_wight.txt new file mode 100644 index 000000000..eb03e098f --- /dev/null +++ b/projects/mtg/bin/Res/test/reclusive_wight.txt @@ -0,0 +1,16 @@ +#Bug:Reclusive Wight does not work +[INIT] +SECONDMAIN +[PLAYER1] +[PLAYER2] +inplay:reclusive wight,forest +[DO] +eot +next +next +[ASSERT] +DRAW +[PLAYER1] +[PLAYER2] +inplay:reclusive wight,forest +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/reclusive_wight2.txt b/projects/mtg/bin/Res/test/reclusive_wight2.txt new file mode 100644 index 000000000..ef9502322 --- /dev/null +++ b/projects/mtg/bin/Res/test/reclusive_wight2.txt @@ -0,0 +1,17 @@ +#Bug:Reclusive Wight does not work +[INIT] +SECONDMAIN +[PLAYER1] +[PLAYER2] +inplay:reclusive wight,forest,grizzly bears +[DO] +eot +next +next +[ASSERT] +DRAW +[PLAYER1] +[PLAYER2] +inplay:forest,grizzly bears +graveyard:reclusive wight +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/rhox_meditant.txt b/projects/mtg/bin/Res/test/rhox_meditant.txt new file mode 100644 index 000000000..2dd145a8d --- /dev/null +++ b/projects/mtg/bin/Res/test/rhox_meditant.txt @@ -0,0 +1,18 @@ +#Bug:Rhox meditant does not work +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:grizzly bears +hand:rhox meditant +manapool:{3}{W} +library:forest +[PLAYER2] +[DO] +rhox meditant +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:grizzly bears,rhox meditant +hand:forest +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/rhox_meditant2.txt b/projects/mtg/bin/Res/test/rhox_meditant2.txt new file mode 100644 index 000000000..bd09bb88d --- /dev/null +++ b/projects/mtg/bin/Res/test/rhox_meditant2.txt @@ -0,0 +1,17 @@ +#Bug:Rhox meditant does not work +[INIT] +FIRSTMAIN +[PLAYER1] +hand:rhox meditant +manapool:{3}{W} +library:forest +[PLAYER2] +[DO] +rhox meditant +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:rhox meditant +library:forest +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/shepherd_of_rot.txt b/projects/mtg/bin/Res/test/shepherd_of_rot.txt new file mode 100644 index 000000000..43a4e365c --- /dev/null +++ b/projects/mtg/bin/Res/test/shepherd_of_rot.txt @@ -0,0 +1,18 @@ +#Bug:shepherd of rot only damages one player +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:shepherd of rot +[PLAYER2] +inplay:Bog raiders +[DO] +shepherd of rot +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:shepherd of rot +life:18 +[PLAYER2] +inplay:Bog raiders +life:18 +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/stronghold_discipline.txt b/projects/mtg/bin/Res/test/stronghold_discipline.txt new file mode 100644 index 000000000..d63ba1d6f --- /dev/null +++ b/projects/mtg/bin/Res/test/stronghold_discipline.txt @@ -0,0 +1,21 @@ +#Bug: stronghold discipline does not do correct damae +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:grizzly bears,dragon engine +hand:stronghold discipline +manapool:{2}{B}{B} +[PLAYER2] +inplay:raging goblin +[DO] +stronghold discipline +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:grizzly bears,dragon engine +graveyard:stronghold discipline +life:18 +[PLAYER2] +inplay:raging goblin +life:19 +[END] \ No newline at end of file diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 5254e4229..8e41cb3d8 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1472,7 +1472,7 @@ class AAsLongAs:public ListMaintainerAbility{ MTGAbility * ability; MTGAbility * a; int includeSelf; - AAsLongAs(int _id, MTGCardInstance * _source, TargetChooser * _tc, int _includeSelf, MTGAbility * a):ListMaintainerAbility(_id, _source),ability(a){ + AAsLongAs(int _id, MTGCardInstance * _source, Damageable * _target, TargetChooser * _tc, int _includeSelf, MTGAbility * a):ListMaintainerAbility(_id, _source,_target),ability(a){ tc = _tc; includeSelf = _includeSelf; tc->targetter = NULL; @@ -1495,18 +1495,31 @@ class AAsLongAs:public ListMaintainerAbility{ } - int added(MTGCardInstance * card){ + int _added(Damageable * d){ if (cards.size()== 1){ - a = ability->clone(); + a = ability->clone(); + if (a->oneShot){ + a->resolve(); + SAFE_DELETE(a); + }else{ a->addToGame(); - return 1; } - return 0; - } + return 1; + } + return 0; + } + + int added(MTGCardInstance * card){ + return _added(card); + } + + int added(Player * p){ + return _added(p); + } + int removed(MTGCardInstance * card){ - - if (cards.size()== 0){ + if (cards.size()== 0 && a){ game->removeObserver(a); a = NULL; return 1; @@ -1606,7 +1619,7 @@ class AForeach:public ListMaintainerAbility{ MTGAbility * ability; int includeSelf; map abilities; - AForeach(int _id, MTGCardInstance * card,MTGCardInstance * _target, TargetChooser * _tc, int _includeSelf, MTGAbility * a):ListMaintainerAbility(_id,card,_target), ability(a){ + AForeach(int _id, MTGCardInstance * card,Damageable * _target, TargetChooser * _tc, int _includeSelf, MTGAbility * a):ListMaintainerAbility(_id,card,_target), ability(a){ tc = _tc; tc->targetter = NULL; includeSelf = _includeSelf; @@ -1620,6 +1633,7 @@ class AForeach:public ListMaintainerAbility{ int added(MTGCardInstance * card){ MTGAbility * a = ability->clone(); + a->target = target; if (a->oneShot){ a->resolve(); delete(a); diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 2b2e9fe00..fe262eca7 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -262,10 +262,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG if (card->hasType("sorcery") || card->hasType("instant")) oneShot = 1; if (i == 3) oneShot = 1; if (a->oneShot) oneShot = 1; + Damageable * _target = spell->getNextDamageableTarget(); + if (!_target) _target = target; switch(i){ case 0: result = NEW ALord(id, card, lordTargets, lordIncludeSelf, a); break; - case 1: result = NEW AForeach(id, card, target,lordTargets, lordIncludeSelf, a); break; - case 2: result = NEW AAsLongAs(id, card, lordTargets, lordIncludeSelf, a); break; + case 1: result = NEW AForeach(id, card, _target,lordTargets, lordIncludeSelf, a); break; + case 2: result = NEW AAsLongAs(id, card, _target,lordTargets, lordIncludeSelf, a); break; case 3: result = NEW ALord(id, card, lordTargets, lordIncludeSelf, a); break; default: result = NULL; }