diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 06014cd6a..ea8750b18 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -658,6 +658,14 @@ private: { 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") { intValue = target->controller()->damageCount; diff --git a/projects/mtg/include/Damage.h b/projects/mtg/include/Damage.h index 8789dd4d0..5443f1b95 100644 --- a/projects/mtg/include/Damage.h +++ b/projects/mtg/include/Damage.h @@ -27,11 +27,12 @@ public: int preventable; int thatmuch; int lifeLostThisTurn; + int lifeGainedThisTurn; DamageableType type_as_damageable; Damageable(GameObserver* observer, int _life) : Targetable(observer), life(_life), handsize(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;} virtual int dealDamage(int damage){life-=damage;return life;} diff --git a/projects/mtg/src/GameObserver.cpp b/projects/mtg/src/GameObserver.cpp index 7cca9d03e..cf0ea0905 100644 --- a/projects/mtg/src/GameObserver.cpp +++ b/projects/mtg/src/GameObserver.cpp @@ -248,6 +248,8 @@ void GameObserver::nextGamePhase() currentPlayer->prowledTypes.clear(); currentPlayer->lifeLostThisTurn = 0; currentPlayer->opponent()->lifeLostThisTurn = 0; + currentPlayer->lifeGainedThisTurn = 0; + currentPlayer->opponent()->lifeGainedThisTurn = 0; currentPlayer->doesntEmpty->remove(currentPlayer->doesntEmpty); currentPlayer->opponent()->doesntEmpty->remove(currentPlayer->opponent()->doesntEmpty); nextPlayer(); diff --git a/projects/mtg/src/Player.cpp b/projects/mtg/src/Player.cpp index 964f105ba..7623e32e0 100644 --- a/projects/mtg/src/Player.cpp +++ b/projects/mtg/src/Player.cpp @@ -166,6 +166,10 @@ int Player::gainOrLoseLife(int value) life+=value; if (value<0) lifeLostThisTurn += abs(value); + else if (value > 0) + { + lifeGainedThisTurn += abs(value); + } //Send life event to listeners WEvent * lifed = NEW WEventLife(this,value);