2 changes
first, subjecting manaproducers built unnested to the same restrictions/limits/sideffects as thier activated ability counterparts... 2nd allowing either "," or " " to be a seperator for the variables in phaseaction so they can be used in transformer "newability" if i recieve another bug about phaseaction, im scrapping it completely and recoding it from the ground up.
This commit is contained in:
@@ -972,8 +972,13 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
DebugTrace("ABILITYFACTORY Error parsing: " << sWithoutTc);
|
DebugTrace("ABILITYFACTORY Error parsing: " << sWithoutTc);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
string limit = "";
|
||||||
//A stupid Special case for ManaProducers because they don't use the stack :(
|
size_t limit_str = sWithoutTc.find("limit:");
|
||||||
|
if (limit_str != string::npos)
|
||||||
|
{
|
||||||
|
limit = sWithoutTc.substr(limit_str + 6);
|
||||||
|
}
|
||||||
|
////A stupid Special case for ManaProducers, becuase Ai only understands manaabilities that are not nested.
|
||||||
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
|
AManaProducer * amp = dynamic_cast<AManaProducer*> (a);
|
||||||
if (amp)
|
if (amp)
|
||||||
{
|
{
|
||||||
@@ -982,15 +987,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
cost->setExtraCostsAction(a, card);
|
cost->setExtraCostsAction(a, card);
|
||||||
amp->oneShot = 0;
|
amp->oneShot = 0;
|
||||||
amp->tap = doTap;
|
amp->tap = doTap;
|
||||||
|
amp->limit = limit;
|
||||||
|
amp->sideEffect = sideEffect;
|
||||||
|
amp->usesBeforeSideEffects = usesBeforeSideEffect;
|
||||||
|
amp->restrictions = restrictions;
|
||||||
return amp;
|
return amp;
|
||||||
}
|
}
|
||||||
|
|
||||||
string limit = "";
|
|
||||||
size_t limit_str = sWithoutTc.find("limit:");
|
|
||||||
if (limit_str != string::npos)
|
|
||||||
{
|
|
||||||
limit = sWithoutTc.substr(limit_str + 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
AEquip *ae = dynamic_cast<AEquip*> (a);
|
AEquip *ae = dynamic_cast<AEquip*> (a);
|
||||||
if (ae)
|
if (ae)
|
||||||
@@ -1179,17 +1181,17 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
phase = Constants::MTG_PHASE_SECONDMAIN;
|
phase = Constants::MTG_PHASE_SECONDMAIN;
|
||||||
}
|
}
|
||||||
bool sourceinPlay = false;
|
bool sourceinPlay = false;
|
||||||
if (s1.find(",sourceinplay") != string::npos)
|
if (s1.find(",sourceinplay") != string::npos || s1.find(" sourceinplay") != string::npos)
|
||||||
{
|
{
|
||||||
sourceinPlay = true;
|
sourceinPlay = true;
|
||||||
}
|
}
|
||||||
bool next = true;
|
bool next = true;
|
||||||
if (s1.find(",next") != string::npos)
|
if (s1.find(",next") != string::npos||s1.find(" next") != string::npos)
|
||||||
{
|
{
|
||||||
next = false;
|
next = false;
|
||||||
}
|
}
|
||||||
bool once = false;
|
bool once = false;
|
||||||
if (s1.find(",once") != string::npos)
|
if (s1.find(",once") != string::npos||s1.find(" once") != string::npos)
|
||||||
{
|
{
|
||||||
once = true;
|
once = true;
|
||||||
}
|
}
|
||||||
@@ -1671,17 +1673,17 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
phase = Constants::MTG_PHASE_SECONDMAIN;
|
phase = Constants::MTG_PHASE_SECONDMAIN;
|
||||||
}
|
}
|
||||||
bool sourceinPlay = false;
|
bool sourceinPlay = false;
|
||||||
if (s1.find(",sourceinplay") != string::npos)
|
if (s1.find(",sourceinplay") != string::npos || s1.find(" sourceinplay") != string::npos)
|
||||||
{
|
{
|
||||||
sourceinPlay = true;
|
sourceinPlay = true;
|
||||||
}
|
}
|
||||||
bool next = true;
|
bool next = true;
|
||||||
if (s1.find(",next") != string::npos)
|
if (s1.find(",next") != string::npos||s1.find(" next") != string::npos)
|
||||||
{
|
{
|
||||||
next = false;
|
next = false;
|
||||||
}
|
}
|
||||||
bool once = false;
|
bool once = false;
|
||||||
if (s1.find(",once") != string::npos)
|
if (s1.find(",once") != string::npos||s1.find(" once") != string::npos)
|
||||||
{
|
{
|
||||||
once = true;
|
once = true;
|
||||||
}
|
}
|
||||||
@@ -2645,9 +2647,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
if(abilities[j].find("newability[") != string::npos)
|
if(abilities[j].find("newability[") != string::npos)
|
||||||
{
|
{
|
||||||
newAbilityFound = true;
|
newAbilityFound = true;
|
||||||
size_t NewSkill = abilities[j].find("[");
|
size_t NewSkill = abilities[j].find("newability[");
|
||||||
size_t NewSkillEnd = abilities[j].rfind("]");
|
size_t NewSkillEnd = abilities[j].find_last_of("]");
|
||||||
string newAbilities = abilities[j].substr(NewSkill + 1,NewSkillEnd - NewSkill - 1);
|
string newAbilities = abilities[j].substr(NewSkill + 11,NewSkillEnd - NewSkill - 11);
|
||||||
newAbilitiesList.push_back(newAbilities);
|
newAbilitiesList.push_back(newAbilities);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4826,6 +4828,8 @@ int AManaProducer::reactToClick(MTGCardInstance * _card)
|
|||||||
{
|
{
|
||||||
if (!isReactingToClick(_card))
|
if (!isReactingToClick(_card))
|
||||||
return 0;
|
return 0;
|
||||||
|
if(!ActivatedAbility::isReactingToClick(_card))
|
||||||
|
return 0;
|
||||||
if (cost)
|
if (cost)
|
||||||
{
|
{
|
||||||
cost->setExtraCostsAction(this, _card);
|
cost->setExtraCostsAction(this, _card);
|
||||||
@@ -4837,12 +4841,6 @@ int AManaProducer::reactToClick(MTGCardInstance * _card)
|
|||||||
GameObserver::GetInstance()->currentlyActing()->getManaPool()->pay(cost);
|
GameObserver::GetInstance()->currentlyActing()->getManaPool()->pay(cost);
|
||||||
cost->doPayExtra();
|
cost->doPayExtra();
|
||||||
}
|
}
|
||||||
if (tap)
|
|
||||||
{
|
|
||||||
GameObserver *g = GameObserver::GetInstance();
|
|
||||||
WEvent * e = NEW WEventCardTappedForMana(source, 0, 1);
|
|
||||||
g->receiveEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options[Options::SFXVOLUME].number > 0)
|
if (options[Options::SFXVOLUME].number > 0)
|
||||||
{
|
{
|
||||||
@@ -4850,7 +4848,7 @@ int AManaProducer::reactToClick(MTGCardInstance * _card)
|
|||||||
if (sample)
|
if (sample)
|
||||||
JSoundSystem::GetInstance()->PlaySample(sample);
|
JSoundSystem::GetInstance()->PlaySample(sample);
|
||||||
}
|
}
|
||||||
return resolve();
|
return ActivatedAbility::activateAbility();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * AManaProducer::getMenuText()
|
const char * AManaProducer::getMenuText()
|
||||||
|
|||||||
Reference in New Issue
Block a user