Fix Legend Rule
Should fix the the move to graveyard effect with targetchooser ability...
This commit is contained in:
@@ -125,8 +125,6 @@ class GameObserver{
|
|||||||
void enchantmentStatus();
|
void enchantmentStatus();
|
||||||
void Affinity();
|
void Affinity();
|
||||||
bool AffinityNeedsUpdate;
|
bool AffinityNeedsUpdate;
|
||||||
bool foundlegendrule;
|
|
||||||
void checkLegendary(MTGCardInstance * card);
|
|
||||||
void addObserver(MTGAbility * observer);
|
void addObserver(MTGAbility * observer);
|
||||||
bool removeObserver(ActionElement * observer);
|
bool removeObserver(ActionElement * observer);
|
||||||
void startGame(GameType, Rules * rules);
|
void startGame(GameType, Rules * rules);
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ GameObserver::GameObserver(WResourceManager *output, JGE* input)
|
|||||||
mLayers = NULL;
|
mLayers = NULL;
|
||||||
mTrash = new Trash();
|
mTrash = new Trash();
|
||||||
mDeckManager = new DeckManager();
|
mDeckManager = new DeckManager();
|
||||||
foundlegendrule = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GamePhase GameObserver::getCurrentGamePhase()
|
GamePhase GameObserver::getCurrentGamePhase()
|
||||||
@@ -889,7 +888,6 @@ void GameObserver::gameStateBasedEffects()
|
|||||||
if(card->life < 1 && !card->has(Constants::INDESTRUCTIBLE))
|
if(card->life < 1 && !card->has(Constants::INDESTRUCTIBLE))
|
||||||
card->destroy();//manor gargoyle... recheck
|
card->destroy();//manor gargoyle... recheck
|
||||||
}
|
}
|
||||||
checkLegendary(card); //legendary rule as state based effect
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(card->childrenCards.size())
|
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;
|
|
||||||
vector<MTGCardInstance*>oldCards;
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
vector<MTGAbility*>selection;
|
|
||||||
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()
|
void GameObserver::enchantmentStatus()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
|
|||||||
@@ -1418,7 +1418,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
if(found != string::npos)
|
if(found != string::npos)
|
||||||
{
|
{
|
||||||
observer->addObserver(NEW MTGLegendRule(observer, -1));
|
observer->addObserver(NEW MTGLegendRule(observer, -1));
|
||||||
//observer->foundlegendrule = true;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
//this handles the planeswalker named legend rule which is dramatically different from above.
|
//this handles the planeswalker named legend rule which is dramatically different from above.
|
||||||
|
|||||||
@@ -3239,6 +3239,12 @@ int MTGLegendRule::added(MTGCardInstance * card)
|
|||||||
destroy = 1;
|
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)
|
if(destroy)
|
||||||
{
|
{
|
||||||
vector<MTGAbility*>selection;
|
vector<MTGAbility*>selection;
|
||||||
@@ -3313,6 +3319,12 @@ int MTGPlaneWalkerRule::added(MTGCardInstance * card)
|
|||||||
destroy = 1;
|
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)
|
if (destroy)
|
||||||
{
|
{
|
||||||
vector<MTGAbility*>selection;
|
vector<MTGAbility*>selection;
|
||||||
|
|||||||
Reference in New Issue
Block a user