4 * Created on: Aug 6, 2012
11 #include "AttackChoice.h"
13 #include "../graphics/Animation.h"
14 #include "../graphics/Menu.h"
36 const char *Name() const { return name; }
37 Uint8 Level() const { return level; }
38 const graphics::Sprite *Sprite() const { return sprite; }
40 const std::vector<const common::Spell *> &Spells() const { return spells; }
42 Uint16 MaxHealth() const { return maxHealth; }
43 Uint16 Health() const { return health; }
44 int RelativeHealth(int max) const { return Health() * max / MaxHealth(); }
45 void SubtractHealth(int amount);
47 Uint16 MaxMana() const { return maxMana; }
48 Uint16 Mana() const { return mana; }
49 int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
50 bool CanUseMagic() const { return MaxMana() > 0; }
52 Uint8 MaxIP() const { return 255; }
53 Uint8 IP() const { return ip; }
54 int RelativeIP(int max) const { return IP() * max / MaxIP(); }
56 Stats &GetStats() { return stats; }
57 const Stats &GetStats() const { return stats; }
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::AnimationRunner &GetAnimation() { return animation; }
81 const graphics::AnimationRunner &GetAnimation() const { return animation; }
82 void SetAnimation(const graphics::AnimationRunner &a) { animation = a; }
84 const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
85 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
86 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
88 graphics::Menu<const common::Spell *> &SpellMenu() { return spellMenu; }
89 const graphics::Menu<const common::Spell *> &SpellMenu() const { return spellMenu; }
90 graphics::Menu<const common::Item *> &IkariMenu() { return ikariMenu; }
91 const graphics::Menu<const common::Item *> &IkariMenu() const { return ikariMenu; }
93 AttackChoice &GetAttackChoice() { return attackChoice; }
94 const AttackChoice &GetAttackChoice() const { return attackChoice; }
96 // temporary setters until loader is implemented
98 void SetName(const char *n) { name = n; }
99 void SetLevel(Uint8 l) { level = l; }
100 void SetSprite(graphics::Sprite *s) { sprite = s; }
102 void SetMaxHealth(Uint16 h) { maxHealth = h; }
103 void SetHealth(Uint16 h) { health = h; }
104 void SetMaxMana(Uint16 m) { maxMana = m; }
105 void SetMana(Uint16 m) { mana = m; }
106 void SetIP(Uint8 i) { ip = i; }
108 void SetStats(const Stats &s) { stats = s; }
110 void SetWeapon(common::Item *i) { weapon = i; }
111 void SetArmor(common::Item *i) { armor = i; }
112 void SetShield(common::Item *i) { shield = i; }
113 void SetHelmet(common::Item *i) { helmet = i; }
114 void SetRing(common::Item *i) { ring = i; }
115 void SetJewel(common::Item *i) { jewel = i; }
117 void AddSpell(const common::Spell *s) { spells.push_back(s); }
119 void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; }
120 void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; }
121 void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; }
125 graphics::Sprite *sprite;
127 common::Item *weapon;
129 common::Item *shield;
130 common::Item *helmet;
134 const graphics::Animation *meleeAnimation;
135 const graphics::Animation *attackAnimation;
136 const graphics::Animation *spellAnimation;
138 graphics::AnimationRunner animation;
140 graphics::Menu<const common::Spell *> spellMenu;
141 graphics::Menu<const common::Item *> ikariMenu;
143 AttackChoice attackChoice;
145 // TODO: vector does not seem to be a good choice
146 std::vector<const common::Spell *> spells;
148 Uint16 maxHealth, health;
149 Uint16 maxMana, mana;
160 #endif /* BATTLE_HERO_H_ */