4 * Created on: Aug 3, 2012
8 #ifndef BATTLE_MONSTER_H_
9 #define BATTLE_MONSTER_H_
11 #include "AttackChoice.h"
12 #include "../common/fwd.h"
13 #include "../common/Stats.h"
14 #include "../geometry/Vector.h"
15 #include "../graphics/Animation.h"
16 #include "../graphics/fwd.h"
25 static const int TYPE_ID = 202;
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 common::Stats &GetStats() { return stats; }
46 const common::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 common::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; }
87 static void CreateTypeDescription();
88 static void Construct(void *);
92 graphics::Sprite *sprite;
93 common::Item *dropItem;
94 /* Script */ void *attackScript;
95 /* Script */ void *defenseScript;
97 const graphics::Animation *meleeAnimation;
98 const graphics::Animation *attackAnimation;
99 const graphics::Animation *spellAnimation;
101 graphics::AnimationRunner animation;
103 geometry::Vector<int> position;
105 AttackChoice attackChoice;
107 int maxHealth, health;
112 int expReward, goldReward;
121 #endif /* BATTLE_MONSTER_H_ */