diff options
Diffstat (limited to 'src/game-server/being.hpp')
-rw-r--r-- | src/game-server/being.hpp | 71 |
1 files changed, 43 insertions, 28 deletions
diff --git a/src/game-server/being.hpp b/src/game-server/being.hpp index 327783ce..2eaffa16 100644 --- a/src/game-server/being.hpp +++ b/src/game-server/being.hpp @@ -65,31 +65,6 @@ struct BeingState }; /** - * Moves enum for beings and actors for others players vision. - */ -enum -{ - ACTION_DEFAULT = 0, - ACTION_STAND, - ACTION_WALK, - ACTION_RUN, - ACTION_JUMP, - ACTION_CRAWL, - ACTION_ATTACK, - ACTION_ATTACK_SWING, - ACTION_ATTACK_STAB, - ACTION_ATTACK_BOW, - ACTION_ATTACK_THROW, - ACTION_CAST_MAGIC, - ACTION_USE_ITEM, - ACTION_SIT, - ACTION_SLEEP, - ACTION_HURT, - ACTION_DEAD, - ACTION_INVALID -}; - -/** * Beings and actors directions */ enum @@ -141,10 +116,24 @@ class Being : public MovingObject { public: /** + * Moves enum for beings and actors for others players vision. + * WARNING: Has to be in sync with the same enum in the Being class + * of the client! + */ + enum Action { + STAND, + WALK, + ATTACK, + SIT, + DEAD, + HURT + }; + /** * Proxy constructor. */ Being(int type, int id) - : MovingObject(type, id) + : MovingObject(type, id), + mAction(STAND) {} /** @@ -166,6 +155,12 @@ class Being : public MovingObject { return mStats.stats[numStat]; } /** + * sets the hit points + */ + void setHitpoints(int hp) + { mHitpoints = hp; } + + /** * Takes a damage structure, computes the real damage based on the * stats, deducts the result from the hitpoints and adds the result to * the HitsTaken list. @@ -173,6 +168,11 @@ class Being : public MovingObject void damage(Damage); /** + * Kills the being + */ + virtual void die(); + + /** * Gets the damage list. */ Hits const &getHitsTaken() const @@ -189,14 +189,29 @@ class Being : public MovingObject */ void performAttack(MapComposite *); + /** + * Sets the current action. + */ + virtual void setAction(Action action); + + virtual Action getAction() const + { return mAction; } + + /** + * Moves the being toward its destination. + */ + virtual void move(); + + protected: + int mHitpoints; /**< Hitpoints of the being */ + Action mAction; + private: Being(Being const &rhs); Being &operator=(Being const &rhs); Statistics mStats; /**< stats modifiers or computed stats */ - int mHitpoints; /**< Hitpoints of the being */ - Hits mHitsTaken; /**< List of punches taken since last update */ }; |