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