]> git.localhorst.tv Git - l2e.git/blob - src/battle/Monster.h
moved monsters' attack choices to 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 "AttackChoice.h"
12 #include "Stats.h"
13 #include "../graphics/Animation.h"
14
15 #include <SDL.h>
16
17 namespace common { class Item; }
18 namespace graphics {
19         class Sprite;
20 }
21
22 namespace battle {
23
24 class Monster {
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         Stats &GetStats() { return stats; }
45         const 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 // temporary setters until loader is implemented
65 public:
66         void SetName(const char *n) { name = n; }
67         void SetSprite(graphics::Sprite *s) { sprite = s; }
68         void SetLevel(Uint8 l) { level = l; }
69         void SetMaxHealth(Uint16 m) { maxHealth = m; }
70         void SetHealth(Uint16 h) { health = h; }
71         void SetMaxMana(Uint16 m) { maxMana = m; }
72         void SetMana(Uint16 m) { mana = m; }
73         void SetStats(const Stats &s) { stats = s; }
74         void SetReward(Uint16 exp, Uint16 gold) { expReward = exp; goldReward = gold; }
75
76         void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; }
77         void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; }
78         void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; }
79
80         AttackChoice &GetAttackChoice() { return attackChoice; }
81         const AttackChoice &GetAttackChoice() const { return attackChoice; }
82
83 private:
84         const char *name;
85         graphics::Sprite *sprite;
86         common::Item *dropItem;
87         /* Script */ void *attackScript;
88         /* Script */ void *defenseScript;
89
90         const graphics::Animation *meleeAnimation;
91         const graphics::Animation *attackAnimation;
92         const graphics::Animation *spellAnimation;
93
94         graphics::AnimationRunner animation;
95
96         AttackChoice attackChoice;
97
98         Uint16 maxHealth, health;
99         Uint16 maxMana, mana;
100
101         Stats stats;
102
103         Uint16 expReward, goldReward;
104
105         Uint8 level;
106         Uint8 dropChance;
107
108 };
109
110 }
111
112 #endif /* BATTLE_MONSTER_H_ */