--- /dev/null
+/*
+ * Hero.h
+ *
+ * Created on: Oct 7, 2012
+ * Author: holy
+ */
+
+#ifndef COMMON_HERO_H_
+#define COMMON_HERO_H_
+
+#include "fwd.h"
+#include "Stats.h"
+#include "../graphics/fwd.h"
+
+#include <vector>
+
+namespace common {
+
+class Hero {
+
+public:
+ Hero();
+ ~Hero() { }
+
+public:
+ const char *Name() const { return name; }
+
+ Uint16 MaxHealth() const { return maxHealth; }
+ Uint16 Health() const { return health; }
+ int RelativeHealth(int max) const { return Health() * max / MaxHealth(); }
+ void SubtractHealth(int amount);
+
+ Uint16 MaxMana() const { return maxMana; }
+ Uint16 Mana() const { return mana; }
+ int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
+ bool CanUseMagic() const { return MaxMana() > 0; }
+
+ Uint8 MaxIP() const { return 255; }
+ Uint8 IP() const { return ip; }
+ int RelativeIP(int max) const { return IP() * max / MaxIP(); }
+
+ Stats &GetStats() { return stats; }
+ const Stats &GetStats() const { return stats; }
+
+ Uint8 Level() const { return level; }
+
+ Item *Weapon() { return weapon; }
+ Item *Armor() { return armor; }
+ Item *Shield() { return shield; }
+ Item *Helmet() { return helmet; }
+ Item *Ring() { return ring; }
+ Item *Jewel() { return jewel; }
+
+ const Item *Weapon() const { return weapon; }
+ const Item *Armor() const { return armor; }
+ const Item *Shield() const { return shield; }
+ const Item *Helmet() const { return helmet; }
+ const Item *Ring() const { return ring; }
+ const Item *Jewel() const { return jewel; }
+
+ bool HasWeapon() const { return weapon; }
+ bool HasArmor() const { return armor; }
+ bool HasShield() const { return shield; }
+ bool HasHelmet() const { return helmet; }
+ bool HasRing() const { return ring; }
+ bool HasJewel() const { return jewel; }
+
+ const std::vector<const Spell *> &Spells() const { return spells; }
+
+ graphics::Sprite *BattleSprite() { return battleSprite; }
+ graphics::Animation *MeleeAnimation() { return meleeAnimation; }
+ graphics::Animation *AttackAnimation() { return attackAnimation; }
+ graphics::Animation *SpellAnimation() { return spellAnimation; }
+
+ graphics::Sprite *MapSprite() { return mapSprite; }
+
+ static void CreateTypeDescription();
+ static void Construct(void *);
+
+// temporary setters
+public:
+ void SetWeapon(common::Item *i) { weapon = i; }
+ void SetArmor(common::Item *i) { armor = i; }
+ void SetShield(common::Item *i) { shield = i; }
+ void SetHelmet(common::Item *i) { helmet = i; }
+ void SetRing(common::Item *i) { ring = i; }
+ void SetJewel(common::Item *i) { jewel = i; }
+
+ void AddSpell(Spell *s) { spells.push_back(s); }
+
+private:
+ const char *name;
+
+ int maxHealth, health;
+ int maxMana, mana;
+ int ip;
+
+ Stats stats;
+
+ int level;
+
+ Item *weapon;
+ Item *armor;
+ Item *shield;
+ Item *helmet;
+ Item *ring;
+ Item *jewel;
+
+ // TODO: vector does not seem to be a good choice
+ std::vector<const Spell *> spells;
+
+ graphics::Sprite *battleSprite;
+ graphics::Animation *meleeAnimation;
+ graphics::Animation *attackAnimation;
+ graphics::Animation *spellAnimation;
+
+ graphics::Sprite *mapSprite;
+
+};
+
+}
+
+#endif /* COMMON_HERO_H_ */