diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index d2d2020d1..ffca65ab1 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -25,6 +25,7 @@ generic/rampage2.txt generic/regenerate.txt generic/sacrifice.txt generic/summoning_sickness.txt +generic/tokens.txt generic/wither.txt ######################## #Specific Cards diff --git a/projects/mtg/bin/Res/test/generic/tokens.txt b/projects/mtg/bin/Res/test/generic/tokens.txt new file mode 100644 index 000000000..36283dc9a --- /dev/null +++ b/projects/mtg/bin/Res/test/generic/tokens.txt @@ -0,0 +1,39 @@ +#Bug:Segfault in GuiPlay.cpp +[INIT] +SECONDMAIN +[PLAYER1] +inplay:1138 +manapool:{5} +[PLAYER2] +inplay:hypnotic specter +[DO] +1138 +eot +eot +next +#upkeep +next +#draw +next +#main +next +#combat begins +next +#attackers +-1138 +next +#blockers +hypnotic specter +next +#damage +next +#end combat +eot +next +[ASSERT] +UPKEEP +[PLAYER1] +inplay:the hive +[PLAYER2] +inplay:hypnotic specter +[END] \ No newline at end of file diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 1d76e279d..2f2e96e1e 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -104,7 +104,14 @@ void GameObserver::nextGamePhase(){ if (currentGamePhase == Constants::MTG_PHASE_BEFORE_BEGIN){ cleanupPhase(); currentPlayer->canPutLandsIntoPlay = 1; + mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn; + mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn; mLayers->actionLayer()->Update(0); + for (int i=0; i < 2; i++){ + delete (players[i]->game->garbage); + players[i]->game->garbage = NEW MTGGameZone(); + players[i]->game->garbage->setOwner(players[i]); + } combatStep = BLOCKERS; return nextGamePhase(); } @@ -117,14 +124,7 @@ void GameObserver::nextGamePhase(){ //Auto Hand cleaning, in case the player didn't do it himself while(currentPlayer->game->hand->nb_cards > 7) currentPlayer->game->putInGraveyard(currentPlayer->game->hand->cards[0]); - mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn; - mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn; mLayers->actionLayer()->Update(0); - for (int i=0; i < 2; i++){ - delete (players[i]->game->garbage); - players[i]->game->garbage = NEW MTGGameZone(); - players[i]->game->garbage->setOwner(players[i]); - } return nextGamePhase(); } diff --git a/projects/mtg/src/TestSuiteAI.cpp b/projects/mtg/src/TestSuiteAI.cpp index 9a6b9b66b..02a94c114 100644 --- a/projects/mtg/src/TestSuiteAI.cpp +++ b/projects/mtg/src/TestSuiteAI.cpp @@ -454,7 +454,10 @@ int TestSuite::phaseStrToInt(string s){ if (s.compare("secondmain") == 0)return Constants::MTG_PHASE_SECONDMAIN; if (s.compare("endofturn") == 0)return Constants::MTG_PHASE_ENDOFTURN; if (s.compare("cleanup") == 0)return Constants::MTG_PHASE_CLEANUP; - return -1; + OutputDebugString("TESTSUITEAI: Unknown Phase name:"); + OutputDebugString(s.c_str()); + OutputDebugString("\n"); + return Constants::MTG_PHASE_FIRSTMAIN; } void TestSuiteActions::cleanup(){