4 * Created on: Aug 6, 2012
34 const char *Name() const { return name; }
35 Uint8 Level() const { return level; }
36 const graphics::Sprite *Sprite() const { return sprite; }
38 const std::vector<const common::Spell *> &Spells() const { return spells; }
40 Uint16 MaxHealth() const { return maxHealth; }
41 Uint16 Health() const { return health; }
42 int RelativeHealth(int max) const { return Health() * max / MaxHealth(); }
43 void SubtractHealth(int amount);
45 Uint16 MaxMana() const { return maxMana; }
46 Uint16 Mana() const { return mana; }
47 int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
48 bool CanUseMagic() const { return MaxMana() > 0; }
50 Uint8 MaxIP() const { return 255; }
51 Uint8 IP() const { return ip; }
52 int RelativeIP(int max) const { return IP() * max / MaxIP(); }
54 Stats &GetStats() { return stats; }
55 const Stats &GetStats() const { return stats; }
57 common::Item *Weapon() { return weapon; }
58 common::Item *Armor() { return armor; }
59 common::Item *Shield() { return shield; }
60 common::Item *Helmet() { return helmet; }
61 common::Item *Ring() { return ring; }
62 common::Item *Jewel() { return jewel; }
64 const common::Item *Weapon() const { return weapon; }
65 const common::Item *Armor() const { return armor; }
66 const common::Item *Shield() const { return shield; }
67 const common::Item *Helmet() const { return helmet; }
68 const common::Item *Ring() const { return ring; }
69 const common::Item *Jewel() const { return jewel; }
71 bool HasWeapon() const { return weapon; }
72 bool HasArmor() const { return armor; }
73 bool HasShield() const { return shield; }
74 bool HasHelmet() const { return helmet; }
75 bool HasRing() const { return ring; }
76 bool HasJewel() const { return jewel; }
78 graphics::Animation *MeleeAnimation() { return meleeAnimation; }
79 const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
80 graphics::Animation *AttackAnimation() { return attackAnimation; }
81 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
82 graphics::Animation *SpellAnimation() { return spellAnimation; }
83 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
85 // temporary setters until loader is implemented
87 void SetName(const char *n) { name = n; }
88 void SetLevel(Uint8 l) { level = l; }
89 void SetSprite(graphics::Sprite *s) { sprite = s; }
91 void SetMaxHealth(Uint16 h) { maxHealth = h; }
92 void SetHealth(Uint16 h) { health = h; }
93 void SetMaxMana(Uint16 m) { maxMana = m; }
94 void SetMana(Uint16 m) { mana = m; }
95 void SetIP(Uint8 i) { ip = i; }
97 void SetStats(const Stats &s) { stats = s; }
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;
142 #endif /* BATTLE_HERO_H_ */