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