From 6cd0474eca4b4f100e17d2516d9934ff7f7ddf33 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Fri, 18 Sep 2015 19:56:02 +0800 Subject: [PATCH] Bug Fix on Cloning Tokens --- projects/mtg/include/AllAbilities.h | 1 + projects/mtg/include/MTGCardInstance.h | 1 + projects/mtg/src/AllAbilities.cpp | 25 ++++++++++++++++++------- projects/mtg/src/MTGCardInstance.cpp | 1 + 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 17f62efe8..ef0b8b31a 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -2456,6 +2456,7 @@ public: if(cda) {//Characteristic-defining abilities _target->cdaPT(wppt->power.getValue(),wppt->toughness.getValue()); + _target->isCDA = true; } else { diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index 45dd49439..723013148 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -234,6 +234,7 @@ public: void revertbaseP(); void revertbaseT(); void cdaPT(int p = 0, int t = 0); + bool isCDA; void eventattacked(); void eventattackedAlone(); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 7265690c7..434f5ad4a 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2536,16 +2536,27 @@ int AACloner::resolve() spell->source->fresh = 1; spell->source->model = spell->source; spell->source->model->data = spell->source; - //commenting this out fixes some problems when duplicating tokens 9/16/2015 - /*if(_target->isToken) + //if the token doesn't have cda/dynamic pt then allow this... + if((_target->isToken) && (!_target->isCDA)) { - spell->source->power = _target->origpower; - spell->source->toughness = _target->origtoughness; - spell->source->life = _target->origtoughness; - }*/ + if(_target->pbonus > 0) + spell->source->power = _target->power - _target->pbonus; + else + spell->source->power = _target->power + _target->pbonus; + if(_target->tbonus > 0) + { + spell->source->toughness = _target->toughness - _target->tbonus; + spell->source->life = _target->toughness - _target->tbonus; + } + else + { + spell->source->toughness = _target->toughness + _target->tbonus; + spell->source->life = _target->toughness + _target->tbonus; + } + } list::iterator it; for (it = awith.begin(); it != awith.end(); it++) - { + {//there must be a layer of temporary abilities and original abilities spell->source->basicAbilities[*it] = 1; } for (it = colors.begin(); it != colors.end(); it++) diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index b64305392..88458bcb1 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -54,6 +54,7 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to flanked = 0; castMethod = Constants::NOT_CAST; isSettingBase = 0; + isCDA = false; } MTGCardInstance * MTGCardInstance::createSnapShot()