add saclands cost

sacrifice all lands {saclands} cost
This commit is contained in:
Anthony Calosa
2017-02-19 22:11:16 +08:00
parent 5b16ff4a69
commit e6bf23e536
3 changed files with 50 additions and 0 deletions
+37
View File
@@ -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