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"
23 const char *Name() const { return name; }
24 Uint8 Level() const { return level; }
25 const graphics::Sprite *Sprite() const { return battleSprite; }
27 Uint16 MaxHealth() const { return maxHealth; }
28 Uint16 Health() const { return health; }
29 int RelativeHealth(int max) const { return Health() * max / MaxHealth(); }
30 void SubtractHealth(int amount);
32 Uint16 MaxMana() const { return maxMana; }
33 Uint16 Mana() const { return mana; }
34 int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
35 bool CanUseMagic() const { return MaxMana() > 0; }
37 common::Stats &GetStats() { return stats; }
38 const common::Stats &GetStats() const { return stats; }
40 graphics::AnimationRunner &GetAnimation() { return animation; }
41 const graphics::AnimationRunner &GetAnimation() const { return animation; }
42 void SetAnimation(const graphics::AnimationRunner &a) { animation = a; }
44 const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
45 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
46 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
48 geometry::Vector<int> &Position() { return position; }
49 const geometry::Vector<int> &Position() const { return position; }
51 AttackChoice &GetAttackChoice() { return attackChoice; }
52 const AttackChoice &GetAttackChoice() const { return attackChoice; }
56 void SetName(const char *n) { name = n; }
57 void SetHealth(int max, int cur) { maxHealth = max; health = cur; }
58 void SetMana(int max, int cur) { maxMana = max; mana = cur; }
59 void SetLevel(int l) { level = l; }
60 void SetBattleSprite(graphics::Sprite *s) { battleSprite = s; }
61 void SetMeleeAnimation(graphics::Animation *a) { meleeAnimation = a; }
62 void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; }
63 void SetSpellAnimation(graphics::Animation *a) { spellAnimation = a; }
68 int maxHealth, health;
73 graphics::Sprite *battleSprite;
74 graphics::Animation *meleeAnimation;
75 graphics::Animation *attackAnimation;
76 graphics::Animation *spellAnimation;
78 graphics::AnimationRunner animation;
79 geometry::Vector<int> position;
80 AttackChoice attackChoice;
87 #endif /* BATTLE_CAPSULE_H_ */