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 int AttackFrames() const { return attackFrames; }
70 int AttackFrameTime() const { return attackFrameTime; }
71 int SpellFrames() const { return spellFrames; }
72 int SpellFrameTime() const { return spellFrameTime; }
74 // temporary setters until loader is implemented
76 void SetName(const char *n) { name = n; }
77 void SetLevel(Uint8 l) { level = l; }
78 void SetSprite(graphics::Sprite *s) { sprite = s; }
80 void SetMaxHealth(Uint16 h) { maxHealth = h; }
81 void SetHealth(Uint16 h) { health = h; }
82 void SetMaxMana(Uint16 m) { maxMana = m; }
83 void SetMana(Uint16 m) { mana = m; }
84 void SetIP(Uint8 i) { ip = i; }
86 void SetWeapon(const common::Item *i) { weapon = i; }
87 void SetArmor(const common::Item *i) { armor = i; }
88 void SetShield(const common::Item *i) { shield = i; }
89 void SetHelmet(const common::Item *i) { helmet = i; }
90 void SetRing(const common::Item *i) { ring = i; }
91 void SetJewel(const common::Item *i) { jewel = i; }
93 void AddSpell(const common::Spell *s) { spells.push_back(s); }
95 void SetAttackFrames(int num, int time) { attackFrames = num; attackFrameTime = time; }
96 void SetSpellFrames(int num, int time) { spellFrames = num; spellFrameTime = time; }
100 graphics::Sprite *sprite;
102 const common::Item *weapon;
103 const common::Item *armor;
104 const common::Item *shield;
105 const common::Item *helmet;
106 const common::Item *ring;
107 const common::Item *jewel;
109 // TODO: vector does not seem to be a good choice
110 std::vector<const common::Spell *> spells;
117 Uint16 maxHealth, health;
118 Uint16 maxMana, mana;
125 Uint16 magicResistance;
134 #endif /* BATTLE_HERO_H_ */