4 * Created on: Oct 7, 2012
13 #include "../graphics/fwd.h"
14 #include "../map/Entity.h"
27 const char *Name() const { return name; }
29 Uint16 MaxHealth() const { return maxHealth; }
30 Uint16 Health() const { return health; }
31 int RelativeHealth(int max) const { return Health() * max / MaxHealth(); }
32 void SubtractHealth(int amount);
34 Uint16 MaxMana() const { return maxMana; }
35 Uint16 Mana() const { return mana; }
36 int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
37 bool CanUseMagic() const { return MaxMana() > 0; }
39 Uint8 MaxIP() const { return 255; }
40 Uint8 IP() const { return ip; }
41 int RelativeIP(int max) const { return IP() * max / MaxIP(); }
43 Stats &GetStats() { return stats; }
44 const Stats &GetStats() const { return stats; }
46 Uint8 Level() const { return level; }
48 Item *Weapon() { return weapon; }
49 Item *Armor() { return armor; }
50 Item *Shield() { return shield; }
51 Item *Helmet() { return helmet; }
52 Item *Ring() { return ring; }
53 Item *Jewel() { return jewel; }
55 const Item *Weapon() const { return weapon; }
56 const Item *Armor() const { return armor; }
57 const Item *Shield() const { return shield; }
58 const Item *Helmet() const { return helmet; }
59 const Item *Ring() const { return ring; }
60 const Item *Jewel() const { return jewel; }
62 bool HasWeapon() const { return weapon; }
63 bool HasArmor() const { return armor; }
64 bool HasShield() const { return shield; }
65 bool HasHelmet() const { return helmet; }
66 bool HasRing() const { return ring; }
67 bool HasJewel() const { return jewel; }
69 const std::vector<const Spell *> &Spells() const { return spells; }
71 graphics::Sprite *BattleSprite() { return battleSprite; }
72 graphics::Animation *MeleeAnimation() { return meleeAnimation; }
73 graphics::Animation *AttackAnimation() { return attackAnimation; }
74 graphics::Animation *SpellAnimation() { return spellAnimation; }
76 map::Entity &MapEntity() { return mapEntity; }
77 const map::Entity &MapEntity() const { return mapEntity; }
79 static void CreateTypeDescription();
80 static void Construct(void *);
84 void SetWeapon(common::Item *i) { weapon = i; }
85 void SetArmor(common::Item *i) { armor = i; }
86 void SetShield(common::Item *i) { shield = i; }
87 void SetHelmet(common::Item *i) { helmet = i; }
88 void SetRing(common::Item *i) { ring = i; }
89 void SetJewel(common::Item *i) { jewel = i; }
91 void AddSpell(Spell *s) { spells.push_back(s); }
96 int maxHealth, health;
111 // TODO: vector does not seem to be a good choice
112 std::vector<const Spell *> spells;
114 graphics::Sprite *battleSprite;
115 graphics::Animation *meleeAnimation;
116 graphics::Animation *attackAnimation;
117 graphics::Animation *spellAnimation;
119 map::Entity mapEntity;
125 #endif /* COMMON_HERO_H_ */