corrected Prismatic omen issue,

added newability[whatever ability] to transforms classes.
this allows for transforms to also add activated or mtgabilities to cards it targets.
example Prismatic omen:
auto=lord(land|myBattlefield) transforms(plains forest mountain swamp island,newability[{t}:add{w}],newability[{t}:add{g}],newability[{t}:add{r}],newability[{t}:add{b}],newability[{t}:add{u}])
Issue: 573
This commit is contained in:
omegablast2002@yahoo.com
2011-03-28 23:39:29 +00:00
parent b600b8c41a
commit c03a444525
3 changed files with 148 additions and 79 deletions
+16 -4
View File
@@ -3909,9 +3909,12 @@ public:
string newtoughness;
bool newtoughnessfound;
int oldtoughness;
map<Damageable *, vector<MTGAbility *>> newAbilities;
vector<MTGAbility *> newAbilitiesList;
bool newAbilityFound;
ATransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound);
ATransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound,vector<MTGAbility *> newAbilitiesList,bool newAbilityFound = false);
int addToGame();
int destroy();
const char * getMenuText();
@@ -3934,8 +3937,11 @@ public:
bool newtoughnessfound;
int oldtoughness;
bool remove;
vector<MTGAbility *> newAbilitiesList;
map<Damageable *, vector<MTGAbility *>> newAbilities;
bool newAbilityFound;
AForeverTransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound);
AForeverTransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,string newpower = "",bool newpowerfound = false,string newtoughness = "",bool newtoughnessfound = false,vector<MTGAbility*>newAbilitiesList = vector<MTGAbility*>(),bool newAbilityFound = false);
int addToGame();
const char * getMenuText();
AForeverTransformer * clone() const;
@@ -3951,8 +3957,11 @@ public:
bool newpowerfound;
string newtoughness;
bool newtoughnessfound;
vector<MTGAbility *> newAbilitiesList;
map<Damageable *, vector<MTGAbility *>> newAbilities;
bool newAbilityFound;
ATransformerUEOT(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound);
ATransformerUEOT(int id, MTGCardInstance * source, MTGCardInstance * target, string types = "", string abilities = "",string newpower = "",bool newpowerfound = false,string newtoughness = "",bool newtoughnessfound = false,vector<MTGAbility*>newAbilitiesList = vector<MTGAbility*>(),bool newAbilityFound = false);
int resolve();
const char * getMenuText();
ATransformerUEOT * clone() const;
@@ -3968,8 +3977,11 @@ public:
bool newpowerfound;
string newtoughness;
bool newtoughnessfound;
vector<MTGAbility *> newAbilitiesList;
map<Damageable *, vector<MTGAbility *>> newAbilities;
bool newAbilityFound;
ATransformerFOREVER(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,string newpower = "",bool newpowerfound = false,string newtoughness = "",bool newtoughnessfound = false);
ATransformerFOREVER(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,string newpower = "",bool newpowerfound = false,string newtoughness = "",bool newtoughnessfound = false,vector<MTGAbility*>newAbilitiesList = vector<MTGAbility*>(),bool newAbilityFound = false);
int resolve();
const char * getMenuText();
ATransformerFOREVER * clone() const;
+61 -13
View File
@@ -2209,8 +2209,8 @@ AAlterCost::~AAlterCost()
}
// ATransformer
ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound) :
MTGAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound)
ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound,vector<MTGAbility *> newAbilitiesList,bool newAbilityFound) :
MTGAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound),newAbilitiesList(newAbilitiesList),newAbilityFound(newAbilityFound)
{
PopulateAbilityIndexVector(abilities, sabilities);
@@ -2250,8 +2250,8 @@ ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * t
menu = stypes;
}
int ATransformer::addToGame()
{
int ATransformer::addToGame()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target)
{
@@ -2302,6 +2302,17 @@ int ATransformer::addToGame()
for (it = oldcolors.begin(); it != oldcolors.end(); it++)
{
}
if(newAbilityFound)
{
for (unsigned int k = 0 ; k < newAbilitiesList.size();k++)
{
MTGAbility * aNew = newAbilitiesList[k]->clone();
aNew->target = _target;
aNew->source = (MTGCardInstance *) _target;
aNew->addToGame();
newAbilities[_target].push_back(aNew);
}
}
if(newpowerfound )
{
WParsedInt * val = NEW WParsedInt(newpower,NULL, source);
@@ -2318,9 +2329,10 @@ int ATransformer::addToGame()
_target->addToToughness(-oldtoughness);
delete val;
}
}
return MTGAbility::addToGame();
}
}
int ATransformer::destroy()
{
@@ -2363,6 +2375,17 @@ int ATransformer::destroy()
{
_target->toughness = oldtoughness;
}
if(newAbilityFound)
{
for (unsigned int i = 0;i < newAbilities[_target].size(); i++)
{
newAbilities[_target].at(i)->forceDestroy = 1;
}
if (newAbilities.find(_target) != newAbilities.end())
{
newAbilities.erase(_target);
}
}
}
return 1;
}
@@ -2383,12 +2406,19 @@ ATransformer * ATransformer::clone() const
ATransformer::~ATransformer()
{
if(!isClone)
{
for (unsigned int k = 0; k < newAbilitiesList.size();k++)
{
SAFE_DELETE(newAbilitiesList[k]);
}
}
}
// AForeverTransformer
AForeverTransformer::AForeverTransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes,
string sabilities,string newpower,bool newpowerfound, string newtoughness,bool newtoughnessfound) :
MTGAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound)
string sabilities,string newpower,bool newpowerfound, string newtoughness,bool newtoughnessfound,vector<MTGAbility*> newAbilitiesList,bool newAbilityFound) :
MTGAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound),newAbilitiesList(newAbilitiesList),newAbilityFound(newAbilityFound)
{
aType = MTGAbility::STANDARD_BECOMES;
@@ -2438,6 +2468,17 @@ int AForeverTransformer::addToGame()
{
_target->basicAbilities[*it]++;
}
if(newAbilityFound)
{
for (unsigned int k = 0 ; k < newAbilitiesList.size();k++)
{
MTGAbility * aNew = newAbilitiesList[k]->clone();
aNew->target = _target;
aNew->source = (MTGCardInstance *) _target;
aNew->addToGame();
newAbilities[_target].push_back(aNew);
}
}
if(newpowerfound )
{
WParsedInt * val = NEW WParsedInt(newpower,NULL, source);
@@ -2473,13 +2514,20 @@ AForeverTransformer * AForeverTransformer::clone() const
}
AForeverTransformer::~AForeverTransformer()
{
if(!isClone)
{
for (unsigned int k = 0; k < newAbilitiesList.size();k++)
{
SAFE_DELETE(newAbilitiesList[k]);
}
}
}
//ATransformerUEOT
ATransformerUEOT::ATransformerUEOT(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound) :
InstantAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound)
ATransformerUEOT::ATransformerUEOT(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound,vector<MTGAbility*>newAbilitiesList,bool newAbilityFound) :
InstantAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound),newAbilitiesList(newAbilitiesList),newAbilityFound(newAbilityFound)
{
ability = NEW ATransformer(id, source, target, types, abilities,newpower,newpowerfound,newtoughness,newtoughnessfound);
ability = NEW ATransformer(id, source, target, types, abilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound);
aType = MTGAbility::STANDARD_BECOMES;
}
@@ -2509,10 +2557,10 @@ ATransformerUEOT::~ATransformerUEOT()
}
// ATransformerFOREVER
ATransformerFOREVER::ATransformerFOREVER(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound) :
InstantAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound)
ATransformerFOREVER::ATransformerFOREVER(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound,vector<MTGAbility*>newAbilitiesList,bool newAbilityFound) :
InstantAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound),newAbilitiesList(newAbilitiesList),newAbilityFound(newAbilityFound)
{
ability = NEW AForeverTransformer(id, source, target, types, abilities,newpower,newpowerfound,newtoughness,newtoughnessfound);
ability = NEW AForeverTransformer(id, source, target, types, abilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound);
aType = MTGAbility::STANDARD_BECOMES;
}
+12 -3
View File
@@ -2527,6 +2527,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
bool newtoughnessfound = false;
string newtoughness = "";
vector <string> abilities = split(sabilities, ',');
bool newAbilityFound = false;
vector<MTGAbility *> newAbilitiesList;
for(unsigned int j = 0;j < abilities.size();j++)
{
@@ -2542,19 +2544,26 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
int toughnessstart = abilities[j].find("settoughness=");
newtoughness = abilities[j].substr(toughnessstart + 13).c_str();
}
if(abilities[j].find("newability[") != string::npos)
{
newAbilityFound = true;
size_t NewSkill = abilities[j].find("[");
string newAbilities = abilities[j].substr(NewSkill + 1,abilities[j].find(']') - 1);
newAbilitiesList.push_back(parseMagicLine(newAbilities, id, spell, card));
}
}
MTGAbility * a;
if (forceFOREVER)
{
a = NEW ATransformerFOREVER(id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound);
a = NEW ATransformerFOREVER(id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound);
}
else if (forceUEOT)
{
a = NEW ATransformerUEOT(id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound);
a = NEW ATransformerUEOT(id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound);
}
else
{
a = NEW ATransformer(id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound);
a = NEW ATransformer(id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound);
}
return a;
}