add saclands cost
sacrifice all lands {saclands} cost
This commit is contained in:
@@ -183,6 +183,15 @@ public:
|
||||
virtual int doPay();
|
||||
};
|
||||
|
||||
//Sacrifice all Lands cost
|
||||
class SacLandsCost : public ExtraCost
|
||||
{
|
||||
public:
|
||||
SacLandsCost(TargetChooser *_tc = NULL);
|
||||
virtual int doPay();
|
||||
virtual SacLandsCost * clone() const;
|
||||
};
|
||||
|
||||
//unattach cost
|
||||
class UnattachCost : public ExtraCost
|
||||
{
|
||||
|
||||
@@ -641,6 +641,43 @@ int MillExileCost::doPay()
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//sac all lands cost
|
||||
SacLandsCost * SacLandsCost::clone() const
|
||||
{
|
||||
SacLandsCost * ec = NEW SacLandsCost(*this);
|
||||
if (tc)
|
||||
ec->tc = tc->clone();
|
||||
return ec;
|
||||
}
|
||||
|
||||
SacLandsCost::SacLandsCost(TargetChooser *_tc)
|
||||
: ExtraCost("Sacrifice All Lands", _tc)
|
||||
{
|
||||
}
|
||||
|
||||
int SacLandsCost::doPay()
|
||||
{
|
||||
MTGGameZone * zone = source->controller()->game->inPlay;
|
||||
for (int j = zone->nb_cards - 1; j >= 0; j--)
|
||||
{
|
||||
MTGCardInstance * card = zone->cards[j];
|
||||
if(card->isLand() && !card->has(Constants::CANTBESACRIFIED))
|
||||
{
|
||||
if (card)
|
||||
{
|
||||
MTGCardInstance * beforeCard = card;
|
||||
source->storedCard = card->createSnapShot();
|
||||
card->controller()->game->putInGraveyard(card);
|
||||
WEvent * e = NEW WEventCardSacrifice(beforeCard,card);
|
||||
GameObserver * game = card->owner->getObserver();
|
||||
game->receiveEvent(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//unattach cost
|
||||
|
||||
UnattachCost * UnattachCost::clone() const
|
||||
|
||||
@@ -147,6 +147,10 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
||||
{ //Send to Graveyard Cost (move from anywhere to Graveyard)
|
||||
manaCost->addExtraCost(NEW ToGraveCost(tc));
|
||||
}
|
||||
else if (value.find("saclands") != string::npos)
|
||||
{ //Sac all lands
|
||||
manaCost->addExtraCost(NEW SacLandsCost(tc));
|
||||
}
|
||||
else
|
||||
{ //Sacrifice
|
||||
manaCost->addExtraCost(NEW SacrificeCost(tc));
|
||||
|
||||
Reference in New Issue
Block a user