added lifegain and oplifegain variable used the same as lifelost, but stores the value of life gained this turn.

This commit is contained in:
zethfoxster
2016-07-21 21:11:15 -04:00
parent ca395492d5
commit 6aafe9dee0
4 changed files with 16 additions and 1 deletions

View File

@@ -658,6 +658,14 @@ private:
{ {
intValue = target->controller()->lifeLostThisTurn; intValue = target->controller()->lifeLostThisTurn;
} }
else if (s == "oplifegain")
{
intValue = target->controller()->opponent()->lifeGainedThisTurn;
}
else if (s == "lifegain")
{
intValue = target->controller()->lifeGainedThisTurn;
}
else if (s == "pdcount") else if (s == "pdcount")
{ {
intValue = target->controller()->damageCount; intValue = target->controller()->damageCount;

View File

@@ -27,11 +27,12 @@ public:
int preventable; int preventable;
int thatmuch; int thatmuch;
int lifeLostThisTurn; int lifeLostThisTurn;
int lifeGainedThisTurn;
DamageableType type_as_damageable; DamageableType type_as_damageable;
Damageable(GameObserver* observer, int _life) Damageable(GameObserver* observer, int _life)
: Targetable(observer), life(_life), handsize(0), : Targetable(observer), life(_life), handsize(0),
poisonCount(0), damageCount(0), preventable(0), thatmuch(0), poisonCount(0), damageCount(0), preventable(0), thatmuch(0),
lifeLostThisTurn(0), type_as_damageable(DAMAGEABLE_MTGCARDINSTANCE) lifeLostThisTurn(0), lifeGainedThisTurn(0), type_as_damageable(DAMAGEABLE_MTGCARDINSTANCE)
{} {}
int getLife(){return life;} int getLife(){return life;}
virtual int dealDamage(int damage){life-=damage;return life;} virtual int dealDamage(int damage){life-=damage;return life;}

View File

@@ -248,6 +248,8 @@ void GameObserver::nextGamePhase()
currentPlayer->prowledTypes.clear(); currentPlayer->prowledTypes.clear();
currentPlayer->lifeLostThisTurn = 0; currentPlayer->lifeLostThisTurn = 0;
currentPlayer->opponent()->lifeLostThisTurn = 0; currentPlayer->opponent()->lifeLostThisTurn = 0;
currentPlayer->lifeGainedThisTurn = 0;
currentPlayer->opponent()->lifeGainedThisTurn = 0;
currentPlayer->doesntEmpty->remove(currentPlayer->doesntEmpty); currentPlayer->doesntEmpty->remove(currentPlayer->doesntEmpty);
currentPlayer->opponent()->doesntEmpty->remove(currentPlayer->opponent()->doesntEmpty); currentPlayer->opponent()->doesntEmpty->remove(currentPlayer->opponent()->doesntEmpty);
nextPlayer(); nextPlayer();

View File

@@ -166,6 +166,10 @@ int Player::gainOrLoseLife(int value)
life+=value; life+=value;
if (value<0) if (value<0)
lifeLostThisTurn += abs(value); lifeLostThisTurn += abs(value);
else if (value > 0)
{
lifeGainedThisTurn += abs(value);
}
//Send life event to listeners //Send life event to listeners
WEvent * lifed = NEW WEventLife(this,value); WEvent * lifed = NEW WEventLife(this,value);