diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2006-12-29 12:22:02 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2006-12-29 12:22:02 +0000 |
commit | 3d404e743105bb9168c89e3451cf35d7d59120b1 (patch) | |
tree | 39389b921d054d508a5dee7d0ed7f4f3c5e7d29e /src/being.h | |
parent | 4bfa5b213257416f997d01b087c9e8bbb91cb3b9 (diff) | |
download | manaserv-3d404e743105bb9168c89e3451cf35d7d59120b1.tar.gz manaserv-3d404e743105bb9168c89e3451cf35d7d59120b1.tar.bz2 manaserv-3d404e743105bb9168c89e3451cf35d7d59120b1.tar.xz manaserv-3d404e743105bb9168c89e3451cf35d7d59120b1.zip |
Implemented basic attack hit detection and damage notification.
Diffstat (limited to 'src/being.h')
-rw-r--r-- | src/being.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/being.h b/src/being.h index fb6e837a..bf35d9fc 100644 --- a/src/being.h +++ b/src/being.h @@ -23,6 +23,7 @@ #ifndef _TMWSERV_BEING_H_ #define _TMWSERV_BEING_H_ +#include <list> #include <string> #include <vector> @@ -121,6 +122,7 @@ struct RawStatistics unsigned short stats[NB_RSTAT]; }; + /** * Computed statistics of a Being. */ @@ -143,6 +145,16 @@ struct Statistics }; /** + * Placeholder for a more complex damage structure + */ +typedef unsigned short Damage; + +/** + * Type definition for a list of hits + */ +typedef std::list<unsigned int> Hits; + +/** * Generic Being (living object). * Used for players & monsters (all animated objects). */ @@ -175,11 +187,28 @@ class Being : public MovingObject { return mStats.stats[numStat]; } /** + * 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 + */ + virtual void damage(Damage); + + /** + * Get the damage list + */ + Hits getHitsTaken() const + { return mHitsTaken; } + + /** + * Clears the hit list. * When a controller is set, updates the controller. */ - void + virtual void update(); + virtual void + performAttack(MapComposite*); + /** * Notification that this being is now possessed by the given * controller. This means that events regarding what happens to this @@ -195,6 +224,10 @@ class Being : public MovingObject Statistics mStats; /**< stats modifiers or computed stats */ Controller *mController; + + int mHitpoints; /**< Hitpoints of the being */ + + Hits mHitsTaken; /**< List of punches taken since last update */ }; /** |