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