From 2c1a44ed43959efdac7b360bcd99ebdb7898a83f Mon Sep 17 00:00:00 2001 From: "wagic.the.homebrew@gmail.com" Date: Thu, 22 Oct 2009 13:08:33 +0000 Subject: [PATCH] Erwan -fix for issue 123 (Cockatrice) --- projects/mtg/bin/Res/test/_tests.txt | 1 + projects/mtg/bin/Res/test/cockatrice.txt | 24 ++++++++++++++++++++++++ projects/mtg/src/MTGCardInstance.cpp | 14 +++++++------- 3 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 projects/mtg/bin/Res/test/cockatrice.txt diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 220281113..4d5ced4cf 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -77,6 +77,7 @@ circle_of_protection.txt civic_wayfinder.txt clone.txt clone2.txt +cockatrice.txt composite_golem.txt control_magic.txt control_magic2.txt diff --git a/projects/mtg/bin/Res/test/cockatrice.txt b/projects/mtg/bin/Res/test/cockatrice.txt new file mode 100644 index 000000000..984ebe99a --- /dev/null +++ b/projects/mtg/bin/Res/test/cockatrice.txt @@ -0,0 +1,24 @@ +#Bug:Cockatrice doesn't kill opponent +[INIT] +COMBATATTACKERS +[PLAYER1] +inplay:cockatrice +[PLAYER2] +inplay:Akroma's Memorial,air elemental +[DO] +cockatrice +next +#blockers +air elemental +next +#damage +next +#end combat +[ASSERT] +COMBATEND +[PLAYER1] +graveyard:cockatrice +[PLAYER2] +inplay:Akroma's Memorial +graveyard:air elemental +[END] \ No newline at end of file diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index aee2b54c3..3509a9c1d 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -529,20 +529,20 @@ MTGCardInstance * MTGCardInstance::getNextOpponent(MTGCardInstance * previous){ GameObserver * game = GameObserver::GetInstance(); int foundprevious = 0; if (!previous) foundprevious = 1; - if (attacker && game->currentPlayer->game->inPlay->hasCard(this)){ + if (attacker){ MTGInPlay * inPlay = game->opponent()->game->inPlay; for (int i = 0; i < inPlay->nb_cards; i ++){ MTGCardInstance * current = inPlay->cards[i]; if (current == previous){ - foundprevious = 1; + foundprevious = 1; }else if (foundprevious){ - MTGCardInstance * defensersOpponent = current->isDefenser(); - if (defensersOpponent && (defensersOpponent == this || (banding && defensersOpponent->banding == banding))){ - return current; - } + MTGCardInstance * defensersOpponent = current->isDefenser(); + if (defensersOpponent && (defensersOpponent == this || (banding && defensersOpponent->banding == banding))){ + return current; + } } } - }else if (defenser && game->opponent()->game->inPlay->hasCard(this)){ + }else if (defenser){ MTGInPlay * inPlay = game->currentPlayer->game->inPlay; for (int i = 0; i < inPlay->nb_cards; i ++){ MTGCardInstance * current = inPlay->cards[i];