4 * Created on: Aug 3, 2012
8 #ifndef BATTLE_MONSTER_H_
9 #define BATTLE_MONSTER_H_
11 #include "AttackChoice.h"
13 #include "../graphics/Animation.h"
17 namespace common { class Item; }
31 const char *Name() const { return name; }
32 Uint8 Level() const { return level; }
33 const graphics::Sprite *Sprite() const { return sprite; }
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);
40 Uint16 MaxMana() const { return maxMana; }
41 Uint16 Mana() const { return mana; }
42 int RelativeMana(int max) const { return mana * max / maxMana; }
44 Stats &GetStats() { return stats; }
45 const Stats &GetStats() const { return stats; }
47 Uint16 ExpReward() const { return expReward; }
48 Uint16 GoldReward() const { return goldReward; }
50 const common::Item *DropItem() const { return dropItem; }
51 Uint8 DropChance() const { return dropChance; }
53 const /* Script */ void *AttackScript() { return attackScript; }
54 const /* Script */ void *DefenseScript() { return defenseScript; }
56 graphics::AnimationRunner &GetAnimation() { return animation; }
57 const graphics::AnimationRunner &GetAnimation() const { return animation; }
58 void SetAnimation(const graphics::AnimationRunner &a) { animation = a; }
60 const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
61 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
62 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
64 // temporary setters until loader is implemented
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; }
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; }
80 AttackChoice &GetAttackChoice() { return attackChoice; }
81 const AttackChoice &GetAttackChoice() const { return attackChoice; }
85 graphics::Sprite *sprite;
86 common::Item *dropItem;
87 /* Script */ void *attackScript;
88 /* Script */ void *defenseScript;
90 const graphics::Animation *meleeAnimation;
91 const graphics::Animation *attackAnimation;
92 const graphics::Animation *spellAnimation;
94 graphics::AnimationRunner animation;
96 AttackChoice attackChoice;
98 Uint16 maxHealth, health;
103 Uint16 expReward, goldReward;
112 #endif /* BATTLE_MONSTER_H_ */