slight adjustments to transforms parsing to allow for newability to also be a transforms. xx wasnt being set in a couple cases, removed the space i added to the 3 variables so they can be anywhere in the line.
This commit is contained in:
@@ -2307,7 +2307,26 @@ ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * t
|
|||||||
{
|
{
|
||||||
for (unsigned int k = 0 ; k < newAbilitiesList.size();k++)
|
for (unsigned int k = 0 ; k < newAbilitiesList.size();k++)
|
||||||
{
|
{
|
||||||
|
|
||||||
MTGAbility * aNew = newAbilitiesList[k]->clone();
|
MTGAbility * aNew = newAbilitiesList[k]->clone();
|
||||||
|
|
||||||
|
GenericTargetAbility * gta = dynamic_cast<GenericTargetAbility*> (aNew);
|
||||||
|
if (gta)
|
||||||
|
{
|
||||||
|
((GenericTargetAbility *)aNew)->source = _target;
|
||||||
|
((GenericTargetAbility *)aNew)->ability->source = _target;
|
||||||
|
}
|
||||||
|
GenericActivatedAbility * gaa = dynamic_cast<GenericActivatedAbility*> (aNew);
|
||||||
|
if (gaa)
|
||||||
|
{
|
||||||
|
((GenericActivatedAbility *)aNew)->source = _target;
|
||||||
|
((GenericActivatedAbility *)aNew)->ability->source = _target;
|
||||||
|
}
|
||||||
|
if (MultiAbility * abi = dynamic_cast<MultiAbility*>(aNew))
|
||||||
|
{
|
||||||
|
((MultiAbility *)aNew)->source = _target;
|
||||||
|
((MultiAbility *)aNew)->abilities[0]->source = _target;
|
||||||
|
}
|
||||||
aNew->target = _target;
|
aNew->target = _target;
|
||||||
aNew->source = (MTGCardInstance *) _target;
|
aNew->source = (MTGCardInstance *) _target;
|
||||||
aNew->addToGame();
|
aNew->addToGame();
|
||||||
@@ -2471,14 +2490,33 @@ int AForeverTransformer::addToGame()
|
|||||||
}
|
}
|
||||||
if(newAbilityFound)
|
if(newAbilityFound)
|
||||||
{
|
{
|
||||||
for (unsigned int k = 0 ; k < newAbilitiesList.size();k++)
|
for (unsigned int k = 0 ; k < newAbilitiesList.size();k++)
|
||||||
{
|
{
|
||||||
MTGAbility * aNew = newAbilitiesList[k]->clone();
|
|
||||||
aNew->target = _target;
|
MTGAbility * aNew = newAbilitiesList[k]->clone();
|
||||||
aNew->source = (MTGCardInstance *) _target;
|
|
||||||
aNew->addToGame();
|
GenericTargetAbility * gta = dynamic_cast<GenericTargetAbility*> (aNew);
|
||||||
newAbilities[_target].push_back(aNew);
|
if (gta)
|
||||||
}
|
{
|
||||||
|
((GenericTargetAbility *)aNew)->source = _target;
|
||||||
|
((GenericTargetAbility *)aNew)->ability->source = _target;
|
||||||
|
}
|
||||||
|
GenericActivatedAbility * gaa = dynamic_cast<GenericActivatedAbility*> (aNew);
|
||||||
|
if (gaa)
|
||||||
|
{
|
||||||
|
((GenericActivatedAbility *)aNew)->source = _target;
|
||||||
|
((GenericActivatedAbility *)aNew)->ability->source = _target;
|
||||||
|
}
|
||||||
|
if (MultiAbility * abi = dynamic_cast<MultiAbility*>(aNew))
|
||||||
|
{
|
||||||
|
((MultiAbility *)aNew)->source = _target;
|
||||||
|
((MultiAbility *)aNew)->abilities[0]->source = _target;
|
||||||
|
}
|
||||||
|
aNew->target = _target;
|
||||||
|
aNew->source = (MTGCardInstance *) _target;
|
||||||
|
aNew->addToGame();
|
||||||
|
newAbilities[_target].push_back(aNew);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(newpowerfound )
|
if(newpowerfound )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1946,13 +1946,13 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
if (s.find(" owner") != string::npos)
|
if (s.find(" owner") != string::npos)
|
||||||
who = TargetChooser::OWNER;
|
who = TargetChooser::OWNER;
|
||||||
|
|
||||||
found = s.find(" ueot");
|
found = s.find("ueot");
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
forceUEOT = 1;
|
forceUEOT = 1;
|
||||||
found = s.find(" oneshot");
|
found = s.find("oneshot");
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
oneShot = 1;
|
oneShot = 1;
|
||||||
found = s.find(" forever");
|
found = s.find("forever");
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
forceFOREVER = 1;
|
forceFOREVER = 1;
|
||||||
|
|
||||||
@@ -2522,8 +2522,22 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
found = s.find("transforms((");
|
found = s.find("transforms((");
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
{
|
{
|
||||||
|
string extraTransforms = "";
|
||||||
size_t stypesStartIndex = found + 12;
|
size_t stypesStartIndex = found + 12;
|
||||||
string transformsParamsString = storedString;//the string between found and real end is removed at start.
|
string transformsParamsString = "";
|
||||||
|
transformsParamsString.append(storedString);//the string between found and real end is removed at start.
|
||||||
|
|
||||||
|
found = transformsParamsString.find("transforms((");
|
||||||
|
if (found != string::npos && extraTransforms.empty())
|
||||||
|
{
|
||||||
|
size_t real_end = transformsParamsString.find("))", found);
|
||||||
|
size_t end = transformsParamsString.find(",", found);
|
||||||
|
if (end == string::npos)
|
||||||
|
end = real_end;
|
||||||
|
size_t stypesStartIndex = found + 12;
|
||||||
|
extraTransforms.append(transformsParamsString.substr(stypesStartIndex, real_end - stypesStartIndex).c_str());
|
||||||
|
transformsParamsString.erase(stypesStartIndex, real_end - stypesStartIndex);
|
||||||
|
}
|
||||||
vector<string> effectParameters = split( transformsParamsString, ',');
|
vector<string> effectParameters = split( transformsParamsString, ',');
|
||||||
string stypes = effectParameters[0];
|
string stypes = effectParameters[0];
|
||||||
|
|
||||||
@@ -2535,7 +2549,9 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
vector <string> abilities = split(sabilities, ',');
|
vector <string> abilities = split(sabilities, ',');
|
||||||
bool newAbilityFound = false;
|
bool newAbilityFound = false;
|
||||||
vector<MTGAbility *> newAbilitiesList;
|
vector<MTGAbility *> newAbilitiesList;
|
||||||
|
storedString.erase();
|
||||||
|
storedString.append(extraTransforms);
|
||||||
|
extraTransforms.erase();
|
||||||
for(unsigned int j = 0;j < abilities.size();j++)
|
for(unsigned int j = 0;j < abilities.size();j++)
|
||||||
{
|
{
|
||||||
if(abilities[j].find("setpower=") != string::npos)
|
if(abilities[j].find("setpower=") != string::npos)
|
||||||
@@ -2558,7 +2574,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
newAbilitiesList.push_back(parseMagicLine(newAbilities, id, spell, card));
|
newAbilitiesList.push_back(parseMagicLine(newAbilities, id, spell, card));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
storedString.erase();
|
|
||||||
MTGAbility * a;
|
MTGAbility * a;
|
||||||
if (forceFOREVER)
|
if (forceFOREVER)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -449,6 +449,7 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy
|
|||||||
copy->view = card->view;
|
copy->view = card->view;
|
||||||
copy->isToken = card->isToken;
|
copy->isToken = card->isToken;
|
||||||
copy->X = card->X;
|
copy->X = card->X;
|
||||||
|
copy->XX = card->X/2;
|
||||||
|
|
||||||
//stupid bug with tokens...
|
//stupid bug with tokens...
|
||||||
if (card->model == card)
|
if (card->model == card)
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alter
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
copy->X = spell->computeX(copy);
|
copy->X = spell->computeX(copy);
|
||||||
copy->XX = spell->computeXX(copy);
|
copy->XX = copy->X/2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -723,7 +723,7 @@ int MTGMorphCostRule::reactToClick(MTGCardInstance * card)
|
|||||||
if (!card->has(Constants::STORM))
|
if (!card->has(Constants::STORM))
|
||||||
{
|
{
|
||||||
copy->X = spell->computeX(copy);
|
copy->X = spell->computeX(copy);
|
||||||
copy->XX = spell->computeXX(copy);
|
copy->XX = copy->X/2;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user