- moved all "loseLife/gainLife" duplicated code into 1 Player method
This commit is contained in:
wagic.the.homebrew@gmail.com
2011-01-23 06:59:00 +00:00
parent 14f2e9b0f2
commit f63aa379e7
9 changed files with 88 additions and 92 deletions

View File

@@ -76,22 +76,16 @@ LifeCost::LifeCost(TargetChooser *_tc) :
int LifeCost::doPay()
{
if (!target)
return 0;
MTGCardInstance * _target = (MTGCardInstance *) target;
if (target)
{
_target->controller()->thatmuch = 1;
WEvent * lifed = NULL;
lifed = NEW WEventLife(_target->controller(),-1,1);
GameObserver * game = GameObserver::GetInstance();
game->receiveEvent(lifed);
_target->controller()->life -= 1;
_target->controller()->lifeLostThisTurn += 1;
target = NULL;
if (tc)
tc->initTargets();
return 1;
}
return 0;
_target->controller()->loseLife(1);
target = NULL;
if (tc)
tc->initTargets();
return 1;
}
//discard a card at random as a cost