Fix send to library as a cost and add support for moving a card to
graveyard as a cost(cards like Void Attendant from Battle for Zendikar)
This commit is contained in:
Anthony Calosa
2016-05-29 17:56:33 +08:00
parent 506adf63c9
commit c472a0215d
3 changed files with 43 additions and 1 deletions

View File

@@ -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
{