diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 37fe8f4e7..a01b899e8 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1949,6 +1949,7 @@ class AACopier: public ActivatedAbility { public: MTGAbility * andAbility; + vector currentAbilities; AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL); int resolve(); const string getMenuText(); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 2cf3abab5..4aa778761 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -1462,7 +1462,8 @@ int AACopier::resolve() MTGCardInstance * _target = (MTGCardInstance *) target; if (_target) { - MTGCard* clone ; + MTGCard* clone; + AbilityFactory af(game); if(_target->isToken || (_target->isACopier && _target->hasCopiedToken)) {//fix crash when copying token clone = _target; @@ -1470,24 +1471,92 @@ int AACopier::resolve() } else clone = MTGCollection()->getCardById(_target->copiedID); - - if(tokencopied) - { +/////////////////////////////////////////////////////////////////////// MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game); - source->copy(myClone); + //source->copy(myClone); + source->setMTGId(myClone->getMTGId()); + source->setId = myClone->setId; + source->setRarity(myClone->getRarity()); + source->name = myClone->name; + source->setName(myClone->name); + source->getManaCost()->resetCosts(); + if(myClone->getManaCost()) + source->getManaCost()->copy(myClone->getManaCost()); + source->colors = myClone->colors; + source->types = myClone->types; + source->text = myClone->text; + source->formattedText = myClone->formattedText; + source->basicAbilities = myClone->model->data->basicAbilities; + source->modbasicAbilities = myClone->modbasicAbilities; + for(unsigned int i = 0;i < source->cardsAbilities.size();i++) + { + MTGAbility * a = dynamic_cast(source->cardsAbilities[i]); + + if(a) game->removeObserver(a); + } + source->cardsAbilities.clear(); + source->magicText = myClone->magicText; + af.getAbilities(¤tAbilities, NULL, source); + for (size_t i = 0; i < currentAbilities.size(); ++i) + { + MTGAbility * a = currentAbilities[i]; + a->source = (MTGCardInstance *) source; + if (a) + { + if (a->oneShot) + { + a->resolve(); + SAFE_DELETE(a); + } + else + { + a->addToGame(); + MayAbility * dontAdd = dynamic_cast(a); + if(!dontAdd) + { + source->cardsAbilities.push_back(a); + } + } + } + } + //power + int powerMod = 0; + int toughMod = 0; + bool powerlessThanOriginal = false; + bool toughLessThanOriginal = false; + if(source->power < source->origpower) + { + powerMod = source->origpower - source->power; + powerlessThanOriginal = true; + } + else + { + powerMod =source->power - source->origpower; + } + //toughness + if(source->toughness <= source->origtoughness) + { + toughMod = source->origtoughness - source->toughness; + toughLessThanOriginal = true; + } + else + { + toughMod =source->toughness - source->origtoughness; + } + if(!source->isCDA) + { + source->power = powerlessThanOriginal?myClone->power - powerMod:myClone->power + powerMod; + source->life = toughLessThanOriginal?myClone->toughness - toughMod:myClone->toughness + toughMod; + source->toughness = toughLessThanOriginal?myClone->toughness - toughMod:myClone->toughness + toughMod; + source->origpower = myClone->origpower; + source->origtoughness = myClone->origtoughness; + } + else + {//pbonus & tbonus are already computed except damage taken... + source->life -= source->damageCount; + } SAFE_DELETE(myClone); - } - else - {/********************************************* - * instead of using source->copy(myClone) use * - * AAFlip with forcedcopy to true * - *********************************************/ - AAFlip * af = NEW AAFlip(game, game->mLayers->actionLayer()->getMaxId(), source, source, clone->data->name, false, true); - af->oneShot = 1; - af->canBeInterrupted = false; - af->resolve(); - SAFE_DELETE(af); - } +/////////////////////////////////////////////////////////////////////// source->isACopier = true; source->hasCopiedToken = tokencopied; source->copiedID = _target->copiedID; @@ -1532,6 +1601,7 @@ int AACopier::resolve() andAbilityClone->addToGame(); } } + source->mPropertiesChangedSinceLastUpdate = true; return 1; } return 0; diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index e842988f0..91570066e 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -444,6 +444,7 @@ void CardGui::Render() else if(card->chooseacolor == 5) buff += "\n-White"; } + if(buff != "")//enable indicator at all modes { mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);