diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index b67b16024..169693998 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -398,6 +398,7 @@ resounding_roar.txt resurrection.txt resuscitate_i210.txt righteous_cause.txt +river_kelpie2_i335.txt rockslide_elemental.txt rootwalla.txt royal_assassin.txt diff --git a/projects/mtg/bin/Res/test/river_kelpie2_i335.txt b/projects/mtg/bin/Res/test/river_kelpie2_i335.txt new file mode 100644 index 000000000..597d4d846 --- /dev/null +++ b/projects/mtg/bin/Res/test/river_kelpie2_i335.txt @@ -0,0 +1,24 @@ +#Bug: moved from Graveyard triggers don't work +# see http://code.google.com/p/wagic/issues/detail?id=335 +# Argivian Restoration: Return target artifact card from your graveyard to the battlefield. +# Whenever River Kelpie or another permanent is put onto the battlefield from a graveyard, draw a card. +[INIT] +FIRSTMAIN +[PLAYER1] +manapool:{2}{U}{U} +inplay:River Kelpie +graveyard:Brass man +hand:Argivian Restoration +library:forest +[PLAYER2] +[DO] +Argivian Restoration +Brass man +[ASSERT] +FIRSTMAIN +[PLAYER1] +inplay:River Kelpie,Brass man +hand:Forest +graveyard:Argivian Restoration +[PLAYER2] +[END] \ No newline at end of file diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index f00b1b6d6..0123a46e2 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -212,7 +212,34 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone MTGCardInstance * ret = copy; + to->addCard(copy); + + + //The "Temp" zone are purely for code purposes, and we don't want the abilities engine to + //Trigger when cards move in this zone + // Additionally, when they mve "from" this zone, + // we trick the engine into believing that they moved from the zone the card was previously in + // See http://code.google.com/p/wagic/issues/detail?id=335 + { + if (to == g->players[0]->game->temp || to == g->players[1]->game->temp){ + //don't send event when moving to temp + return ret; + } + + if (from == g->players[0]->game->temp || from == g->players[1]->game->temp){ + //remove temporary stuff + MTGCardInstance * previous = copy->previous; + MTGCardInstance * previous2 = previous->previous; + from = previous->previousZone; + copy->previous = previous2; + if (previous2) previous2->next = copy; + previous->previous = NULL; + previous->next = NULL; + SAFE_DELETE(previous); + } + } + GameObserver *g = GameObserver::GetInstance(); WEvent * e = NEW WEventZoneChange(copy, from, to); g->receiveEvent(e);