diff --git a/projects/mtg/include/GameObserver.h b/projects/mtg/include/GameObserver.h index 48ae903e4..2f520043c 100644 --- a/projects/mtg/include/GameObserver.h +++ b/projects/mtg/include/GameObserver.h @@ -125,8 +125,6 @@ class GameObserver{ void enchantmentStatus(); void Affinity(); bool AffinityNeedsUpdate; - bool foundlegendrule; - void checkLegendary(MTGCardInstance * card); void addObserver(MTGAbility * observer); bool removeObserver(ActionElement * observer); void startGame(GameType, Rules * rules); diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index eb5381452..292eb3d08 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -110,7 +110,6 @@ GameObserver::GameObserver(WResourceManager *output, JGE* input) mLayers = NULL; mTrash = new Trash(); mDeckManager = new DeckManager(); - foundlegendrule = false; } GamePhase GameObserver::getCurrentGamePhase() @@ -889,7 +888,6 @@ void GameObserver::gameStateBasedEffects() if(card->life < 1 && !card->has(Constants::INDESTRUCTIBLE)) card->destroy();//manor gargoyle... recheck } - checkLegendary(card); //legendary rule as state based effect } if(card->childrenCards.size()) @@ -1065,51 +1063,6 @@ void GameObserver::gameStateBasedEffects() } } -void GameObserver::checkLegendary(MTGCardInstance * card) -{ - if(!foundlegendrule) - return; - if(card->isPhased||card->has(Constants::NOLEGEND)||card->controller()->opponent()->inPlay()->hasAbility(Constants::NOLEGENDRULE)||card->controller()->inPlay()->hasAbility(Constants::NOLEGENDRULE)) - return; - int destroy = 0; - vectoroldCards; - - MTGGameZone * z = card->controller()->game->inPlay; - int nbcards = z->nb_cards-1; - - for (int r = 0; r < nbcards; r++) - { - MTGCardInstance * comparison = z->cards[r]; - if (comparison != card && comparison->hasType("legendary") && !(comparison->getName().compare(card->getName()))) - { - oldCards.push_back(comparison); - destroy = 1; - } - } - - if(destroy) - { - vectorselection; - MultiAbility * multi = NEW MultiAbility(this, this->mLayers->actionLayer()->getMaxId(), card, card, NULL); - for(unsigned int i = 0;i < oldCards.size();i++) - { - AAMover *a = NEW AAMover(this, this->mLayers->actionLayer()->getMaxId(), card, oldCards[i],"ownergraveyard","Keep New"); - a->oneShot = true; - multi->Add(a); - } - multi->oneShot = 1; - MTGAbility * a1 = multi; - selection.push_back(a1); - AAMover *b = NEW AAMover(this, this->mLayers->actionLayer()->getMaxId(), card, card,"ownergraveyard","Keep Old"); - b->oneShot = true; - MTGAbility * b1 = b; - selection.push_back(b1); - MTGAbility * menuChoice = NEW MenuAbility(this, this->mLayers->actionLayer()->getMaxId(), card, card,true,selection,card->controller(),"Legendary Rule"); - menuChoice->addToGame(); - } - return; -} - void GameObserver::enchantmentStatus() { for (int i = 0; i < 2; i++) diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 2e8095bd6..b93383c0f 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -1418,7 +1418,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG if(found != string::npos) { observer->addObserver(NEW MTGLegendRule(observer, -1)); - //observer->foundlegendrule = true; return NULL; } //this handles the planeswalker named legend rule which is dramatically different from above. diff --git a/projects/mtg/src/MTGRules.cpp b/projects/mtg/src/MTGRules.cpp index e78f1f4b6..bbd92a56f 100644 --- a/projects/mtg/src/MTGRules.cpp +++ b/projects/mtg/src/MTGRules.cpp @@ -3239,6 +3239,12 @@ int MTGLegendRule::added(MTGCardInstance * card) destroy = 1; } } + if (game->mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0) + destroy = 0; + if (game->mLayers->actionLayer()->menuObject) + destroy = 0; + if (game->getCurrentTargetChooser() || game->mLayers->actionLayer()->isWaitingForAnswer()) + destroy = 0; if(destroy) { vectorselection; @@ -3313,6 +3319,12 @@ int MTGPlaneWalkerRule::added(MTGCardInstance * card) destroy = 1; } } + if (game->mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0) + destroy = 0; + if (game->mLayers->actionLayer()->menuObject) + destroy = 0; + if (game->getCurrentTargetChooser() || game->mLayers->actionLayer()->isWaitingForAnswer()) + destroy = 0; if (destroy) { vectorselection;