4 * Created on: Aug 3, 2012
8 #ifndef BATTLE_MONSTER_H_
9 #define BATTLE_MONSTER_H_
11 #include "AttackChoice.h"
13 #include "../geometry/Vector.h"
14 #include "../graphics/Animation.h"
18 namespace common { class Item; }
32 const char *Name() const { return name; }
33 Uint8 Level() const { return level; }
34 const graphics::Sprite *Sprite() const { return sprite; }
36 Uint16 MaxHealth() const { return maxHealth; }
37 Uint16 Health() const { return health; }
38 int RelativeHealth(int max) const { return health * max / maxHealth; }
39 void SubtractHealth(int amount);
41 Uint16 MaxMana() const { return maxMana; }
42 Uint16 Mana() const { return mana; }
43 int RelativeMana(int max) const { return mana * max / maxMana; }
45 Stats &GetStats() { return stats; }
46 const Stats &GetStats() const { return stats; }
48 Uint16 ExpReward() const { return expReward; }
49 Uint16 GoldReward() const { return goldReward; }
51 const common::Item *DropItem() const { return dropItem; }
52 Uint8 DropChance() const { return dropChance; }
54 const /* Script */ void *AttackScript() { return attackScript; }
55 const /* Script */ void *DefenseScript() { return defenseScript; }
57 graphics::AnimationRunner &GetAnimation() { return animation; }
58 const graphics::AnimationRunner &GetAnimation() const { return animation; }
59 void SetAnimation(const graphics::AnimationRunner &a) { animation = a; }
61 const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
62 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
63 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
65 geometry::Vector<int> &Position() { return position; }
66 const geometry::Vector<int> &Position() const { return position; }
68 // temporary setters until loader is implemented
70 void SetName(const char *n) { name = n; }
71 void SetSprite(graphics::Sprite *s) { sprite = s; }
72 void SetLevel(Uint8 l) { level = l; }
73 void SetMaxHealth(Uint16 m) { maxHealth = m; }
74 void SetHealth(Uint16 h) { health = h; }
75 void SetMaxMana(Uint16 m) { maxMana = m; }
76 void SetMana(Uint16 m) { mana = m; }
77 void SetStats(const Stats &s) { stats = s; }
78 void SetReward(Uint16 exp, Uint16 gold) { expReward = exp; goldReward = gold; }
80 void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; }
81 void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; }
82 void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; }
84 AttackChoice &GetAttackChoice() { return attackChoice; }
85 const AttackChoice &GetAttackChoice() const { return attackChoice; }
89 graphics::Sprite *sprite;
90 common::Item *dropItem;
91 /* Script */ void *attackScript;
92 /* Script */ void *defenseScript;
94 const graphics::Animation *meleeAnimation;
95 const graphics::Animation *attackAnimation;
96 const graphics::Animation *spellAnimation;
98 graphics::AnimationRunner animation;
100 geometry::Vector<int> position;
102 AttackChoice attackChoice;
104 Uint16 maxHealth, health;
105 Uint16 maxMana, mana;
109 Uint16 expReward, goldReward;
118 #endif /* BATTLE_MONSTER_H_ */