diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 68e264bf7..cb4b337d5 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -58,6 +58,10 @@ private: return; MTGCardInstance * target = card->target; intValue = 0; + if(s.find("stored") != string::npos) + { + return init(s.substr(+6),spell,card->storedCard); + } bool halfup = false; bool halfdown = false; if (!target) target = card; @@ -2898,6 +2902,7 @@ public: setAbilityOwner(); myDummy->setObserver(abilityReciever->getObserver()); myDummy->owner = abilityReciever; + myDummy->storedCard = source; vectormagictextlines = split(sabilities,'_'); if(magictextlines.size()) { diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index c2c36a3eb..f14aa1d07 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -154,6 +154,7 @@ public: int canAttack(); int isAttacker(); Targetable * isAttacking; + MTGCardInstance * storedCard; MTGCardInstance * isDefenser(); int initAttackersDefensers(); MTGCardInstance * getNextOpponent(MTGCardInstance * previous=NULL); diff --git a/projects/mtg/src/ExtraCost.cpp b/projects/mtg/src/ExtraCost.cpp index f97126b30..8d233828d 100644 --- a/projects/mtg/src/ExtraCost.cpp +++ b/projects/mtg/src/ExtraCost.cpp @@ -186,6 +186,7 @@ int DiscardRandomCost::doPay() MTGCardInstance * _target = (MTGCardInstance *) target; if (target) { + source->storedCard = target; _target->controller()->game->discardRandom(_target->controller()->game->hand, source); target = NULL; if (tc) @@ -214,6 +215,7 @@ int DiscardCost::doPay() MTGCardInstance * _target = (MTGCardInstance *) target; if (target) { + source->storedCard = target; WEvent * e = NEW WEventCardDiscard(target); GameObserver * game = target->owner->getObserver(); game->receiveEvent(e); @@ -277,6 +279,7 @@ int ToLibraryCost::doPay() MTGCardInstance * _target = (MTGCardInstance *) target; if (target) { + source->storedCard = target; _target->controller()->game->putInLibrary(target); target = NULL; if (tc) @@ -314,6 +317,7 @@ int MillCost::doPay() MTGCardInstance * _target = (MTGCardInstance *) target; if (target) { + source->storedCard = target; _target->controller()->game->putInZone( _target->controller()->game->library->cards[_target->controller()->game->library->nb_cards - 1], _target->controller()->game->library, _target->controller()->game->graveyard); @@ -335,6 +339,7 @@ MillExileCost::MillExileCost(TargetChooser *_tc) int MillExileCost::doPay() { MTGCardInstance * _target = (MTGCardInstance *) target; + source->storedCard = target; if (target) { _target->controller()->game->putInZone( @@ -452,6 +457,7 @@ int TapTargetCost::isPaymentSet() int TapTargetCost::doPay() { MTGCardInstance * _target = (MTGCardInstance *) target; + source->storedCard = target; if (target) { _target->tap(); @@ -482,6 +488,7 @@ int ExileTargetCost::doPay() if (target) { + source->storedCard = target; target->controller()->game->putInExile(target); target = NULL; if (tc) @@ -510,6 +517,7 @@ int BounceTargetCost::doPay() if (target) { + source->storedCard = target; target->controller()->game->putInHand(target); target = NULL; if (tc) @@ -589,6 +597,7 @@ int SacrificeCost::doPay() if (target) { MTGCardInstance * beforeCard = target; + source->storedCard = target; target->controller()->game->putInGraveyard(target); WEvent * e = NEW WEventCardSacrifice(beforeCard,target); GameObserver * game = target->owner->getObserver(); @@ -762,6 +771,7 @@ int ExtraCosts::setAction(MTGAbility * _action, MTGCardInstance * _card) { action = _action; source = _card; + source->storedCard = NULL; for (size_t i = 0; i < costs.size(); i++) { costs[i]->setSource(_card); @@ -772,6 +782,7 @@ int ExtraCosts::setAction(MTGAbility * _action, MTGCardInstance * _card) int ExtraCosts::reset() { action = NULL; + source->storedCard = NULL; source = NULL; //TODO set all payments to "unset" return 1; diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 68a6285a9..15261cad2 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -156,6 +156,7 @@ void MTGCardInstance::initMTGCI() chooseasubtype = ""; coinSide = -1; isAttacking = NULL; + storedCard = NULL; for (int i = 0; i < ManaCost::MANA_PAID_WITH_RETRACE +1; i++) alternateCostPaid[i] = 0; diff --git a/projects/mtg/src/TargetChooser.cpp b/projects/mtg/src/TargetChooser.cpp index 8226f9700..e03314c0a 100644 --- a/projects/mtg/src/TargetChooser.cpp +++ b/projects/mtg/src/TargetChooser.cpp @@ -664,6 +664,10 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta { return NEW CardTargetChooser(observer, card, card, zones, nbzones); } + else if (typeName.compare("mystored") == 0) + { + return NEW CardTargetChooser(observer, card->storedCard, card, zones, nbzones); + } else { tc = NEW TypeTargetChooser(observer, typeName.c_str(), zones, nbzones, card, maxtargets, other, targetMin);