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