]> git.localhorst.tv Git - l2e.git/blob - src/battle/Capsule.h
extracted battle logic into a class
[l2e.git] / src / battle / Capsule.h
1 #ifndef BATTLE_CAPSULE_H_
2 #define BATTLE_CAPSULE_H_
3
4 namespace common {
5         class Capsule;
6 }
7 namespace math {
8         template<class>
9         class Vector;
10 }
11
12 #include "AttackChoice.h"
13 #include "../common/Stats.h"
14 #include "../graphics/Animation.h"
15 #include "../graphics/Menu.h"
16
17 #include <SDL.h>
18
19 namespace battle {
20
21 class Capsule {
22
23 public:
24         Capsule(common::Capsule *master = 0);
25
26 public:
27         bool Active() const { return master; }
28
29         const char *Name() const;
30         Uint8 Level() const;
31         const graphics::Sprite *Sprite() const;
32
33         Uint16 MaxHealth() const;
34         Uint16 Health() const;
35         int RelativeHealth(int max) const;
36         void SubtractHealth(int amount);
37
38         common::Stats &GetStats() { return stats; }
39         const common::Stats &GetStats() const { return stats; }
40
41         graphics::AnimationRunner &GetAnimation() { return animation; }
42         const graphics::AnimationRunner &GetAnimation() const { return animation; }
43         void SetAnimation(const graphics::AnimationRunner &a) { animation = a; }
44
45         const graphics::Animation *MeleeAnimation() const;
46         const graphics::Animation *AttackAnimation() const;
47         const graphics::Animation *SpellAnimation() const;
48
49         math::Vector<int> &Position() { return position; }
50         const math::Vector<int> &Position() const { return position; }
51
52         AttackChoice &GetAttackChoice() { return attackChoice; }
53         const AttackChoice &GetAttackChoice() const { return attackChoice; }
54
55 private:
56         common::Capsule *master;
57
58         int health;
59
60         graphics::AnimationRunner animation;
61         math::Vector<int> position;
62         AttackChoice attackChoice;
63         common::Stats stats;
64
65 };
66
67 }
68
69 #endif