aicode and revised legendary rule
added aicode for cards that uses reveal. since reveal cancels for ai, aicode is the alternative code. use basic code only. aicode=activate dosomething... aicode - use with caution, its very basic atm and you must test each card that uses it as it can cause crash. legendary rule moved to game state based effect so it will not conflict with cards with copy effects and andability. the legendary check applies only when legendrule is found.
This commit is contained in:
@@ -110,6 +110,7 @@ GameObserver::GameObserver(WResourceManager *output, JGE* input)
|
||||
mLayers = NULL;
|
||||
mTrash = new Trash();
|
||||
mDeckManager = new DeckManager();
|
||||
foundlegendrule = false;
|
||||
}
|
||||
|
||||
GamePhase GameObserver::getCurrentGamePhase()
|
||||
@@ -880,6 +881,7 @@ 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())
|
||||
@@ -935,7 +937,6 @@ void GameObserver::gameStateBasedEffects()
|
||||
p->nomaxhandsize = true;
|
||||
else
|
||||
p->nomaxhandsize = false;
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
//handle end of turn effects while we're at it.//
|
||||
/////////////////////////////////////////////////
|
||||
@@ -1055,6 +1056,51 @@ void GameObserver::gameStateBasedEffects()
|
||||
}
|
||||
}
|
||||
|
||||
void GameObserver::checkLegendary(MTGCardInstance * card)
|
||||
{
|
||||
if(!foundlegendrule)
|
||||
return;
|
||||
if(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()
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
|
||||
Reference in New Issue
Block a user