4 * Created on: Aug 6, 2012
18 namespace graphics { class Sprite; }
29 const char *Name() const { return name; }
30 Uint8 Level() const { return level; }
31 const graphics::Sprite *Sprite() const { return sprite; }
33 const std::vector<const common::Spell *> &Spells() const { return spells; }
35 Uint16 MaxHealth() const { return maxHealth; }
36 Uint16 Health() const { return health; }
37 int RelativeHealth(int max) const { return Health() * max / MaxHealth(); }
39 Uint16 MaxMana() const { return maxMana; }
40 Uint16 Mana() const { return mana; }
41 int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
42 bool CanUseMagic() const { return MaxMana() > 0; }
44 Uint8 MaxIP() const { return 255; }
45 Uint8 IP() const { return ip; }
46 int RelativeIP(int max) const { return IP() * max / MaxIP(); }
48 Uint16 Attack() const { return attack; }
49 Uint16 Defense() const { return defense; }
50 Uint16 Agility() const { return agility; }
51 Uint16 Intelligence() const { return intelligence; }
52 Uint16 Gut() const { return gut; }
53 Uint16 MagicResistance() const { return magicResistance; }
55 const common::Item *Weapon() const { return weapon; }
56 const common::Item *Armor() const { return armor; }
57 const common::Item *Shield() const { return shield; }
58 const common::Item *Helmet() const { return helmet; }
59 const common::Item *Ring() const { return ring; }
60 const common::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 // temporary setters until loader is implemented
71 void SetName(const char *n) { name = n; }
72 void SetLevel(Uint8 l) { level = l; }
73 void SetSprite(graphics::Sprite *s) { sprite = s; }
75 void SetMaxHealth(Uint16 h) { maxHealth = h; }
76 void SetHealth(Uint16 h) { health = h; }
77 void SetMaxMana(Uint16 m) { maxMana = m; }
78 void SetMana(Uint16 m) { mana = m; }
79 void SetIP(Uint8 i) { ip = i; }
81 void SetWeapon(const common::Item *i) { weapon = i; }
82 void SetArmor(const common::Item *i) { armor = i; }
83 void SetShield(const common::Item *i) { shield = i; }
84 void SetHelmet(const common::Item *i) { helmet = i; }
85 void SetRing(const common::Item *i) { ring = i; }
86 void SetJewel(const common::Item *i) { jewel = i; }
88 void AddSpell(const common::Spell *s) { spells.push_back(s); }
92 graphics::Sprite *sprite;
94 const common::Item *weapon;
95 const common::Item *armor;
96 const common::Item *shield;
97 const common::Item *helmet;
98 const common::Item *ring;
99 const common::Item *jewel;
101 // TODO: vector does not seem to be a good choice
102 std::vector<const common::Spell *> spells;
103 // TODO: equipment list
105 Uint16 maxHealth, health;
106 Uint16 maxMana, mana;
113 Uint16 magicResistance;
122 #endif /* BATTLE_HERO_H_ */