diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 79474f947..826868a63 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1269,6 +1269,8 @@ public: int counters; MTGGameZone * activeZone; string newName; + MTGAbility * sideEffects; + string usesBeforeSideEffects; string tcString; GenericTargetAbility(GameObserver* observer, string newName, string castRestriction, int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a, ManaCost * _cost = NULL, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "", int restrictions = 0, MTGGameZone * dest = NULL,string tcString =""); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 79dabf87c..f8c9dc0b8 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -3336,7 +3336,7 @@ MultiAbility::~MultiAbility() //Generic Target Ability GenericTargetAbility::GenericTargetAbility(GameObserver* observer, string newName, string castRestriction, int _id, MTGCardInstance * _source, TargetChooser * _tc, MTGAbility * a, ManaCost * _cost, string limit,MTGAbility * sideEffects,string usesBeforeSideEffects, int restrictions, MTGGameZone * dest,string _tcString) : - TargetAbility(observer, _id, _source, _tc, _cost, restrictions, castRestriction), limit(limit), activeZone(dest),newName(newName),tcString(_tcString) + TargetAbility(observer, _id, _source, _tc, _cost, restrictions, castRestriction), limit(limit), activeZone(dest),newName(newName),sideEffects(sideEffects),usesBeforeSideEffects(usesBeforeSideEffects),tcString(_tcString) { ability = a; MTGAbility * core = AbilityFactory::getCoreAbility(a); @@ -3364,6 +3364,27 @@ int GenericTargetAbility::resolve() { counters++; tc->done = false; + if(sideEffects && usesBeforeSideEffects.size()) + { + WParsedInt * use = NEW WParsedInt(usesBeforeSideEffects.c_str(),NULL,source); + uses = use->getValue(); + delete use; + if(counters == uses) + { + sa = sideEffects->clone(); + sa->target = this->target; + sa->source = this->source; + if(sa->oneShot) + { + sa->fireAbility(); + } + else + { + GenericInstantAbility * wrapper = NEW GenericInstantAbility(game, 1, source, (Damageable *) (this->target), sa); + wrapper->addToGame(); + } + } + } return TargetAbility::resolve(); } @@ -3418,6 +3439,7 @@ GenericTargetAbility * GenericTargetAbility::clone() const GenericTargetAbility::~GenericTargetAbility() { SAFE_DELETE(ability); + SAFE_DELETE(sideEffects); } //Alter Cost