From 79d0a09de18a9e866f18f9314afbf06330c36e59 Mon Sep 17 00:00:00 2001 From: "wagic.the.homebrew@gmail.com" Date: Sun, 5 Jul 2009 11:38:12 +0000 Subject: [PATCH] Erwan - fix a bug with Arcanis the omnipotent (see tests) --- projects/mtg/bin/Res/test/_tests.txt | 2 ++ .../bin/Res/test/arcanis_the_omnipotent.txt | 18 ++++++++++++ .../bin/Res/test/arcanis_the_omnipotent2.txt | 28 +++++++++++++++++++ projects/mtg/src/MTGAbility.cpp | 28 +++++++++---------- 4 files changed, 62 insertions(+), 14 deletions(-) create mode 100644 projects/mtg/bin/Res/test/arcanis_the_omnipotent.txt create mode 100644 projects/mtg/bin/Res/test/arcanis_the_omnipotent2.txt diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index fa931dad5..15be1256c 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -26,6 +26,8 @@ animate_dead.txt animate_dead2.txt animate_dead3.txt ankh_of_mishra.txt +arcanis_the_omnipotent.txt +arcanis_the_omnipotent2.txt ardakar_wastes.txt ascendant_evincar.txt ascendant_evincar2.txt diff --git a/projects/mtg/bin/Res/test/arcanis_the_omnipotent.txt b/projects/mtg/bin/Res/test/arcanis_the_omnipotent.txt new file mode 100644 index 000000000..bbfafb958 --- /dev/null +++ b/projects/mtg/bin/Res/test/arcanis_the_omnipotent.txt @@ -0,0 +1,18 @@ +#Bug: Arcanis the Omnipotent: draws 3 cards when comes into play, then canft use gDrawh ability +[INIT] +FIRSTMAIN +[PLAYER1] +hand:Arcanis the Omnipotent +library:swamp,plains,mountain +manapool:{3}{U}{U}{U} +[PLAYER2] +[DO] +Arcanis the Omnipotent +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:Arcanis the Omnipotent +library:swamp,plains,mountain +manapool:{0} +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/arcanis_the_omnipotent2.txt b/projects/mtg/bin/Res/test/arcanis_the_omnipotent2.txt new file mode 100644 index 000000000..e892cb801 --- /dev/null +++ b/projects/mtg/bin/Res/test/arcanis_the_omnipotent2.txt @@ -0,0 +1,28 @@ +#Bug: Arcanis the Omnipotent: draws 3 cards when comes into play, then canft use gDrawh ability +[INIT] +FIRSTMAIN +[PLAYER1] +hand:Arcanis the Omnipotent +library:swamp,plains,mountain,forest +manapool:{3}{U}{U}{U} +[PLAYER2] +[DO] +Arcanis the Omnipotent +eot +eot +#untap +next +#upkeep +next +#draw +next +#main +Arcanis the Omnipotent +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:Arcanis the Omnipotent +hand:swamp,plains,mountain,forest +manapool:{0} +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 674538163..bdfb73c42 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -733,20 +733,20 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){ int multiplier = countCards(lordTargets); game->mLayers->stackLayer()->addDraw(card->controller(),multiplier);; }else{ - if (trigger){ - DrawEvent * action = NEW DrawEvent(card->controller(),nbcards); - game->addObserver(NEW GenericTriggeredAbility(id, card,trigger,action)); - }else{ - if (tc){ - //TODO ? - }else{ - if (!cost){ - game->mLayers->stackLayer()->addDraw(card->controller(),nbcards); - }else{ - game->addObserver(NEW ADrawer(id,card,cost,nbcards,doTap)); - } - } - } + if (trigger){ + DrawEvent * action = NEW DrawEvent(card->controller(),nbcards); + game->addObserver(NEW GenericTriggeredAbility(id, card,trigger,action)); + }else{ + if (tc){ + //TODO ? + }else{ + if (cost || doTap){ + game->addObserver(NEW ADrawer(id,card,cost,nbcards,doTap)); + }else{ + game->mLayers->stackLayer()->addDraw(card->controller(),nbcards); + } + } + } } result++; continue;