4 * Created on: Aug 3, 2012
8 #ifndef BATTLE_MONSTER_H_
9 #define BATTLE_MONSTER_H_
12 #include "../graphics/Animation.h"
16 namespace common { class Item; }
30 const char *Name() const { return name; }
31 Uint8 Level() const { return level; }
32 const graphics::Sprite *Sprite() const { return sprite; }
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);
39 Uint16 MaxMana() const { return maxMana; }
40 Uint16 Mana() const { return mana; }
41 int RelativeMana(int max) const { return mana * max / maxMana; }
43 Stats &GetStats() { return stats; }
44 const Stats &GetStats() const { return stats; }
46 Uint16 ExpReward() const { return expReward; }
47 Uint16 GoldReward() const { return goldReward; }
49 const common::Item *DropItem() const { return dropItem; }
50 Uint8 DropChance() const { return dropChance; }
52 const /* Script */ void *AttackScript() { return attackScript; }
53 const /* Script */ void *DefenseScript() { return defenseScript; }
55 graphics::AnimationRunner &GetAnimation() { return animation; }
56 const graphics::AnimationRunner &GetAnimation() const { return animation; }
57 void SetAnimation(const graphics::AnimationRunner &a) { animation = a; }
59 const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
60 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
61 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
63 // temporary setters until loader is implemented
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; }
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; }
81 graphics::Sprite *sprite;
82 common::Item *dropItem;
83 /* Script */ void *attackScript;
84 /* Script */ void *defenseScript;
86 const graphics::Animation *meleeAnimation;
87 const graphics::Animation *attackAnimation;
88 const graphics::Animation *spellAnimation;
90 graphics::AnimationRunner animation;
92 Uint16 maxHealth, health;
97 Uint16 expReward, goldReward;
106 #endif /* BATTLE_MONSTER_H_ */