fix hang aicode ability controller

aicode should be dedicated for AI only...
This commit is contained in:
Anthony Calosa
2017-02-11 18:25:45 +08:00
parent e74921cbdf
commit 3afcc7fdf9
2 changed files with 13 additions and 11 deletions
+12
View File
@@ -54,6 +54,18 @@ GenericRevealAbility::GenericRevealAbility(GameObserver* observer, int id, MTGCa
int GenericRevealAbility::resolve()
{
if(source->lastController->isAI() && source->getAICustomCode().size())
{
string abi = source->getAICustomCode();
std::transform(abi.begin(), abi.end(), abi.begin(), ::tolower);//fix crash
AbilityFactory af(game);
MTGAbility * a3 = af.parseMagicLine(abi, this->GetId(), NULL, source);
a3->oneShot = 1;
a3->canBeInterrupted = false;
a3->resolve();
SAFE_DELETE(a3);
return 1;
}
MTGAbility * ability = NEW MTGRevealingCards(game, this->GetId(), source, howMany);
ability->addToGame();
return 1;