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 common::Item *Weapon() { return weapon; }
59 common::Item *Armor() { return armor; }
60 common::Item *Shield() { return shield; }
61 common::Item *Helmet() { return helmet; }
62 common::Item *Ring() { return ring; }
63 common::Item *Jewel() { return jewel; }
65 const common::Item *Weapon() const { return weapon; }
66 const common::Item *Armor() const { return armor; }
67 const common::Item *Shield() const { return shield; }
68 const common::Item *Helmet() const { return helmet; }
69 const common::Item *Ring() const { return ring; }
70 const common::Item *Jewel() const { return jewel; }
72 bool HasWeapon() const { return weapon; }
73 bool HasArmor() const { return armor; }
74 bool HasShield() const { return shield; }
75 bool HasHelmet() const { return helmet; }
76 bool HasRing() const { return ring; }
77 bool HasJewel() const { return jewel; }
79 graphics::Animation *MeleeAnimation() { return meleeAnimation; }
80 const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
81 graphics::Animation *AttackAnimation() { return attackAnimation; }
82 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
83 graphics::Animation *SpellAnimation() { return spellAnimation; }
84 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
86 // temporary setters until loader is implemented
88 void SetName(const char *n) { name = n; }
89 void SetLevel(Uint8 l) { level = l; }
90 void SetSprite(graphics::Sprite *s) { sprite = s; }
92 void SetMaxHealth(Uint16 h) { maxHealth = h; }
93 void SetHealth(Uint16 h) { health = h; }
94 void SetMaxMana(Uint16 m) { maxMana = m; }
95 void SetMana(Uint16 m) { mana = m; }
96 void SetIP(Uint8 i) { ip = i; }
98 void SetWeapon(common::Item *i) { weapon = i; }
99 void SetArmor(common::Item *i) { armor = i; }
100 void SetShield(common::Item *i) { shield = i; }
101 void SetHelmet(common::Item *i) { helmet = i; }
102 void SetRing(common::Item *i) { ring = i; }
103 void SetJewel(common::Item *i) { jewel = i; }
105 void AddSpell(const common::Spell *s) { spells.push_back(s); }
107 void SetMeleeAnimation(graphics::Animation *a) { meleeAnimation = a; }
108 void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; }
109 void SetSpellAnimation(graphics::Animation *a) { spellAnimation = a; }
113 graphics::Sprite *sprite;
115 common::Item *weapon;
117 common::Item *shield;
118 common::Item *helmet;
122 graphics::Animation *meleeAnimation;
123 graphics::Animation *attackAnimation;
124 graphics::Animation *spellAnimation;
126 // TODO: vector does not seem to be a good choice
127 std::vector<const common::Spell *> spells;
129 Uint16 maxHealth, health;
130 Uint16 maxMana, mana;
137 Uint16 magicResistance;
146 #endif /* BATTLE_HERO_H_ */