Update ExtraCost.cpp

This commit is contained in:
Anthony Calosa
2014-11-27 14:33:43 +08:00
parent a76594046b
commit 92d52a78be

View File

@@ -151,6 +151,44 @@ int LifeCost::doPay()
return 1;
}
//Specific life cost
SpecificLifeCost * SpecificLifeCost::clone() const
{
SpecificLifeCost * ec = NEW SpecificLifeCost(*this);
if (tc)
ec->tc = tc->clone();
return ec;
}
SpecificLifeCost::SpecificLifeCost(TargetChooser *_tc, int slc)
: ExtraCost("Life", _tc), slc(slc)
{
}
int SpecificLifeCost::canPay()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if(_target->controller()->life >= slc)
{
return 1;
}
return 0;
}
int SpecificLifeCost::doPay()
{
if (!target)
return 0;
MTGCardInstance * _target = (MTGCardInstance *) target;
_target->controller()->loseLife(slc);
target = NULL;
if (tc)
tc->initTargets();
return 1;
}
//life or Mana cost
LifeorManaCost * LifeorManaCost::clone() const
{