4 * Created on: Aug 6, 2012
11 #include "AttackChoice.h"
13 #include "../graphics/Animation.h"
14 #include "../graphics/Menu.h"
38 const char *Name() const { return name; }
39 Uint8 Level() const { return level; }
40 const graphics::Sprite *Sprite() const { return sprite; }
42 const std::vector<const common::Spell *> &Spells() const { return spells; }
44 Uint16 MaxHealth() const { return maxHealth; }
45 Uint16 Health() const { return health; }
46 int RelativeHealth(int max) const { return Health() * max / MaxHealth(); }
47 void SubtractHealth(int amount);
49 Uint16 MaxMana() const { return maxMana; }
50 Uint16 Mana() const { return mana; }
51 int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
52 bool CanUseMagic() const { return MaxMana() > 0; }
54 Uint8 MaxIP() const { return 255; }
55 Uint8 IP() const { return ip; }
56 int RelativeIP(int max) const { return IP() * max / MaxIP(); }
58 Stats &GetStats() { return stats; }
59 const Stats &GetStats() const { return stats; }
61 common::Item *Weapon() { return weapon; }
62 common::Item *Armor() { return armor; }
63 common::Item *Shield() { return shield; }
64 common::Item *Helmet() { return helmet; }
65 common::Item *Ring() { return ring; }
66 common::Item *Jewel() { return jewel; }
68 const common::Item *Weapon() const { return weapon; }
69 const common::Item *Armor() const { return armor; }
70 const common::Item *Shield() const { return shield; }
71 const common::Item *Helmet() const { return helmet; }
72 const common::Item *Ring() const { return ring; }
73 const common::Item *Jewel() const { return jewel; }
75 bool HasWeapon() const { return weapon; }
76 bool HasArmor() const { return armor; }
77 bool HasShield() const { return shield; }
78 bool HasHelmet() const { return helmet; }
79 bool HasRing() const { return ring; }
80 bool HasJewel() const { return jewel; }
82 graphics::AnimationRunner &GetAnimation() { return animation; }
83 const graphics::AnimationRunner &GetAnimation() const { return animation; }
84 void SetAnimation(const graphics::AnimationRunner &a) { animation = a; }
86 const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
87 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
88 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
90 graphics::Menu<const common::Spell *> &SpellMenu() { return spellMenu; }
91 const graphics::Menu<const common::Spell *> &SpellMenu() const { return spellMenu; }
92 graphics::Menu<const common::Item *> &IkariMenu() { return ikariMenu; }
93 const graphics::Menu<const common::Item *> &IkariMenu() const { return ikariMenu; }
95 AttackChoice &GetAttackChoice() { return attackChoice; }
96 const AttackChoice &GetAttackChoice() const { return attackChoice; }
99 void UpdateSpellMenu();
100 void UpdateIkariMenu(const Resources *);
102 // temporary setters until loader is implemented
104 void SetName(const char *n) { name = n; }
105 void SetLevel(Uint8 l) { level = l; }
106 void SetSprite(graphics::Sprite *s) { sprite = s; }
108 void SetMaxHealth(Uint16 h) { maxHealth = h; }
109 void SetHealth(Uint16 h) { health = h; }
110 void SetMaxMana(Uint16 m) { maxMana = m; }
111 void SetMana(Uint16 m) { mana = m; }
112 void SetIP(Uint8 i) { ip = i; }
114 void SetStats(const Stats &s) { stats = s; }
116 void SetWeapon(common::Item *i) { weapon = i; }
117 void SetArmor(common::Item *i) { armor = i; }
118 void SetShield(common::Item *i) { shield = i; }
119 void SetHelmet(common::Item *i) { helmet = i; }
120 void SetRing(common::Item *i) { ring = i; }
121 void SetJewel(common::Item *i) { jewel = i; }
123 void AddSpell(const common::Spell *s) { spells.push_back(s); }
125 void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; }
126 void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; }
127 void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; }
131 graphics::Sprite *sprite;
133 common::Item *weapon;
135 common::Item *shield;
136 common::Item *helmet;
140 const graphics::Animation *meleeAnimation;
141 const graphics::Animation *attackAnimation;
142 const graphics::Animation *spellAnimation;
144 graphics::AnimationRunner animation;
146 graphics::Menu<const common::Spell *> spellMenu;
147 graphics::Menu<const common::Item *> ikariMenu;
149 AttackChoice attackChoice;
151 // TODO: vector does not seem to be a good choice
152 std::vector<const common::Spell *> spells;
154 Uint16 maxHealth, health;
155 Uint16 maxMana, mana;
166 #endif /* BATTLE_HERO_H_ */