diff --git a/projects/mtg/include/ExtraCost.h b/projects/mtg/include/ExtraCost.h index caa8bf35a..b69f50b23 100644 --- a/projects/mtg/include/ExtraCost.h +++ b/projects/mtg/include/ExtraCost.h @@ -155,6 +155,15 @@ public: virtual ToLibraryCost * clone() const; }; +//toGraveyard cost +class ToGraveCost : public ExtraCost +{ +public: + ToGraveCost(TargetChooser *_tc = NULL); + virtual int doPay(); + virtual ToGraveCost * clone() const; +}; + //Millyourself cost class MillCost : public ExtraCost { diff --git a/projects/mtg/src/ExtraCost.cpp b/projects/mtg/src/ExtraCost.cpp index 4437bd0f8..658e23a6b 100644 --- a/projects/mtg/src/ExtraCost.cpp +++ b/projects/mtg/src/ExtraCost.cpp @@ -391,6 +391,35 @@ int ToLibraryCost::doPay() return 0; } +//to graveyard cost +ToGraveCost * ToGraveCost::clone() const +{ + ToGraveCost * ec = NEW ToGraveCost(*this); + if (tc) + ec->tc = tc->clone(); + return ec; +} + +ToGraveCost::ToGraveCost(TargetChooser *_tc) + : ExtraCost("Move a card to Graveyard", _tc) +{ +} + +int ToGraveCost::doPay() +{ + MTGCardInstance * _target = (MTGCardInstance *) target; + if (target) + { + source->storedCard = target->createSnapShot(); + _target->controller()->game->putInGraveyard(target); + target = NULL; + if (tc) + tc->initTargets(); + return 1; + } + return 0; +} + //Mill yourself as a cost MillCost * MillCost::clone() const { diff --git a/projects/mtg/src/ManaCost.cpp b/projects/mtg/src/ManaCost.cpp index df9446c67..2d468c778 100644 --- a/projects/mtg/src/ManaCost.cpp +++ b/projects/mtg/src/ManaCost.cpp @@ -139,10 +139,14 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan } break; case 's': - if (value == "s2l") + if (value.find("s2l") != string::npos) { //Send To Library Cost (move from anywhere to Library) manaCost->addExtraCost(NEW ToLibraryCost(tc)); } + else if (value.find("s2g") != string::npos) + { //Send to Graveyard Cost (move from anywhere to Graveyard) + manaCost->addExtraCost(NEW ToGraveCost(tc)); + } else { //Sacrifice manaCost->addExtraCost(NEW SacrificeCost(tc));