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