diff --git a/projects/mtg/bin/Res/sets/ARB/_cards.dat b/projects/mtg/bin/Res/sets/ARB/_cards.dat index 9db513007..12f23caec 100644 --- a/projects/mtg/bin/Res/sets/ARB/_cards.dat +++ b/projects/mtg/bin/Res/sets/ARB/_cards.dat @@ -149,7 +149,7 @@ id=189648 rarity=M [/card] [card] -primitive=Dragon Token from Dragon Broodmother +primitive=Dragon id=22222220 rarity=T [/card] diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 41862fd85..f7a6f5ff8 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -13681,7 +13681,7 @@ toughness=4 abilities=flying [/card] [card] -name=Dragon Token from Dragon Broodmother +name=Dragon type=Creature subtype=Dragon abilities=flying diff --git a/projects/mtg/bin/Res/test/bugs/dragon_broodmother_i491.txt b/projects/mtg/bin/Res/test/bugs/dragon_broodmother_i491.txt new file mode 100644 index 000000000..c3ff0d916 --- /dev/null +++ b/projects/mtg/bin/Res/test/bugs/dragon_broodmother_i491.txt @@ -0,0 +1,28 @@ +#Bug: "new school" Tokens can't have two colors + +[INIT] +UNTAP +[PLAYER1] +inplay:mountain +hand:shock +[PLAYER2] +inplay:dragon broodmother,Boartusk Liege +[DO] +next +#upkeep +choice 1 +next +#draw +next +#main +mountain +shock +Dragon +[ASSERT] +FIRSTMAIN +[PLAYER1] +graveyard:shock +inplay:mountain +[PLAYER2] +inplay:dragon broodmother,Boartusk Liege,* +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/bugs/souls_attendant_i489.txt b/projects/mtg/bin/Res/test/bugs/souls_attendant_i489.txt new file mode 100644 index 000000000..28ab061a9 --- /dev/null +++ b/projects/mtg/bin/Res/test/bugs/souls_attendant_i489.txt @@ -0,0 +1,18 @@ +#Bug: Triggers are "targetting", making Black Knight immune to soul's attendant ability +# http://code.google.com/p/wagic/issues/detail?id=489 +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:soul's attendant +hand:black knight +manapool:{B}{B} +[PLAYER2] +[DO] +black knight +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:soul's attendant,black knight +life:21 +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/include/TestSuiteAI.h b/projects/mtg/include/TestSuiteAI.h index 693d83219..cb4f1d61d 100644 --- a/projects/mtg/include/TestSuiteAI.h +++ b/projects/mtg/include/TestSuiteAI.h @@ -91,6 +91,7 @@ class TestSuiteAI:public AIPlayerBaka{ TestSuiteAI(TestSuite * suite, int playerId); virtual int Act(float dt); + MTGCardInstance * getCard(string action); virtual int displayStack(); }; diff --git a/projects/mtg/src/Credits.cpp b/projects/mtg/src/Credits.cpp index fe0490e5b..3662babab 100644 --- a/projects/mtg/src/Credits.cpp +++ b/projects/mtg/src/Credits.cpp @@ -27,6 +27,8 @@ unlockedTex = NULL; unlockedQuad = NULL; unlocked = -1; + p1 = NULL; + p2 = NULL; } Credits::~Credits(){ @@ -168,6 +170,7 @@ void Credits::compute(Player * _p1, Player * _p2, GameApp * _app){ } void Credits::Render(){ + if (!p1) return; GameObserver * g = GameObserver::GetInstance(); JRenderer * r = JRenderer::GetInstance(); WFont * f = resources.GetWFont(Constants::MAIN_FONT); diff --git a/projects/mtg/src/TestSuiteAI.cpp b/projects/mtg/src/TestSuiteAI.cpp index e7572a74b..d06702a2c 100644 --- a/projects/mtg/src/TestSuiteAI.cpp +++ b/projects/mtg/src/TestSuiteAI.cpp @@ -1,5 +1,6 @@ #include "../include/TestSuiteAI.h" #include "../include/config.h" +#include "../include/DebugRoutines.h" #include "../include/MTGAbility.h" #include "../include/MTGRules.h" #include "../include/ActionLayer.h" @@ -23,6 +24,31 @@ TestSuiteAI::TestSuiteAI(TestSuite * _suite, int playerId):AIPlayerBaka(NULL, "t } +MTGCardInstance * TestSuiteAI::getCard(string action){ + int mtgid = Rules::getMTGId(action); + if (mtgid) return Rules::getCardByMTGId(mtgid); + + //This mostly handles tokens + GameObserver * g = GameObserver::GetInstance(); + std::transform(action.begin(), action.end(), action.begin(),::tolower ); + for (int i = 0; i < 2; i++){ + Player * p = g->players[i]; + MTGGameZone * zones[] = {p->game->library,p->game->hand, p->game->inPlay, p->game->graveyard}; + for (int j = 0; j < 4; j++){ + MTGGameZone * zone = zones[j]; + for (int k = 0; k < zone->nb_cards; k++){ + MTGCardInstance * card = zone->cards[k]; + if (!card) return NULL; + string name = card->getLCName(); + if (name.compare(action) == 0) return card; + } + } + } + DebugTrace("TESTUISTEAI: Can't find card:" << action.c_str()); + return NULL; +} + + Interruptible * TestSuite::getActionByMTGId(int mtgid){ ActionStack * as= GameObserver::GetInstance()->mLayers->stackLayer(); Interruptible * action = NULL; @@ -125,29 +151,31 @@ int TestSuiteAI::Act(float dt){ g->cardClick(NULL, p); }else{ int mtgid = Rules::getMTGId(action); + Interruptible * toInterrupt = NULL; if (mtgid){ char buffe[512]; sprintf(buffe, "TESTSUITE CARD ID : %i\n", mtgid); OutputDebugString(buffe); - Interruptible * toInterrupt = suite->getActionByMTGId(mtgid); - if (toInterrupt) - g->stackObjectClicked(toInterrupt); - else{ - MTGCardInstance * card = Rules::getCardByMTGId(mtgid); - if (card) { - OutputDebugString("TESTSUITE Clicking ON: "); - OutputDebugString(card->name.c_str()); - OutputDebugString("\n"); - card->currentZone->needShuffle = true; //mimic library shuffle - g->cardClick(card,card); - g->forceShuffleLibraries(); //mimic library shuffle - } - } - }else{ - return 0; + toInterrupt = suite->getActionByMTGId(mtgid); + } + + if (toInterrupt) { + g->stackObjectClicked(toInterrupt); + return 1; + } + + MTGCardInstance * card = getCard(action); + if (card) { + OutputDebugString("TESTSUITE Clicking ON: "); + OutputDebugString(card->name.c_str()); + OutputDebugString("\n"); + card->currentZone->needShuffle = true; //mimic library shuffle + g->cardClick(card,card); + g->forceShuffleLibraries(); //mimic library shuffle + return 1; } } - return 1; + return 0; }