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