diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 35572b186..8beb5c161 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -984,13 +984,14 @@ class AAMover: public ActivatedAbility { public: string destination; - + MTGAbility * andAbility; AAMover(int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest, ManaCost * _cost = NULL); MTGGameZone * destinationZone(Targetable * target = NULL); int resolve(); const char * getMenuText(); const char * getMenuText(TargetChooser * fromTc); AAMover * clone() const; + ~AAMover(); }; //----------------------------------------------------------------------------------------------- diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 416458839..6780486ae 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -1781,6 +1781,7 @@ AAMover::AAMover(int _id, MTGCardInstance * _source, MTGCardInstance * _target, { if (_target) target = _target; + andAbility = NULL; } MTGGameZone * AAMover::destinationZone(Targetable * target) @@ -1810,11 +1811,39 @@ int AAMover::resolve() MTGCardInstance * copy = g->players[i]->game->putInZone(_target, fromZone, g->players[i]->game->temp); Spell * spell = NEW Spell(copy); spell->resolve(); + if(andAbility) + { + MTGAbility * andAbilityClone = andAbility->clone(); + andAbilityClone->target = spell->source; + if(andAbility->oneShot) + { + andAbilityClone->resolve(); + SAFE_DELETE(andAbilityClone); + } + else + { + andAbilityClone->addToGame(); + } + } delete spell; return 1; } } p->game->putInZone(_target, fromZone, destZone); + if(andAbility) + { + MTGAbility * andAbilityClone = andAbility->clone(); + andAbilityClone->target = _target; + if(andAbility->oneShot) + { + andAbilityClone->resolve(); + SAFE_DELETE(andAbilityClone); + } + else + { + andAbilityClone->addToGame(); + } + } return 1; } } @@ -1889,7 +1918,15 @@ const char * AAMover::getMenuText(TargetChooser * tc) AAMover * AAMover::clone() const { - return NEW AAMover(*this); + AAMover * a = NEW AAMover(*this); + if(andAbility) + a->andAbility = andAbility->clone(); + return a; +} + +AAMover::~AAMover() +{ +SAFE_DELETE(andAbility); } //Random Discard diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 5de8e6b39..d4d9a29c4 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -1542,6 +1542,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG MTGAbility * a = NEW AAMover(id, card, target, splitMove[1]); a->oneShot = 1; + if(s.find("and(") != string::npos) + { + vector splitAnd = parseBetween(s, "and((", "))"); + if(splitAnd.size()) + { + ((AAMover*)a)->andAbility = parseMagicLine(splitAnd[1], id, spell, card); + } + } return a; }