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(); }
41 void SubtractHealth(int amount);
43 Uint16 MaxMana() const { return maxMana; }
44 Uint16 Mana() const { return mana; }
45 int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
46 bool CanUseMagic() const { return MaxMana() > 0; }
48 Uint8 MaxIP() const { return 255; }
49 Uint8 IP() const { return ip; }
50 int RelativeIP(int max) const { return IP() * max / MaxIP(); }
52 Uint16 Attack() const { return attack; }
53 Uint16 Defense() const { return defense; }
54 Uint16 Agility() const { return agility; }
55 Uint16 Intelligence() const { return intelligence; }
56 Uint16 Gut() const { return gut; }
57 Uint16 MagicResistance() const { return magicResistance; }
59 common::Item *Weapon() { return weapon; }
60 common::Item *Armor() { return armor; }
61 common::Item *Shield() { return shield; }
62 common::Item *Helmet() { return helmet; }
63 common::Item *Ring() { return ring; }
64 common::Item *Jewel() { return jewel; }
66 const common::Item *Weapon() const { return weapon; }
67 const common::Item *Armor() const { return armor; }
68 const common::Item *Shield() const { return shield; }
69 const common::Item *Helmet() const { return helmet; }
70 const common::Item *Ring() const { return ring; }
71 const common::Item *Jewel() const { return jewel; }
73 bool HasWeapon() const { return weapon; }
74 bool HasArmor() const { return armor; }
75 bool HasShield() const { return shield; }
76 bool HasHelmet() const { return helmet; }
77 bool HasRing() const { return ring; }
78 bool HasJewel() const { return jewel; }
80 graphics::Animation *MeleeAnimation() { return meleeAnimation; }
81 const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
82 graphics::Animation *AttackAnimation() { return attackAnimation; }
83 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
84 graphics::Animation *SpellAnimation() { return spellAnimation; }
85 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
87 // temporary setters until loader is implemented
89 void SetName(const char *n) { name = n; }
90 void SetLevel(Uint8 l) { level = l; }
91 void SetSprite(graphics::Sprite *s) { sprite = s; }
93 void SetMaxHealth(Uint16 h) { maxHealth = h; }
94 void SetHealth(Uint16 h) { health = h; }
95 void SetMaxMana(Uint16 m) { maxMana = m; }
96 void SetMana(Uint16 m) { mana = m; }
97 void SetIP(Uint8 i) { ip = i; }
99 void SetWeapon(common::Item *i) { weapon = i; }
100 void SetArmor(common::Item *i) { armor = i; }
101 void SetShield(common::Item *i) { shield = i; }
102 void SetHelmet(common::Item *i) { helmet = i; }
103 void SetRing(common::Item *i) { ring = i; }
104 void SetJewel(common::Item *i) { jewel = i; }
106 void AddSpell(const common::Spell *s) { spells.push_back(s); }
108 void SetMeleeAnimation(graphics::Animation *a) { meleeAnimation = a; }
109 void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; }
110 void SetSpellAnimation(graphics::Animation *a) { spellAnimation = a; }
114 graphics::Sprite *sprite;
116 common::Item *weapon;
118 common::Item *shield;
119 common::Item *helmet;
123 graphics::Animation *meleeAnimation;
124 graphics::Animation *attackAnimation;
125 graphics::Animation *spellAnimation;
127 // TODO: vector does not seem to be a good choice
128 std::vector<const common::Spell *> spells;
130 Uint16 maxHealth, health;
131 Uint16 maxMana, mana;
138 Uint16 magicResistance;
147 #endif /* BATTLE_HERO_H_ */