From c70762f871280d192b3bc78238e614b30a89e4c6 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Thu, 16 Feb 2017 02:39:03 +0800 Subject: [PATCH] readded modified rule --- projects/mtg/include/GameObserver.h | 1 + projects/mtg/src/AllAbilities.cpp | 2 +- projects/mtg/src/GameObserver.cpp | 3 +++ projects/mtg/src/MTGRules.cpp | 26 ++++++++++++++------------ 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/projects/mtg/include/GameObserver.h b/projects/mtg/include/GameObserver.h index a658f4396..6e2bc01e6 100644 --- a/projects/mtg/include/GameObserver.h +++ b/projects/mtg/include/GameObserver.h @@ -142,6 +142,7 @@ class GameObserver{ int receiveEvent(WEvent * event); bool connectRule; + bool LPWeffect; void logAction(Player* player, const string& s=""); void logAction(int playerId, const string& s="") { diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 9bc10a671..1ca746761 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -192,7 +192,7 @@ void MTGRevealingCards::Update(float dt) //if any carddisplays are open, dont do anything until theyre closed, then wait your turn if multiple reveals trigger. return; } - if (game->mLayers->actionLayer()->menuObject) + if (game->mLayers->actionLayer()->menuObject || game->LPWeffect) return;//dont do any of this if a menuobject exist. if (!source->getObserver()->mLayers->actionLayer()->getCurrentTargetChooser() && !revealDisplay && !initCD) { diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 94d6397af..c891c4c0d 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -50,6 +50,7 @@ void GameObserver::cleanup() replacementEffects = NEW ReplacementEffects(); combatStep = BLOCKERS; connectRule = false; + LPWeffect = false; actionsList.clear(); gameTurn.clear(); OpenedDisplay = NULL; @@ -106,6 +107,7 @@ GameObserver::GameObserver(WResourceManager *output, JGE* input) combatStep = BLOCKERS; mRules = NULL; connectRule = false; + LPWeffect = false; mLoading = false; mLayers = NULL; mTrash = new Trash(); @@ -1052,6 +1054,7 @@ void GameObserver::gameStateBasedEffects() userRequestNextGamePhase(); } + this->LPWeffect = false; //WEventGameStateBasedChecked event checked receiveEvent(NEW WEventGameStateBasedChecked()); } diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index a8bcbcbf3..d838ecb96 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -3257,17 +3257,18 @@ int MTGLegendRule::added(MTGCardInstance * card) { map::iterator it; int destroy = 0; - vectoroldCards; + //vectoroldCards; for (it = cards.begin(); it != cards.end(); it++) { MTGCardInstance * comparison = (*it).first; if (comparison != card && comparison->controller() == card->controller() && !(comparison->getName().compare(card->getName()))) if (!(game->getCurrentTargetChooser() || game->mLayers->actionLayer()->isWaitingForAnswer())) { - oldCards.push_back(comparison); + //oldCards.push_back(comparison); destroy = 1; + game->LPWeffect = true; } - }/* + } if(destroy) { vectorselection; @@ -3290,9 +3291,9 @@ int MTGLegendRule::added(MTGCardInstance * card) SAFE_DELETE(LegendruleGeneric); MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), NULL, myClone,true,selection,card->controller(),"Legendary Rule"); menuChoice->addToGame(); - }*/ + } //reverted to old since this new code conflicts with reveal targetchooser - if(destroy) + /*if(destroy) { vectorselection; MultiAbility * multi = NEW MultiAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card, NULL); @@ -3311,7 +3312,7 @@ int MTGLegendRule::added(MTGCardInstance * card) selection.push_back(b1); MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card,true,selection,card->controller(),"Legendary Rule"); menuChoice->addToGame(); - } + }*/ return 1; } @@ -3360,17 +3361,18 @@ int MTGPlaneWalkerRule::added(MTGCardInstance * card) { map::iterator it; int destroy = 0; - vectoroldCards; + //vectoroldCards; for (it = cards.begin(); it != cards.end(); it++) { MTGCardInstance * comparison = (*it).first; if (comparison != card && comparison->types == card->types && comparison->controller() == card->controller()) if (!(game->getCurrentTargetChooser() || game->mLayers->actionLayer()->isWaitingForAnswer())) { - oldCards.push_back(comparison); + //oldCards.push_back(comparison); destroy = 1; + game->LPWeffect = true; } - }/* + } if (destroy) { vectorselection; @@ -3393,9 +3395,9 @@ int MTGPlaneWalkerRule::added(MTGCardInstance * card) SAFE_DELETE(PWruleGeneric); MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), NULL, myClone,true,selection,card->controller(),"Planeswalker Uniqueness Rule"); menuChoice->addToGame(); - }*/ + } //reverted to old since this new code conflicts with reveal targetchooser - if (destroy) + /*if (destroy) { vectorselection; @@ -3415,7 +3417,7 @@ int MTGPlaneWalkerRule::added(MTGCardInstance * card) selection.push_back(b1); MTGAbility * menuChoice = NEW MenuAbility(game, game->mLayers->actionLayer()->getMaxId(), card, card,true,selection,card->controller(),"Planeswalker Rule"); menuChoice->addToGame(); - } + }*/ return 1; }