diff --git a/projects/mtg/bin/Res/test/Nyxathid.txt b/projects/mtg/bin/Res/test/Nyxathid.txt new file mode 100644 index 000000000..244c82f83 --- /dev/null +++ b/projects/mtg/bin/Res/test/Nyxathid.txt @@ -0,0 +1,36 @@ +#text=As Nyxathid comes into play, choose an opponent. Nyxathid gets -1/-1 for each card in the chosen player's hand. +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:186616 +[PLAYER2] +hand:179434 +library:185140 +[DO] +eot +eot +next +#upkeep +next +#draw +next +#main +next +#combat begin +next +#attackers +186616 +next +#blockers +next +#damage +next +#combat end +[ASSERT] +COMBATEND +[PLAYER1] +inplay:186616 +[PLAYER2] +hand:179434,185140 +life:15 +[END] \ No newline at end of file diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 38b9def24..5399f9cf3 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -63,6 +63,7 @@ living_lands.txt lord_of_the_pit.txt lord_of_the_pit2.txt nantuko_husk.txt +Nyxathid.txt orcish_lumberjack.txt paralysis.txt paralysis2.txt diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index 991cc64fc..2bff49ee0 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -354,8 +354,12 @@ void MTGLibrary::shuffleTopToBottom(int nbcards){ } MTGGameZone * MTGGameZone::stringToZone(string zoneName, MTGCardInstance * source,MTGCardInstance * target){ - Player * p = source->controller(); - Player * p2 = target->controller(); + Player *p, *p2; + GameObserver * g = GameObserver::GetInstance(); + if (!source) p = g->currentlyActing(); + else p = source->controller(); + if (!target) p2 = p; + else p2 = target->controller(); if(zoneName.compare("mygraveyard") == 0)return p->game->graveyard; if(zoneName.compare("opponentgraveyard") == 0) return p->opponent()->game->graveyard; if(zoneName.compare("targetownergraveyard") == 0) return target->owner->game->graveyard; diff --git a/projects/mtg/src/TargetChooser.cpp b/projects/mtg/src/TargetChooser.cpp index 1f53c65ad..54b9149f4 100644 --- a/projects/mtg/src/TargetChooser.cpp +++ b/projects/mtg/src/TargetChooser.cpp @@ -42,29 +42,20 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta zoneName = s2; s2 = ""; } + zones[nbzones] = game->currentlyActing()->game->inPlay; + //Graveyards - if (zoneName.compare("mygraveyard") == 0){ - zones[nbzones] = game->currentlyActing()->game->graveyard; - }else if(zoneName.compare("opponentgraveyard") == 0){ - zones[nbzones] = game->currentlyActing()->opponent()->game->graveyard; - }else if(zoneName.compare("graveyard") == 0){ + if(zoneName.compare("graveyard") == 0){ zones[nbzones] = game->players[0]->game->graveyard; nbzones++; zones[nbzones] = game->players[1]->game->graveyard; - }else{ - - //inPlay - if (zoneName.compare("myinplay") == 0){ - zones[nbzones] = game->currentlyActing()->game->inPlay; - }else if(zoneName.compare("opponentinplay") == 0){ - zones[nbzones] = game->currentlyActing()->opponent()->game->inPlay; - }else if(zoneName.compare("inplay") == 0){ + }else if(zoneName.compare("inplay") == 0){ zones[nbzones] = game->players[0]->game->inPlay; nbzones++; zones[nbzones] = game->players[1]->game->inPlay; - }else{ - zones[nbzones] = game->currentlyActing()->game->inPlay; - } + }else{ + MTGGameZone * zone = MTGGameZone::stringToZone(zoneName, card,card); + if (zone) zones[nbzones] = zone; } nbzones++; }