1 #ifndef BATTLE_MONSTER_H_
2 #define BATTLE_MONSTER_H_
12 #include "AttackChoice.h"
13 #include "../common/Stats.h"
14 #include "../math/Vector.h"
15 #include "../graphics/Animation.h"
24 static const int TYPE_ID = 202;
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 common::Stats &GetStats() { return stats; }
45 const common::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 math::Vector<int> &Position() { return position; }
65 const math::Vector<int> &Position() const { return position; }
67 // temporary setters until loader is implemented
69 void SetName(const char *n) { name = n; }
70 void SetSprite(graphics::Sprite *s) { sprite = s; }
71 void SetLevel(Uint8 l) { level = l; }
72 void SetMaxHealth(Uint16 m) { maxHealth = m; }
73 void SetHealth(Uint16 h) { health = h; }
74 void SetMaxMana(Uint16 m) { maxMana = m; }
75 void SetMana(Uint16 m) { mana = m; }
76 void SetStats(const common::Stats &s) { stats = s; }
77 void SetReward(Uint16 exp, Uint16 gold) { expReward = exp; goldReward = gold; }
79 void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; }
80 void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; }
81 void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; }
83 AttackChoice &GetAttackChoice() { return attackChoice; }
84 const AttackChoice &GetAttackChoice() const { return attackChoice; }
86 static void CreateTypeDescription();
87 static void Construct(void *);
91 graphics::Sprite *sprite;
92 common::Item *dropItem;
93 /* Script */ void *attackScript;
94 /* Script */ void *defenseScript;
96 const graphics::Animation *meleeAnimation;
97 const graphics::Animation *attackAnimation;
98 const graphics::Animation *spellAnimation;
100 graphics::AnimationRunner animation;
102 math::Vector<int> position;
104 AttackChoice attackChoice;
106 int maxHealth, health;
111 int expReward, goldReward;