1 #ifndef BATTLE_CAPSULE_H_
2 #define BATTLE_CAPSULE_H_
4 #include "AttackChoice.h"
5 #include "../common/fwd.h"
6 #include "../common/Stats.h"
7 #include "../geometry/Vector.h"
8 #include "../graphics/Animation.h"
9 #include "../graphics/fwd.h"
10 #include "../graphics/Menu.h"
20 const char *Name() const { return name; }
21 Uint8 Level() const { return level; }
22 const graphics::Sprite *Sprite() const { return battleSprite; }
24 Uint16 MaxHealth() const { return maxHealth; }
25 Uint16 Health() const { return health; }
26 int RelativeHealth(int max) const { return Health() * max / MaxHealth(); }
27 void SubtractHealth(int amount);
29 Uint16 MaxMana() const { return maxMana; }
30 Uint16 Mana() const { return mana; }
31 int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
32 bool CanUseMagic() const { return MaxMana() > 0; }
34 common::Stats &GetStats() { return stats; }
35 const common::Stats &GetStats() const { return stats; }
37 graphics::AnimationRunner &GetAnimation() { return animation; }
38 const graphics::AnimationRunner &GetAnimation() const { return animation; }
39 void SetAnimation(const graphics::AnimationRunner &a) { animation = a; }
41 const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
42 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
43 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
45 geometry::Vector<int> &Position() { return position; }
46 const geometry::Vector<int> &Position() const { return position; }
48 AttackChoice &GetAttackChoice() { return attackChoice; }
49 const AttackChoice &GetAttackChoice() const { return attackChoice; }
53 void SetName(const char *n) { name = n; }
54 void SetHealth(int max, int cur) { maxHealth = max; health = cur; }
55 void SetMana(int max, int cur) { maxMana = max; mana = cur; }
56 void SetLevel(int l) { level = l; }
57 void SetBattleSprite(graphics::Sprite *s) { battleSprite = s; }
58 void SetMeleeAnimation(graphics::Animation *a) { meleeAnimation = a; }
59 void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; }
60 void SetSpellAnimation(graphics::Animation *a) { spellAnimation = a; }
65 int maxHealth, health;
70 graphics::Sprite *battleSprite;
71 graphics::Animation *meleeAnimation;
72 graphics::Animation *attackAnimation;
73 graphics::Animation *spellAnimation;
75 graphics::AnimationRunner animation;
76 geometry::Vector<int> position;
77 AttackChoice attackChoice;
84 #endif /* BATTLE_CAPSULE_H_ */