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