summaryrefslogtreecommitdiff
path: root/src/game-server/being.hpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2007-03-02 23:30:17 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2007-03-02 23:30:17 +0000
commitaf1ce69940a9c0b46907402e7d69e6ac9ea96912 (patch)
tree016a6a8a4734f794e56093e1611530749eb7fab0 /src/game-server/being.hpp
parent07782116ae9158c20165dd4d60bdb96017ac009f (diff)
downloadmanaserv-af1ce69940a9c0b46907402e7d69e6ac9ea96912.tar.gz
manaserv-af1ce69940a9c0b46907402e7d69e6ac9ea96912.tar.bz2
manaserv-af1ce69940a9c0b46907402e7d69e6ac9ea96912.tar.xz
manaserv-af1ce69940a9c0b46907402e7d69e6ac9ea96912.zip
Implemented being death, removal of dead mobs and sitting.
Diffstat (limited to 'src/game-server/being.hpp')
-rw-r--r--src/game-server/being.hpp71
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 */
};