diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 7f5435397..3f7b552fa 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -2319,7 +2319,17 @@ public: { aType = MTGAbility::STANDARD_PUMP; cda = PT.find("cdaactive") != string::npos; - } + } + string ReplaceString(string subject, const string& search, const string& replace) + { + size_t pos = 0; + while ((pos = subject.find(search, pos)) != string::npos) + { + subject.replace(pos, search.length(), replace); + pos += replace.length(); + } + return subject; + } void Update(float) { if(!nonstatic) @@ -2331,7 +2341,10 @@ public: if(PT.size()) { SAFE_DELETE(wppt); - wppt = NEW WParsedPT(PT,NULL,(MTGCardInstance *) source); + if(cda) + wppt = NEW WParsedPT(ReplaceString(PT, "cdaactive", ""),NULL,(MTGCardInstance *) source); + else + wppt = NEW WParsedPT(ReplaceString(PT, "nonstatic", ""),NULL,(MTGCardInstance *) source); } MTGCardInstance * _target = (MTGCardInstance *) target; _target->power += wppt->power.getValue(); @@ -2342,7 +2355,10 @@ public: if(PT.size()) { SAFE_DELETE(wppt); - wppt = NEW WParsedPT(PT,NULL,(MTGCardInstance *) source); + if(cda) + wppt = NEW WParsedPT(ReplaceString(PT, "cdaactive", ""),NULL,(MTGCardInstance *) source); + else + wppt = NEW WParsedPT(ReplaceString(PT, "nonstatic", ""),NULL,(MTGCardInstance *) source); } ((MTGCardInstance *) target)->origpower = wppt->power.getValue(); ((MTGCardInstance *) target)->origtoughness = (wppt->toughness.getValue() + ((MTGCardInstance *) target)->life)-((MTGCardInstance *) target)->life;//what? @@ -2354,7 +2370,10 @@ public: if(PT.size()) { SAFE_DELETE(wppt); - wppt = NEW WParsedPT(PT,NULL,(MTGCardInstance *) source); + if(cda) + wppt = NEW WParsedPT(ReplaceString(PT, "cdaactive", ""),NULL,(MTGCardInstance *) source); + else + wppt = NEW WParsedPT(ReplaceString(PT, "nonstatic", ""),NULL,(MTGCardInstance *) source); } if(cda) {//Characteristic-defining abilities @@ -2402,7 +2421,10 @@ public: if(PT.size()) { SAFE_DELETE(wppt); - wppt = NEW WParsedPT(PT,NULL,(MTGCardInstance *) source); + if(cda) + wppt = NEW WParsedPT(ReplaceString(PT, "cdaactive", ""),NULL,(MTGCardInstance *) source); + else + wppt = NEW WParsedPT(ReplaceString(PT, "nonstatic", ""),NULL,(MTGCardInstance *) source); } sprintf(menuText, "%i/%i", wppt->power.getValue(), wppt->toughness.getValue()); return menuText; diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 354e45608..1bb059a35 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2536,12 +2536,13 @@ int AACloner::resolve() spell->source->fresh = 1; spell->source->model = spell->source; spell->source->model->data = spell->source; - if(_target->isToken) + //commenting this out fixes some problems when duplicating tokens 9/16/2015 + /*if(_target->isToken) { spell->source->power = _target->origpower; spell->source->toughness = _target->origtoughness; spell->source->life = _target->origtoughness; - } + }*/ list::iterator it; for (it = awith.begin(); it != awith.end(); it++) { diff --git a/projects/mtg/src/Token.cpp b/projects/mtg/src/Token.cpp index 1e9eeae50..a63bb9167 100644 --- a/projects/mtg/src/Token.cpp +++ b/projects/mtg/src/Token.cpp @@ -13,6 +13,8 @@ Token::Token(string _name, MTGCardInstance * source, int _power, int _toughness) lifeOrig = life; origpower = _power; origtoughness = _toughness; + basepower = power; + basetoughness = toughness; rarity = Constants::RARITY_T; name = _name; if (name.size() && name[0] >= 97 && name[0] <= 122) name[0] -= 32; //Poor man's camelcase. We assume strings we get are either Camelcased or lowercase @@ -25,6 +27,9 @@ Token::Token(string _name, MTGCardInstance * source, int _power, int _toughness) attacker = 0; defenser = NULL; banding = NULL; + pbonus = 0; + tbonus = 0; + isSettingBase = 0; } Token::Token(int id) : @@ -45,7 +50,11 @@ Token::Token(const Token& source) : life = source.life; lifeOrig = source.life; origpower = source.origpower; - origtoughness = source.origpower; + origtoughness = source.origtoughness; + basepower = source.origpower; + basetoughness = source.origpower; + pbonus = source.pbonus; + tbonus = source.tbonus; rarity = source.rarity; name = source.name; setId = source.setId; @@ -56,6 +65,7 @@ Token::Token(const Token& source) : attacker = source.attacker; defenser = source.defenser; banding = source.banding; + isSettingBase = source.isSettingBase; }