]> git.localhorst.tv Git - l2e.git/blob - src/battle/Monster.h
added melee animation of monsters
[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
13 #include <SDL.h>
14
15 namespace common { class Item; }
16 namespace graphics {
17         class Animation;
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::Animation *MeleeAnimation() { return meleeAnimation; }
56         const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
57         graphics::Animation *AttackAnimation() { return attackAnimation; }
58         const graphics::Animation *AttackAnimation() const { return attackAnimation; }
59         graphics::Animation *SpellAnimation() { return spellAnimation; }
60         const graphics::Animation *SpellAnimation() const { return spellAnimation; }
61
62 // temporary setters until loader is implemented
63 public:
64         void SetName(const char *n) { name = n; }
65         void SetSprite(graphics::Sprite *s) { sprite = s; }
66         void SetLevel(Uint8 l) { level = l; }
67         void SetMaxHealth(Uint16 m) { maxHealth = m; }
68         void SetHealth(Uint16 h) { health = h; }
69         void SetMaxMana(Uint16 m) { maxMana = m; }
70         void SetMana(Uint16 m) { mana = m; }
71         void SetStats(const Stats &s) { stats = s; }
72         void SetReward(Uint16 exp, Uint16 gold) { expReward = exp; goldReward = gold; }
73
74         void SetMeleeAnimation(graphics::Animation *a) { meleeAnimation = a; }
75         void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; }
76         void SetSpellAnimation(graphics::Animation *a) { spellAnimation = a; }
77
78 private:
79         const char *name;
80         graphics::Sprite *sprite;
81         common::Item *dropItem;
82         /* Script */ void *attackScript;
83         /* Script */ void *defenseScript;
84
85         graphics::Animation *meleeAnimation;
86         graphics::Animation *attackAnimation;
87         graphics::Animation *spellAnimation;
88
89         Uint16 maxHealth, health;
90         Uint16 maxMana, mana;
91
92         Stats stats;
93
94         Uint16 expReward, goldReward;
95
96         Uint8 level;
97         Uint8 dropChance;
98
99 };
100
101 }
102
103 #endif /* BATTLE_MONSTER_H_ */