4 * Created on: Aug 6, 2012
25 class AttackAnimation;
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(); }
44 Uint16 MaxMana() const { return maxMana; }
45 Uint16 Mana() const { return mana; }
46 int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
47 bool CanUseMagic() const { return MaxMana() > 0; }
49 Uint8 MaxIP() const { return 255; }
50 Uint8 IP() const { return ip; }
51 int RelativeIP(int max) const { return IP() * max / MaxIP(); }
53 Uint16 Attack() const { return attack; }
54 Uint16 Defense() const { return defense; }
55 Uint16 Agility() const { return agility; }
56 Uint16 Intelligence() const { return intelligence; }
57 Uint16 Gut() const { return gut; }
58 Uint16 MagicResistance() const { return magicResistance; }
60 const common::Item *Weapon() const { return weapon; }
61 const common::Item *Armor() const { return armor; }
62 const common::Item *Shield() const { return shield; }
63 const common::Item *Helmet() const { return helmet; }
64 const common::Item *Ring() const { return ring; }
65 const common::Item *Jewel() const { return jewel; }
67 bool HasWeapon() const { return weapon; }
68 bool HasArmor() const { return armor; }
69 bool HasShield() const { return shield; }
70 bool HasHelmet() const { return helmet; }
71 bool HasRing() const { return ring; }
72 bool HasJewel() const { return jewel; }
74 class AttackAnimation *MeleeAnimation() { return meleeAnimation; }
75 const class AttackAnimation *MeleeAnimation() const { return meleeAnimation; }
76 graphics::Animation *AttackAnimation() { return attackAnimation; }
77 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
78 graphics::Animation *SpellAnimation() { return spellAnimation; }
79 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
81 // temporary setters until loader is implemented
83 void SetName(const char *n) { name = n; }
84 void SetLevel(Uint8 l) { level = l; }
85 void SetSprite(graphics::Sprite *s) { sprite = s; }
87 void SetMaxHealth(Uint16 h) { maxHealth = h; }
88 void SetHealth(Uint16 h) { health = h; }
89 void SetMaxMana(Uint16 m) { maxMana = m; }
90 void SetMana(Uint16 m) { mana = m; }
91 void SetIP(Uint8 i) { ip = i; }
93 void SetWeapon(const common::Item *i) { weapon = i; }
94 void SetArmor(const common::Item *i) { armor = i; }
95 void SetShield(const common::Item *i) { shield = i; }
96 void SetHelmet(const common::Item *i) { helmet = i; }
97 void SetRing(const common::Item *i) { ring = i; }
98 void SetJewel(const common::Item *i) { jewel = i; }
100 void AddSpell(const common::Spell *s) { spells.push_back(s); }
102 void SetMeleeAnimation(class AttackAnimation *a) { meleeAnimation = a; }
103 void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; }
104 void SetSpellAnimation(graphics::Animation *a) { spellAnimation = a; }
108 graphics::Sprite *sprite;
110 const common::Item *weapon;
111 const common::Item *armor;
112 const common::Item *shield;
113 const common::Item *helmet;
114 const common::Item *ring;
115 const common::Item *jewel;
117 class AttackAnimation *meleeAnimation;
118 graphics::Animation *attackAnimation;
119 graphics::Animation *spellAnimation;
121 // TODO: vector does not seem to be a good choice
122 std::vector<const common::Spell *> spells;
124 Uint16 maxHealth, health;
125 Uint16 maxMana, mana;
132 Uint16 magicResistance;
141 #endif /* BATTLE_HERO_H_ */