diff --git a/projects/mtg/include/WEvent.h b/projects/mtg/include/WEvent.h index 890762796..94043218e 100644 --- a/projects/mtg/include/WEvent.h +++ b/projects/mtg/include/WEvent.h @@ -279,6 +279,12 @@ struct WEventCardUnattached : public WEventCardUpdate { virtual Targetable * getTarget(int target); }; +//event when card moves from player/opponent battlefield to player/opponent battlefield +struct WEventCardControllerChange : public WEventCardUpdate { + WEventCardControllerChange(MTGCardInstance * card); + virtual Targetable * getTarget(int target); +}; + std::ostream& operator<<(std::ostream&, const WEvent&); #endif diff --git a/projects/mtg/src/GuiPlay.cpp b/projects/mtg/src/GuiPlay.cpp index 59a5a138c..eee380023 100644 --- a/projects/mtg/src/GuiPlay.cpp +++ b/projects/mtg/src/GuiPlay.cpp @@ -412,6 +412,8 @@ int GuiPlay::receiveEventPlus(WEvent * e) Replace(); else if (dynamic_cast (e)) Replace(); + else if (dynamic_cast (e)) + Replace(); Replace(); return 0; } diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index bcae61f0c..2f0b7027c 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -322,6 +322,7 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone int doCopy = 1; bool shufflelibrary = card->basicAbilities[(int)Constants::SHUFFLELIBRARYDEATH]; + bool inplaytoinplay = false; bool ripToken = false; if (g->players[0]->game->battlefield->hasName("Rest in Peace")||g->players[1]->game->battlefield->hasName("Rest in Peace")) ripToken = true; @@ -362,6 +363,8 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone == g->players[1]->game->inPlay)) { doCopy = 0; + asCopy = true;//don't send zone change event so it will not destroy the GUI when multiple switching of control... + inplaytoinplay = true;//try sending different event... } if (!(copy = from->removeCard(card, doCopy))) @@ -433,6 +436,11 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone WEvent * e = NEW WEventZoneChange(copy, from, to); g->receiveEvent(e); } + if(inplaytoinplay) + { + WEvent * ep = NEW WEventCardControllerChange(copy); + g->receiveEvent(ep); + } return ret; } diff --git a/projects/mtg/src/WEvent.cpp b/projects/mtg/src/WEvent.cpp index bba4fa8ef..4b1db1029 100644 --- a/projects/mtg/src/WEvent.cpp +++ b/projects/mtg/src/WEvent.cpp @@ -165,6 +165,11 @@ WEventCardUnattached::WEventCardUnattached(MTGCardInstance * card) : { } +WEventCardControllerChange::WEventCardControllerChange(MTGCardInstance * card) : + WEventCardUpdate(card) +{ +} + WEventCombatStepChange::WEventCombatStepChange(CombatStep step) : WEvent(), step(step) { @@ -319,6 +324,12 @@ Targetable * WEventCardUnattached::getTarget(int target) return NULL; } +Targetable * WEventCardControllerChange::getTarget(int target) +{ + if (target) return card; + return NULL; +} + std::ostream& WEvent::toString(std::ostream& out) const { return out << "EVENT";