Bug Fix
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:
@@ -155,6 +155,15 @@ public:
|
|||||||
virtual ToLibraryCost * clone() const;
|
virtual ToLibraryCost * clone() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//toGraveyard cost
|
||||||
|
class ToGraveCost : public ExtraCost
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ToGraveCost(TargetChooser *_tc = NULL);
|
||||||
|
virtual int doPay();
|
||||||
|
virtual ToGraveCost * clone() const;
|
||||||
|
};
|
||||||
|
|
||||||
//Millyourself cost
|
//Millyourself cost
|
||||||
class MillCost : public ExtraCost
|
class MillCost : public ExtraCost
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -391,6 +391,35 @@ int ToLibraryCost::doPay()
|
|||||||
return 0;
|
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
|
//Mill yourself as a cost
|
||||||
MillCost * MillCost::clone() const
|
MillCost * MillCost::clone() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -139,10 +139,14 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
if (value == "s2l")
|
if (value.find("s2l") != string::npos)
|
||||||
{ //Send To Library Cost (move from anywhere to Library)
|
{ //Send To Library Cost (move from anywhere to Library)
|
||||||
manaCost->addExtraCost(NEW ToLibraryCost(tc));
|
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
|
else
|
||||||
{ //Sacrifice
|
{ //Sacrifice
|
||||||
manaCost->addExtraCost(NEW SacrificeCost(tc));
|
manaCost->addExtraCost(NEW SacrificeCost(tc));
|
||||||
|
|||||||
Reference in New Issue
Block a user