4 * Created on: Aug 6, 2012
32 const char *Name() const { return name; }
33 Uint8 Level() const { return level; }
34 const graphics::Sprite *Sprite() const { return sprite; }
36 const std::vector<const common::Spell *> &Spells() const { return spells; }
38 Uint16 MaxHealth() const { return maxHealth; }
39 Uint16 Health() const { return health; }
40 int RelativeHealth(int max) const { return Health() * max / MaxHealth(); }
42 Uint16 MaxMana() const { return maxMana; }
43 Uint16 Mana() const { return mana; }
44 int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
45 bool CanUseMagic() const { return MaxMana() > 0; }
47 Uint8 MaxIP() const { return 255; }
48 Uint8 IP() const { return ip; }
49 int RelativeIP(int max) const { return IP() * max / MaxIP(); }
51 Uint16 Attack() const { return attack; }
52 Uint16 Defense() const { return defense; }
53 Uint16 Agility() const { return agility; }
54 Uint16 Intelligence() const { return intelligence; }
55 Uint16 Gut() const { return gut; }
56 Uint16 MagicResistance() const { return magicResistance; }
58 const common::Item *Weapon() const { return weapon; }
59 const common::Item *Armor() const { return armor; }
60 const common::Item *Shield() const { return shield; }
61 const common::Item *Helmet() const { return helmet; }
62 const common::Item *Ring() const { return ring; }
63 const common::Item *Jewel() const { return jewel; }
65 bool HasWeapon() const { return weapon; }
66 bool HasArmor() const { return armor; }
67 bool HasShield() const { return shield; }
68 bool HasHelmet() const { return helmet; }
69 bool HasRing() const { return ring; }
70 bool HasJewel() const { return jewel; }
72 graphics::Animation *AttackAnimation() { return attackAnimation; }
73 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
74 graphics::Animation *SpellAnimation() { return spellAnimation; }
75 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
77 // temporary setters until loader is implemented
79 void SetName(const char *n) { name = n; }
80 void SetLevel(Uint8 l) { level = l; }
81 void SetSprite(graphics::Sprite *s) { sprite = s; }
83 void SetMaxHealth(Uint16 h) { maxHealth = h; }
84 void SetHealth(Uint16 h) { health = h; }
85 void SetMaxMana(Uint16 m) { maxMana = m; }
86 void SetMana(Uint16 m) { mana = m; }
87 void SetIP(Uint8 i) { ip = i; }
89 void SetWeapon(const common::Item *i) { weapon = i; }
90 void SetArmor(const common::Item *i) { armor = i; }
91 void SetShield(const common::Item *i) { shield = i; }
92 void SetHelmet(const common::Item *i) { helmet = i; }
93 void SetRing(const common::Item *i) { ring = i; }
94 void SetJewel(const common::Item *i) { jewel = i; }
96 void AddSpell(const common::Spell *s) { spells.push_back(s); }
98 void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; }
99 void SetSpellAnimation(graphics::Animation *a) { spellAnimation = a; }
103 graphics::Sprite *sprite;
105 const common::Item *weapon;
106 const common::Item *armor;
107 const common::Item *shield;
108 const common::Item *helmet;
109 const common::Item *ring;
110 const common::Item *jewel;
112 graphics::Animation *attackAnimation;
113 graphics::Animation *spellAnimation;
115 // TODO: vector does not seem to be a good choice
116 std::vector<const common::Spell *> spells;
118 Uint16 maxHealth, health;
119 Uint16 maxMana, mana;
126 Uint16 magicResistance;
135 #endif /* BATTLE_HERO_H_ */