From 62dd54c886ed45838b5a34d28f2c741de5e0e724 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Wed, 9 Sep 2015 22:18:13 +0800 Subject: [PATCH] Base Power/Toughness Template as of M15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 208.4. Effects that set a creature’s power and/or toughness to specific values may refer to that creature’s “base power,” “base toughness,” or “base power and toughness.” Other continuous effects may further modify the creature’s power and toughness. See rule 613, “Interaction of Continuous Effects.” --- projects/mtg/bin/Res/test/_tests.txt | 1 + projects/mtg/include/AllAbilities.h | 4 ++-- projects/mtg/src/AllAbilities.cpp | 18 ++++++++---------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 68fc41c15..6c7f3e37f 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -534,6 +534,7 @@ prowess_of_the_fair.txt prowess_of_the_fair2.txt prowess_of_the_fair3.txt PTInstant.txt +PT_M15_errata.txt pygmy_troll.txt pyknite_i426.txt pyroclasm.txt diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index e8d099441..78df9b851 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -4307,10 +4307,10 @@ public: string newpower; bool newpowerfound; - int oldpower; + int oldpowerbonus; string newtoughness; bool newtoughnessfound; - int oldtoughness; + int oldtoughnessbonus; map > newAbilities; vector newAbilitiesList; bool newAbilityFound; diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index e868654bb..429d51edd 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -4181,20 +4181,18 @@ for (it = types.begin(); it != types.end(); it++) } } if(newpowerfound ) - { + {//setting p/t only overrides base p/t as of M15 changes WParsedInt * val = NEW WParsedInt(newpower,NULL, source); - oldpower = _target->power; - _target->power += val->getValue(); - _target->power -= oldpower; + oldpowerbonus = _target->power - _target->origpower;//keep bonus if any + _target->setPower(oldpowerbonus + val->getValue()); _target->power += reapplyCountersBonus(_target,false,true); delete val; } if(newtoughnessfound ) - { + {//setting p/t only overrides base p/t as of M15 changes WParsedInt * val = NEW WParsedInt(newtoughness,NULL, source); - oldtoughness = _target->toughness; - _target->addToToughness(val->getValue()); - _target->addToToughness(-oldtoughness); + oldtoughnessbonus = _target->toughness - _target->origtoughness;// keep bonus if any + _target->setToughness(oldtoughnessbonus + val->getValue()); _target->addToToughness(reapplyCountersBonus(_target,true,false)); _target->life = _target->toughness; delete val; @@ -4283,11 +4281,11 @@ int ATransformer::destroy() if(newpowerfound ) { - _target->power = oldpower; + _target->setPower(oldpowerbonus + _target->origpower); } if(newtoughnessfound ) { - _target->setToughness(oldtoughness); + _target->setToughness(oldtoughnessbonus + _target->origtoughness); } if(newAbilityFound) {