From db649ddc96e0fc020b4c1b75b42630a04ee0538e Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Wed, 16 Sep 2015 09:34:32 +0800 Subject: [PATCH] Added Update on CDA This controls whether to update Power and Toughness if we are setting base PT or not. If we are setting base PT update the CDA but it will not be applied since we have an effect that sets PT to a default base. If there are no effect that sets base PT, apply it on CDA using current/updated PT. The buffs are not affected. Yeah... --- projects/mtg/include/AllAbilities.h | 14 +++++++------- projects/mtg/include/MTGCardInstance.h | 1 + projects/mtg/src/AllAbilities.cpp | 5 +++++ projects/mtg/src/MTGCardInstance.cpp | 1 + 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 49d29f760..f502bffae 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -2324,7 +2324,7 @@ public: { if(!nonstatic) return; - if(!cda) + if(!cda || (cda && (((MTGCardInstance *) target)->isSettingBase < 1))) { ((MTGCardInstance *) target)->power -= wppt->power.getValue(); ((MTGCardInstance *) target)->addToToughness(-wppt->toughness.getValue()); @@ -2337,8 +2337,8 @@ public: _target->power += wppt->power.getValue(); _target->addToToughness(wppt->toughness.getValue()); } - else - {//CDA 7a update wppt + if(cda) + {//update but not apply if(PT.size()) { SAFE_DELETE(wppt); @@ -2385,11 +2385,11 @@ public: int destroy() { if(cda) - { - ; + { + ; } - else - { + else + { ((MTGCardInstance *) target)->power -= ((MTGCardInstance *) target)->pbonus; ((MTGCardInstance *) target)->addToToughness(-((MTGCardInstance *) target)->tbonus); ((MTGCardInstance *) target)->pbonus -= wppt->power.getValue(); diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index 0ecd3b749..38a4a5cd0 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -186,6 +186,7 @@ public: int addToToughness(int value); int setToughness(int value); + int isSettingBase; vectorprotections; int addProtection(TargetChooser * tc); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 0e6f192d8..354e45608 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -4180,6 +4180,8 @@ for (it = types.begin(); it != types.end(); it++) } } } + if(newpowerfound || newtoughnessfound) + _target->isSettingBase += 1; if(newpowerfound ) { WParsedInt * val = NEW WParsedInt(newpower,NULL, source); @@ -4281,6 +4283,9 @@ int ATransformer::destroy() { _target->setColor(*it); } + + if(newpowerfound || newtoughnessfound) + _target->isSettingBase -= 1; if(newpowerfound ) { diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index da3e4e666..6a9a7d8a0 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -53,6 +53,7 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to thatmuch = 0; flanked = 0; castMethod = Constants::NOT_CAST; + isSettingBase = 0; } MTGCardInstance * MTGCardInstance::createSnapShot()