diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index b7b4766b6..0f03c63d6 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1665,7 +1665,7 @@ public: const string getMenuText(); AACopier * clone() const; }; -//imprint +//phaseout class AAPhaseOut: public ActivatedAbility { public: @@ -1674,6 +1674,15 @@ public: const string getMenuText(); AAPhaseOut * clone() const; }; +//AAImprint +class AAImprint: public ActivatedAbility +{ +public: + AAImprint(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL); + int resolve(); + const string getMenuText(); + AAImprint * clone() const; +}; //cloning...this makes a token thats a copy of the target. class AACloner: public ActivatedAbility { @@ -1703,8 +1712,7 @@ public: string named; bool undying; bool persist; - bool imprint; - AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL, bool undying = false, bool persist = false, bool imprint = false); + AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL, bool undying = false, bool persist = false); MTGGameZone * destinationZone(Targetable * target = NULL); int resolve(); const string getMenuText(); diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 7b4da141e..21d0ccba5 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -511,7 +511,7 @@ AACopier * AACopier::clone() const return NEW AACopier(*this); } -//phaser +//phaseout AAPhaseOut::AAPhaseOut(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) : ActivatedAbility(observer, _id, _source, _cost, 0) { @@ -544,6 +544,60 @@ AAPhaseOut * AAPhaseOut::clone() const return NEW AAPhaseOut(*this); } +//AAImprint +AAImprint::AAImprint(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) : + ActivatedAbility(observer, _id, _source, _cost, 0) +{ + target = _target; +} + +int AAImprint::resolve() +{ + MTGCardInstance * _target = (MTGCardInstance *) target; + if (_target) + { + Player * p = _target->controller(); + if(p) + p->game->putInExile(_target); + + while(_target->next) + _target = _target->next; + + source->imprintedCards.push_back(_target); + + if (source->imprintedCards.size()) + { + if (source->imprintedCards.back()->hasColor(Constants::MTG_COLOR_GREEN)) + source->imprintG += 1; + if (source->imprintedCards.back()->hasColor(Constants::MTG_COLOR_BLUE)) + source->imprintU += 1; + if (source->imprintedCards.back()->hasColor(Constants::MTG_COLOR_RED)) + source->imprintR += 1; + if (source->imprintedCards.back()->hasColor(Constants::MTG_COLOR_BLACK)) + source->imprintB += 1; + if (source->imprintedCards.back()->hasColor(Constants::MTG_COLOR_WHITE)) + source->imprintW += 1; + if (source->imprintedCards.back()->getName().size()) + { + source->currentimprintName = source->imprintedCards.back()->getName(); + source->imprintedNames.push_back(source->imprintedCards.back()->getName()); + } + } + return 1; + } + return 0; +} + +const string AAImprint::getMenuText() +{ + return "Imprint"; +} + +AAImprint * AAImprint::clone() const +{ + return NEW AAImprint(*this); +} + //Counters AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string counterstring, const char * _name, int power, int toughness, int nb,int maxNb, ManaCost * cost) : @@ -2928,8 +2982,8 @@ AInstantCastRestrictionUEOT::~AInstantCastRestrictionUEOT() //AAMover -AAMover::AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string newName, ManaCost * _cost, bool undying, bool persist, bool imprint) : - ActivatedAbility(observer, _id, _source, _cost, 0), destination(dest),named(newName),undying(undying),persist(persist),imprint(imprint) +AAMover::AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string newName, ManaCost * _cost, bool undying, bool persist) : + ActivatedAbility(observer, _id, _source, _cost, 0), destination(dest),named(newName),undying(undying),persist(persist) { if (_target) target = _target; @@ -2987,8 +3041,6 @@ int AAMover::resolve() p->game->putInZone(_target, fromZone, destZone); while(_target->next) _target = _target->next; - if (imprint) - source->imprintedCards.push_back(_target); if(andAbility) { MTGAbility * andAbilityClone = andAbility->clone(); @@ -3065,8 +3117,6 @@ const char* AAMover::getMenuText(TargetChooser * tc) // move card into exile else if (dest == game->players[i]->game->exile) { - if(imprint) - return "Imprint"; return "Exile"; } diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 1ceca665d..435b97688 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -693,37 +693,15 @@ void GameObserver::gameStateBasedEffects() for(size_t ic = 0; ic < card->imprintedCards.size(); ic++) { if(!isInExile(card->imprintedCards[ic])) - card->imprintedCards.erase(card->imprintedCards.begin() + ic); - } - } - //reset imprints - if(isInPlay(card)) - { - card->imprintG = 0; - card->imprintU = 0; - card->imprintR = 0; - card->imprintB = 0; - card->imprintW = 0; - card->currentimprintName = ""; - if (card->imprintedCards.size()) - { - for(size_t i = 0; i < card->imprintedCards.size(); i++) { - if (card->imprintedCards[i]->hasColor(Constants::MTG_COLOR_GREEN)) - card->imprintG += 1; - if (card->imprintedCards[i]->hasColor(Constants::MTG_COLOR_BLUE)) - card->imprintU += 1; - if (card->imprintedCards[i]->hasColor(Constants::MTG_COLOR_RED)) - card->imprintR += 1; - if (card->imprintedCards[i]->hasColor(Constants::MTG_COLOR_BLACK)) - card->imprintB += 1; - if (card->imprintedCards[i]->hasColor(Constants::MTG_COLOR_WHITE)) - card->imprintW += 1; - if (card->imprintedCards[i]->getName().size()) - { - card->currentimprintName = card->imprintedCards[i]->getName(); - card->imprintedNames.push_back(card->imprintedCards[i]->getName()); - } + card->imprintG = 0; + card->imprintU = 0; + card->imprintR = 0; + card->imprintB = 0; + card->imprintW = 0; + card->currentimprintName = ""; + card->imprintedNames.clear(); + card->imprintedCards.erase(card->imprintedCards.begin() + ic); } } } diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 6d57241f6..58abcadce 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -2378,7 +2378,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG found = s.find("imprint"); if (found != string::npos) { - MTGAbility * a = NEW AAMover(observer, id, card, target, "exile",newName,NULL,false,false,true); + MTGAbility * a = NEW AAImprint(observer, id, card, target); a->oneShot = 1; return a; }