diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2008-03-02 18:54:11 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2008-03-02 18:54:11 +0000 |
commit | 3cf2198e2485c80633f8d80d1a4c12843db86fde (patch) | |
tree | ecf35ba18c928275089e3614e48dc7dc7360ea79 /src | |
parent | 2fd66a97ffceb05ab0020545b81f5e5a8de06c13 (diff) | |
download | manaserv-3cf2198e2485c80633f8d80d1a4c12843db86fde.tar.gz manaserv-3cf2198e2485c80633f8d80d1a4c12843db86fde.tar.bz2 manaserv-3cf2198e2485c80633f8d80d1a4c12843db86fde.tar.xz manaserv-3cf2198e2485c80633f8d80d1a4c12843db86fde.zip |
Moved death check from Being::damage to Being::update for more reliable death detection and to fix the bug that the last hit on a monster does not count for exp calculation.
Diffstat (limited to 'src')
-rw-r--r-- | src/game-server/being.cpp | 7 | ||||
-rw-r--r-- | src/game-server/monster.cpp | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp index e0b16ed7..6cbf4c31 100644 --- a/src/game-server/being.cpp +++ b/src/game-server/being.cpp @@ -88,7 +88,6 @@ int Being::damage(Object *, Damage const &damage) LOG_DEBUG("Being " << getPublicID() << " suffered "<<HPloss<<" damage. HP: "<<HP.base + HP.mod<<"/"<<HP.base); HP.mod -= HPloss; modifiedAttribute(BASE_ATTR_HP); - if (HP.base + HP.mod <= 0) died(); return HPloss; } @@ -237,4 +236,10 @@ void Being::update() } ++i; } + + //check if being died + if (getModifiedAttribute(BASE_ATTR_HP) <= 0 && mAction != DEAD) + { + died(); + } } diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp index 10bc2b30..46225e9a 100644 --- a/src/game-server/monster.cpp +++ b/src/game-server/monster.cpp @@ -353,6 +353,8 @@ int Monster::damage(Object *source, Damage const &damage) void Monster::died() { + if (mAction == DEAD) return; + Being::died(); mCountDown = 50; // Sets remove time to 5 seconds |