4 * Created on: Aug 3, 2012
8 #ifndef BATTLE_MONSTER_H_
9 #define BATTLE_MONSTER_H_
11 #include "AttackChoice.h"
13 #include "../common/fwd.h"
14 #include "../geometry/Vector.h"
15 #include "../graphics/Animation.h"
16 #include "../graphics/fwd.h"
29 const char *Name() const { return name; }
30 Uint8 Level() const { return level; }
31 const graphics::Sprite *Sprite() const { return sprite; }
33 Uint16 MaxHealth() const { return maxHealth; }
34 Uint16 Health() const { return health; }
35 int RelativeHealth(int max) const { return health * max / maxHealth; }
36 void SubtractHealth(int amount);
38 Uint16 MaxMana() const { return maxMana; }
39 Uint16 Mana() const { return mana; }
40 int RelativeMana(int max) const { return mana * max / maxMana; }
42 Stats &GetStats() { return stats; }
43 const Stats &GetStats() const { return stats; }
45 Uint16 ExpReward() const { return expReward; }
46 Uint16 GoldReward() const { return goldReward; }
48 const common::Item *DropItem() const { return dropItem; }
49 Uint8 DropChance() const { return dropChance; }
51 const /* Script */ void *AttackScript() { return attackScript; }
52 const /* Script */ void *DefenseScript() { return defenseScript; }
54 graphics::AnimationRunner &GetAnimation() { return animation; }
55 const graphics::AnimationRunner &GetAnimation() const { return animation; }
56 void SetAnimation(const graphics::AnimationRunner &a) { animation = a; }
58 const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
59 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
60 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
62 geometry::Vector<int> &Position() { return position; }
63 const geometry::Vector<int> &Position() const { return position; }
65 // temporary setters until loader is implemented
67 void SetName(const char *n) { name = n; }
68 void SetSprite(graphics::Sprite *s) { sprite = s; }
69 void SetLevel(Uint8 l) { level = l; }
70 void SetMaxHealth(Uint16 m) { maxHealth = m; }
71 void SetHealth(Uint16 h) { health = h; }
72 void SetMaxMana(Uint16 m) { maxMana = m; }
73 void SetMana(Uint16 m) { mana = m; }
74 void SetStats(const Stats &s) { stats = s; }
75 void SetReward(Uint16 exp, Uint16 gold) { expReward = exp; goldReward = gold; }
77 void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; }
78 void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; }
79 void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; }
81 AttackChoice &GetAttackChoice() { return attackChoice; }
82 const AttackChoice &GetAttackChoice() const { return attackChoice; }
84 static void CreateTypeDescription();
85 static void Construct(void *);
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 int maxHealth, health;
109 int expReward, goldReward;
118 #endif /* BATTLE_MONSTER_H_ */