Finally PT Calculation is fixed :)

I didn't take into account that the new bonus must be calculated on the
event the effect was destroyed... silly me... 🉑
This commit is contained in:
Anthony Calosa
2015-09-11 10:53:36 +08:00
parent d3a7ff7e11
commit b33a999458
2 changed files with 20 additions and 9 deletions
+3
View File
@@ -4307,9 +4307,12 @@ public:
string newpower; string newpower;
bool newpowerfound; bool newpowerfound;
int oldpower;
int oldpowerbonus; int oldpowerbonus;
string newtoughness; string newtoughness;
bool newtoughnessfound; bool newtoughnessfound;
int oldtoughness;
int oldtoughnessbonus; int oldtoughnessbonus;
map<Damageable *, vector<MTGAbility *> > newAbilities; map<Damageable *, vector<MTGAbility *> > newAbilities;
vector<string> newAbilitiesList; vector<string> newAbilitiesList;
+17 -9
View File
@@ -4183,17 +4183,22 @@ for (it = types.begin(); it != types.end(); it++)
if(newpowerfound ) if(newpowerfound )
{//setting p/t only overrides base p/t as of M15 changes {//setting p/t only overrides base p/t as of M15 changes
WParsedInt * val = NEW WParsedInt(newpower,NULL, source); WParsedInt * val = NEW WParsedInt(newpower,NULL, source);
oldpowerbonus = _target->power - _target->basepower;//keep bonus if any oldpower = _target->power;
oldpowerbonus = oldpower - _target->basepower;
_target->setPower(oldpowerbonus + val->getValue()); _target->setPower(oldpowerbonus + val->getValue());
_target->basepower = val->getValue(); _target->basepower = val->getValue();
//?effects that change pt outside this?
//_target->power += reapplyCountersBonus(_target,false,true);
delete val; delete val;
} }
if(newtoughnessfound ) if(newtoughnessfound )
{//setting p/t only overrides base p/t as of M15 changes {//setting p/t only overrides base p/t as of M15 changes
WParsedInt * val = NEW WParsedInt(newtoughness,NULL, source); WParsedInt * val = NEW WParsedInt(newtoughness,NULL, source);
oldtoughnessbonus = _target->toughness - _target->basetoughness;// keep bonus if any oldtoughness = _target->toughness;
oldtoughnessbonus = oldtoughness - _target->basetoughness;
_target->setToughness(oldtoughnessbonus + val->getValue()); _target->setToughness(oldtoughnessbonus + val->getValue());
_target->basetoughness = val->getValue(); _target->basetoughness = val->getValue();
//_target->addToToughness(reapplyCountersBonus(_target,true,false));
_target->life = _target->toughness; _target->life = _target->toughness;
delete val; delete val;
} }
@@ -4280,14 +4285,17 @@ int ATransformer::destroy()
} }
if(newpowerfound ) if(newpowerfound )
{ {//override since we changed tha base, the bonus must have changed
_target->setPower(oldpowerbonus + _target->basepower); oldpowerbonus = (_target->power - _target->basepower);//math hurts my head...it's all over the place :P
_target->power += reapplyCountersBonus(_target,false,true); _target->setPower(_target->origpower + oldpowerbonus);
_target->basepower = _target->origpower;//revert
} }
if(newtoughnessfound ) if(newtoughnessfound )
{ {//override since we changed tha base, the bonus must have changed
_target->setToughness(oldtoughnessbonus + _target->basetoughness); oldtoughnessbonus = (_target->toughness - _target->basetoughness);
_target->addToToughness(reapplyCountersBonus(_target,true,false)); _target->setToughness(_target->origtoughness + oldtoughnessbonus);
_target->basetoughness = _target->origtoughness;//revert
_target->life = _target->toughness;//update
} }
if(newAbilityFound) if(newAbilityFound)
{ {