diff options
author | Freeyorp <Freeyorp101@hotmail.com> | 2010-07-13 00:17:43 +1200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-08-03 17:58:50 +0200 |
commit | 3f0b8b1ba23854aa7e5b23ab6f9d9c4768dafe88 (patch) | |
tree | 235943a446217fbc3cc6312fd18fa9838b3fc431 | |
parent | 6e1d5a811339a75f80ebb66a697c16ef0e9a7e67 (diff) | |
download | manaserv-3f0b8b1ba23854aa7e5b23ab6f9d9c4768dafe88.tar.gz manaserv-3f0b8b1ba23854aa7e5b23ab6f9d9c4768dafe88.tar.xz manaserv-3f0b8b1ba23854aa7e5b23ab6f9d9c4768dafe88.zip |
Add sanity checks for hp when hp or max hp change.
Reviewed-by: Bertram.
-rw-r--r-- | src/game-server/character.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp index ae1ba37..c756194 100644 --- a/src/game-server/character.cpp +++ b/src/game-server/character.cpp @@ -410,8 +410,14 @@ void Character::modifiedAttribute(unsigned int attr) newBase = (temp * TICKS_PER_HP_REGENERATION); } break; + case ATTR_HP: + double diff; + if ((diff = getModifiedAttribute(ATTR_HP) - getModifiedAttribute(ATTR_MAX_HP)) > 0) + newBase -= diff; + break; case ATTR_MAX_HP: newBase = ((getModifiedAttribute(ATTR_VIT) + 3) * (getModifiedAttribute(ATTR_VIT) + 20)) * 0.125; + deps.insert(ATTR_HP); break; case ATTR_MOVE_SPEED_TPS: newBase = 3.0 + getModifiedAttribute(ATTR_AGI) * 0.08; // Provisional. |