diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2007-06-30 15:01:50 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2007-06-30 15:01:50 +0000 |
commit | d7e84be1d3dc935f47cefc0f600ced74f37e46fb (patch) | |
tree | f535b6b4130994a9162c48f8c556b0dd5ddc9a5f /src/game-server/being.cpp | |
parent | fd392c16c0a1236ca4ea124b5ebbd309df1c5064 (diff) | |
download | manaserv-d7e84be1d3dc935f47cefc0f600ced74f37e46fb.tar.gz manaserv-d7e84be1d3dc935f47cefc0f600ced74f37e46fb.tar.bz2 manaserv-d7e84be1d3dc935f47cefc0f600ced74f37e46fb.tar.xz manaserv-d7e84be1d3dc935f47cefc0f600ced74f37e46fb.zip |
Implemented basic monster AI and fixed a stability problem caused by the spawn areas.
Diffstat (limited to 'src/game-server/being.cpp')
-rw-r--r-- | src/game-server/being.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp index 82457524..5bb608c6 100644 --- a/src/game-server/being.cpp +++ b/src/game-server/being.cpp @@ -36,11 +36,20 @@ Being::Being(int type, int id): } Being::~Being() -{} +{ + // Notify death listeners + DeathListeners::iterator i_end = mDeathListeners.end(); + DeathListeners::iterator i; + for (i = mDeathListeners.begin(); i != i_end; ++i) + { + (*i)->deleted(this); + } -void Being::damage(Damage damage) +} + +int Being::damage(Damage damage) { - if (mAction == DEAD) return; + if (mAction == DEAD) return 0; // TODO: Implement dodge chance @@ -73,6 +82,8 @@ void Being::damage(Damage damage) LOG_INFO("Being " << getPublicID() << " got hit"); if (mHitpoints == 0) die(); + + return HPloss; } void Being::die() @@ -109,8 +120,8 @@ void Being::move() void Being::performAttack(MapComposite *map) { - int SHORT_RANGE = 64; - int SMALL_ANGLE = 45; + int SHORT_RANGE = 60; + int SMALL_ANGLE = 35; Point ppos = getPosition(); int dir = getDirection(); |