diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index bbbbbe428..6f0579144 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -3791,35 +3791,6 @@ public: return a; } }; - -//reset card cost----------------------------------------- -class AResetCost: public MTGAbility -{ -public: - AResetCost(int id, MTGCardInstance * source, MTGCardInstance * target) : - MTGAbility(id, source, target) - { - - } - - int addToGame() - { - MTGCardInstance * _target = (MTGCardInstance *) target; - _target->controller()->game->putInZone(_target, _target->controller()->game->hand, _target->controller()->game->hand); - return MTGAbility::addToGame(); - } - - AResetCost * clone() const - { - AResetCost * a = NEW AResetCost(*this); - a->isClone = 1; - return a; - } - - ~AResetCost() - { - } -}; //bloodthirst ability------------------------------------------ class ABloodThirst: public MTGAbility { @@ -3860,10 +3831,13 @@ public: class AAlterCost: public MTGAbility { public: +MTGCardInstance * manaReducer; int amount; + int tempAmount; int type; AAlterCost(int id, MTGCardInstance * source, MTGCardInstance * target, int amount, int type); int addToGame(); + int testDestroy(); AAlterCost * clone() const; ~AAlterCost(); }; diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index 6fa590906..d4604a0f0 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -2131,6 +2131,7 @@ GenericTargetAbility::~GenericTargetAbility() AAlterCost::AAlterCost(int id, MTGCardInstance * source, MTGCardInstance * target, int amount, int type) : MTGAbility(id, source, target), amount(amount), type(type) { +manaReducer = source; } int AAlterCost::addToGame() @@ -2138,19 +2139,19 @@ int AAlterCost::addToGame() MTGCardInstance * _target = (MTGCardInstance *) target; if (amount < 0) { - amount = abs(amount); + tempAmount = abs(amount); if (_target->getManaCost()->hasColor(type)) { if (_target->getManaCost()->getConvertedCost() >= 1) { - _target->getManaCost()->remove(type, amount); + _target->getManaCost()->remove(type, tempAmount); if (_target->getManaCost()->alternative > 0) { - _target->getManaCost()->alternative->remove(type, amount); + _target->getManaCost()->alternative->remove(type, tempAmount); } if (_target->getManaCost()->BuyBack > 0) { - _target->getManaCost()->BuyBack->remove(type, amount); + _target->getManaCost()->BuyBack->remove(type, tempAmount); } } } @@ -2170,6 +2171,32 @@ int AAlterCost::addToGame() return MTGAbility::addToGame(); } +int AAlterCost::testDestroy() +{ + MTGCardInstance * _target = (MTGCardInstance *)target; + if(!this->manaReducer->isInPlay()) + { + if (amount > 0) + { + _target->getManaCost()->remove(type, amount); + if (_target->getManaCost()->alternative) + { + _target->getManaCost()->alternative->remove(type, amount); + } + if (_target->getManaCost()->BuyBack) + { + _target->getManaCost()->BuyBack->remove(type, amount); + } + } + else + { + _target->controller()->game->putInHand(_target); + } + return MTGAbility::testDestroy(); + } +return 0; +} + AAlterCost * AAlterCost::clone() const { AAlterCost * a = NEW AAlterCost(*this); diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index bee45b62e..0f66d290f 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -2490,13 +2490,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG if (s.find("altercost(") != string::npos) return getManaReduxAbility(s.substr(s.find("altercost(") + 10), id, spell, card, target); - //resetcost dirty code - found = s.find("resetcost"); - if (found != string::npos) - { - MTGAbility * a = NEW AResetCost(id, card, target); - return a; - } //transform....(hivestone,living enchantment) found = s.find("transforms("); if (found != string::npos)