This commit is contained in:
omegablast2002@yahoo.com
2011-02-22 14:38:07 +00:00
parent 0f4f41c137
commit 6f792e5546
3 changed files with 45 additions and 37 deletions
+12 -12
View File
@@ -3869,15 +3869,15 @@ public:
list<int> oldtypes; list<int> oldtypes;
bool remove; bool remove;
string menu; string menu;
int newpower; string newpower;
bool newpowerfound; bool newpowerfound;
int oldpower; int oldpower;
int newtoughness; string newtoughness;
bool newtoughnessfound; bool newtoughnessfound;
int oldtoughness; int oldtoughness;
ATransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,int newpower,bool newpowerfound,int newtoughness,bool newtoughnessfound); ATransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound);
int addToGame(); int addToGame();
int destroy(); int destroy();
const char * getMenuText(); const char * getMenuText();
@@ -3893,15 +3893,15 @@ public:
list<int> types; list<int> types;
list<int> colors; list<int> colors;
string menu; string menu;
int newpower; string newpower;
bool newpowerfound; bool newpowerfound;
int oldpower; int oldpower;
int newtoughness; string newtoughness;
bool newtoughnessfound; bool newtoughnessfound;
int oldtoughness; int oldtoughness;
bool remove; bool remove;
AForeverTransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,int newpower,bool newpowerfound,int newtoughness,bool newtoughnessfound); AForeverTransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound);
int addToGame(); int addToGame();
const char * getMenuText(); const char * getMenuText();
AForeverTransformer * clone() const; AForeverTransformer * clone() const;
@@ -3913,12 +3913,12 @@ class ATransformerUEOT: public InstantAbility
{ {
public: public:
ATransformer * ability; ATransformer * ability;
int newpower; string newpower;
bool newpowerfound; bool newpowerfound;
int newtoughness; string newtoughness;
bool newtoughnessfound; bool newtoughnessfound;
ATransformerUEOT(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,int newpower,bool newpowerfound,int newtoughness,bool newtoughnessfound); ATransformerUEOT(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,string newpower,bool newpowerfound,string newtoughness,bool newtoughnessfound);
int resolve(); int resolve();
const char * getMenuText(); const char * getMenuText();
ATransformerUEOT * clone() const; ATransformerUEOT * clone() const;
@@ -3930,12 +3930,12 @@ class ATransformerFOREVER: public InstantAbility
{ {
public: public:
AForeverTransformer * ability; AForeverTransformer * ability;
int newpower; string newpower;
bool newpowerfound; bool newpowerfound;
int newtoughness; string newtoughness;
bool newtoughnessfound; bool newtoughnessfound;
ATransformerFOREVER(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,int newpower = 0,bool newpowerfound = false,int newtoughness = 0,bool newtoughnessfound = false); ATransformerFOREVER(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,string newpower = "",bool newpowerfound = false,string newtoughness = "",bool newtoughnessfound = false);
int resolve(); int resolve();
const char * getMenuText(); const char * getMenuText();
ATransformerFOREVER * clone() const; ATransformerFOREVER * clone() const;
+16 -8
View File
@@ -2181,7 +2181,7 @@ AAlterCost::~AAlterCost()
} }
// ATransformer // ATransformer
ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, string sabilities,int newpower,bool newpowerfound,int newtoughness,bool newtoughnessfound) : 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) MTGAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound)
{ {
@@ -2276,15 +2276,19 @@ int ATransformer::addToGame()
} }
if(newpowerfound ) if(newpowerfound )
{ {
WParsedInt * val = NEW WParsedInt(newpower,NULL, source);
oldpower = _target->power; oldpower = _target->power;
_target->power += newpower; _target->power += val->getValue();
_target->power -= oldpower; _target->power -= oldpower;
delete val;
} }
if(newtoughnessfound ) if(newtoughnessfound )
{ {
WParsedInt * val = NEW WParsedInt(newtoughness,NULL, source);
oldtoughness = _target->toughness; oldtoughness = _target->toughness;
_target->addToToughness(newtoughness); _target->addToToughness(val->getValue());
_target->addToToughness(-oldtoughness); _target->addToToughness(-oldtoughness);
delete val;
} }
} }
return MTGAbility::addToGame(); return MTGAbility::addToGame();
@@ -2355,7 +2359,7 @@ ATransformer::~ATransformer()
// AForeverTransformer // AForeverTransformer
AForeverTransformer::AForeverTransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes, AForeverTransformer::AForeverTransformer(int id, MTGCardInstance * source, MTGCardInstance * target, string stypes,
string sabilities,int newpower,bool newpowerfound, int newtoughness,bool newtoughnessfound) : string sabilities,string newpower,bool newpowerfound, string newtoughness,bool newtoughnessfound) :
MTGAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound) MTGAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound)
{ {
aType = MTGAbility::STANDARD_BECOMES; aType = MTGAbility::STANDARD_BECOMES;
@@ -2408,15 +2412,19 @@ int AForeverTransformer::addToGame()
} }
if(newpowerfound ) if(newpowerfound )
{ {
WParsedInt * val = NEW WParsedInt(newpower,NULL, source);
oldpower = _target->power -= oldpower; oldpower = _target->power -= oldpower;
_target->power += newpower; _target->power += val->getValue();
_target->power -= oldpower; _target->power -= oldpower;
delete val;
} }
if(newtoughnessfound ) if(newtoughnessfound )
{ {
WParsedInt * val = NEW WParsedInt(newtoughness,NULL, source);
oldtoughness = _target->toughness; oldtoughness = _target->toughness;
_target->addToToughness(newtoughness); _target->addToToughness(val->getValue());
_target->addToToughness(-oldtoughness); _target->addToToughness(-oldtoughness);
delete val;
} }
} }
return MTGAbility::addToGame(); return MTGAbility::addToGame();
@@ -2440,7 +2448,7 @@ AForeverTransformer::~AForeverTransformer()
} }
//ATransformerUEOT //ATransformerUEOT
ATransformerUEOT::ATransformerUEOT(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,int newpower,bool newpowerfound,int newtoughness,bool newtoughnessfound) : 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) InstantAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound)
{ {
ability = NEW ATransformer(id, source, target, types, abilities,newpower,newpowerfound,newtoughness,newtoughnessfound); ability = NEW ATransformer(id, source, target, types, abilities,newpower,newpowerfound,newtoughness,newtoughnessfound);
@@ -2473,7 +2481,7 @@ ATransformerUEOT::~ATransformerUEOT()
} }
// ATransformerFOREVER // ATransformerFOREVER
ATransformerFOREVER::ATransformerFOREVER(int id, MTGCardInstance * source, MTGCardInstance * target, string types, string abilities,int newpower,bool newpowerfound,int newtoughness,bool newtoughnessfound) : 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) InstantAbility(id, source, target),newpower(newpower),newpowerfound(newpowerfound),newtoughness(newtoughness),newtoughnessfound(newtoughnessfound)
{ {
ability = NEW AForeverTransformer(id, source, target, types, abilities,newpower,newpowerfound,newtoughness,newtoughnessfound); ability = NEW AForeverTransformer(id, source, target, types, abilities,newpower,newpowerfound,newtoughness,newtoughnessfound);
+18 -18
View File
@@ -2507,26 +2507,26 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
string sabilities = transformsParamsString.substr(stypes.length()); string sabilities = transformsParamsString.substr(stypes.length());
bool newpowerfound = false; bool newpowerfound = false;
int newpower = 0; string newpower = "";
size_t powerability = sabilities.find("setpower=");
if(sabilities.find(",setpower=") != string::npos)
{
newpowerfound = true;
int powerstart = s.find("setpower=", powerability);
int powerend = s.find(real_end, powerstart);
newpower = atoi(s.substr(powerstart + 9).c_str());
}
bool newtoughnessfound = false; bool newtoughnessfound = false;
int newtoughness = 0; string newtoughness = "";
size_t toughnessability = sabilities.find("settoughness="); vector <string> abilities = split(sabilities, ',');
if(sabilities.find(",settoughness=") != string::npos)
{
newtoughnessfound = true;
int toughnessstart = s.find("settoughness=", toughnessability);
int toughnessend = s.find(real_end, toughnessstart);
newtoughness = atoi(s.substr(toughnessstart + 13).c_str());
}
for(unsigned int j = 0;j < abilities.size();j++)
{
if(abilities[j].find("setpower=") != string::npos)
{
newpowerfound = true;
int powerstart = abilities[j].find("setpower=");
newpower = abilities[j].substr(powerstart + 9).c_str();
}
if(abilities[j].find("settoughness=") != string::npos)
{
newtoughnessfound = true;
int toughnessstart = abilities[j].find("settoughness=");
newtoughness = abilities[j].substr(toughnessstart + 13).c_str();
}
}
MTGAbility * a; MTGAbility * a;
if (forceFOREVER) if (forceFOREVER)
{ {