- Partial fix for issue 335. This fixes the general problem of triggers not working in the case @movedTo(Battlefield) from(anywhere), but not the specific case of River kelpie not getting to draw a card after being "persisted"
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-09-23 08:29:35 +00:00
parent 326ecf84b0
commit a6a75af52a
3 changed files with 52 additions and 0 deletions
+1
View File
@@ -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
@@ -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]
+27
View File
@@ -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);