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

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;

View File

@@ -3684,17 +3684,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
a->oneShot = 1;
a->canBeInterrupted = false;
a->named = newName;
if(card->getAICustomCode().size() && card->controller()->isAI())
{
string abi = card->getAICustomCode();
std::transform(abi.begin(), abi.end(), abi.begin(), ::tolower);//fix crash
MTGAbility * a3 = parseMagicLine(abi, id, spell, card);
a3->oneShot = 1;
a3->canBeInterrupted = false;
return a3;
}
else
return a;
return a;
}
//scry:x (activate aility)