]> git.localhorst.tv Git - l2e.git/blob - src/battle/Monster.h
bb44bb48ed2ce525b4612811ab49790f683e5868
[l2e.git] / src / battle / Monster.h
1 #ifndef BATTLE_MONSTER_H_
2 #define BATTLE_MONSTER_H_
3
4 #include "AttackChoice.h"
5 #include "../common/fwd.h"
6 #include "../common/Stats.h"
7 #include "../math/Vector.h"
8 #include "../graphics/Animation.h"
9 #include "../graphics/fwd.h"
10
11 #include <SDL.h>
12
13 namespace battle {
14
15 class Monster {
16
17 public:
18         static const int TYPE_ID = 202;
19
20 public:
21         Monster();
22         ~Monster();
23
24 public:
25         const char *Name() const { return name; }
26         Uint8 Level() const { return level; }
27         const graphics::Sprite *Sprite() const { return sprite; }
28
29         Uint16 MaxHealth() const { return maxHealth; }
30         Uint16 Health() const { return health; }
31         int RelativeHealth(int max) const { return health * max / maxHealth; }
32         void SubtractHealth(int amount);
33
34         Uint16 MaxMana() const { return maxMana; }
35         Uint16 Mana() const { return mana; }
36         int RelativeMana(int max) const { return mana * max / maxMana; }
37
38         common::Stats &GetStats() { return stats; }
39         const common::Stats &GetStats() const { return stats; }
40
41         Uint16 ExpReward() const { return expReward; }
42         Uint16 GoldReward() const { return goldReward; }
43
44         const common::Item *DropItem() const { return dropItem; }
45         Uint8 DropChance() const { return dropChance; }
46
47         const /* Script */ void *AttackScript() { return attackScript; }
48         const /* Script */ void *DefenseScript() { return defenseScript; }
49
50         graphics::AnimationRunner &GetAnimation() { return animation; }
51         const graphics::AnimationRunner &GetAnimation() const { return animation; }
52         void SetAnimation(const graphics::AnimationRunner &a) { animation = a; }
53
54         const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
55         const graphics::Animation *AttackAnimation() const { return attackAnimation; }
56         const graphics::Animation *SpellAnimation() const { return spellAnimation; }
57
58         math::Vector<int> &Position() { return position; }
59         const math::Vector<int> &Position() const { return position; }
60
61 // temporary setters until loader is implemented
62 public:
63         void SetName(const char *n) { name = n; }
64         void SetSprite(graphics::Sprite *s) { sprite = s; }
65         void SetLevel(Uint8 l) { level = l; }
66         void SetMaxHealth(Uint16 m) { maxHealth = m; }
67         void SetHealth(Uint16 h) { health = h; }
68         void SetMaxMana(Uint16 m) { maxMana = m; }
69         void SetMana(Uint16 m) { mana = m; }
70         void SetStats(const common::Stats &s) { stats = s; }
71         void SetReward(Uint16 exp, Uint16 gold) { expReward = exp; goldReward = gold; }
72
73         void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; }
74         void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; }
75         void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; }
76
77         AttackChoice &GetAttackChoice() { return attackChoice; }
78         const AttackChoice &GetAttackChoice() const { return attackChoice; }
79
80         static void CreateTypeDescription();
81         static void Construct(void *);
82
83 private:
84         const char *name;
85         graphics::Sprite *sprite;
86         common::Item *dropItem;
87         /* Script */ void *attackScript;
88         /* Script */ void *defenseScript;
89
90         const graphics::Animation *meleeAnimation;
91         const graphics::Animation *attackAnimation;
92         const graphics::Animation *spellAnimation;
93
94         graphics::AnimationRunner animation;
95
96         math::Vector<int> position;
97
98         AttackChoice attackChoice;
99
100         int maxHealth, health;
101         int maxMana, mana;
102
103         common::Stats stats;
104
105         int expReward, goldReward;
106
107         int level;
108         int dropChance;
109
110 };
111
112 }
113
114 #endif /* BATTLE_MONSTER_H_ */