]> git.localhorst.tv Git - l2e.git/blob - src/common/Capsule.h
rough implementation of capsule feeding
[l2e.git] / src / common / Capsule.h
1 #ifndef COMMON_CAPSULE_H_
2 #define COMMON_CAPSULE_H_
3
4 namespace common {
5         class Item;
6 }
7 namespace graphics {
8         class Animation;
9         class Sprite;
10 }
11
12 #include "../common/Stats.h"
13 #include "../geometry/Vector.h"
14
15 #include <SDL.h>
16
17 namespace common {
18
19 class Spell;
20
21 class Capsule {
22
23 public:
24         static const int TYPE_ID = 307;
25
26 public:
27         Capsule();
28
29         const char *Name() const { return name; }
30         void SetName(const char *n) { name = n; }
31         const char *ClassName() const;
32         const char *Alignment() const { return alignment; }
33         const char *Tribe() const;
34         const Spell *Attack1() const;
35         const Spell *Attack2() const;
36         const Spell *Attack3() const;
37
38         int NumClasses() const { return numClasses; }
39         int MaxClass() const { return maxClass; }
40         int CurrentClass() const { return curClass; }
41
42         const geometry::Vector<int> &AlignmentOffset() const { return alignmentCursor; }
43         const graphics::Sprite *AlignmentSprite() const { return alignmentSprite; }
44
45         void UpgradeClass();
46         void NextClass();
47         void PreviousClass();
48         int ClassIndex() const { return curClass; }
49         void SetClass(int index);
50
51         int HungerEmpty() const;
52         int HungerTotal() const;
53         int HungerFull() const;
54         bool IsHungry() const;
55         void Feed(const common::Item *);
56
57         Uint16 MaxHealth() const;
58
59         Stats GetStats() const;
60
61         Uint8 Level() const { return level; }
62         int Experience() const { return experience; }
63         int NextLevel() const;
64
65         graphics::Sprite *BattleSprite();
66         const graphics::Sprite *BattleSprite() const;
67         graphics::Animation *MeleeAnimation();
68         graphics::Animation *AttackAnimation();
69         graphics::Animation *SpellAnimation();
70
71         static void CreateTypeDescription();
72         static void Construct(void *);
73
74 private:
75         struct Class {
76                 static const int TYPE_ID = 308;
77
78                 Class();
79
80                 static void CreateTypeDescription();
81                 static void Construct(void *);
82
83                 const char *name;
84                 const char *tribe;
85                 Spell *attacks[3];
86                 graphics::Sprite *battleSprite;
87                 graphics::Animation *meleeAnimation;
88                 graphics::Animation *attackAnimation;
89                 graphics::Animation *spellAnimation;
90
91                 int hunger;
92                 int hungerFull;
93
94                 int healthBoost;
95                 Stats statBoost;
96         };
97
98         Class &GetClass();
99         const Class &GetClass() const;
100
101         const char *name;
102         const char *alignment;
103
104         geometry::Vector<int> alignmentCursor;
105         const graphics::Sprite *alignmentSprite;
106
107         int maxHealth;
108
109         Stats stats;
110
111         int level;
112         int experience;
113
114         int *levelLadder;
115         int numLevels;
116
117         Class *classes;
118         int numClasses, curClass, maxClass;
119
120 };
121
122 }
123
124 #endif /* COMMON_CAPSULE_H_ */