]> git.localhorst.tv Git - l2e.git/blob - src/common/Capsule.h
bf99cfa1ad376660c322c97640515ec9b71f4dce
[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         const common::Item *UpgradeItem() const;
58         void UpgradeSpecial();
59
60         Uint16 MaxHealth() const;
61
62         Stats GetStats() const;
63
64         Uint8 Level() const { return level; }
65         int Experience() const { return experience; }
66         int NextLevel() const;
67
68         graphics::Sprite *BattleSprite();
69         const graphics::Sprite *BattleSprite() const;
70         graphics::Animation *MeleeAnimation();
71         graphics::Animation *AttackAnimation();
72         graphics::Animation *SpellAnimation();
73
74         static void CreateTypeDescription();
75         static void Construct(void *);
76
77 private:
78         struct Class {
79                 static const int TYPE_ID = 308;
80
81                 Class();
82
83                 static void CreateTypeDescription();
84                 static void Construct(void *);
85
86                 const char *name;
87                 const char *tribe;
88                 Spell *attacks[3];
89                 graphics::Sprite *battleSprite;
90                 graphics::Animation *meleeAnimation;
91                 graphics::Animation *attackAnimation;
92                 graphics::Animation *spellAnimation;
93
94                 const common::Item *upgradeItem;
95                 int upgradeClass;
96                 int hunger;
97                 int hungerFull;
98
99                 int healthBoost;
100                 Stats statBoost;
101         };
102
103         Class &GetClass();
104         const Class &GetClass() const;
105
106         const char *name;
107         const char *alignment;
108
109         geometry::Vector<int> alignmentCursor;
110         const graphics::Sprite *alignmentSprite;
111
112         int maxHealth;
113
114         Stats stats;
115
116         int level;
117         int experience;
118
119         int *levelLadder;
120         int numLevels;
121
122         Class *classes;
123         int numClasses, curClass, maxClass;
124
125 };
126
127 }
128
129 #endif /* COMMON_CAPSULE_H_ */