1 #ifndef BATTLE_MONSTER_H_
2 #define BATTLE_MONSTER_H_
4 #include "AttackChoice.h"
5 #include "../common/fwd.h"
6 #include "../common/Stats.h"
7 #include "../geometry/Vector.h"
8 #include "../graphics/Animation.h"
9 #include "../graphics/fwd.h"
18 static const int TYPE_ID = 202;
25 const char *Name() const { return name; }
26 Uint8 Level() const { return level; }
27 const graphics::Sprite *Sprite() const { return sprite; }
29 Uint16 MaxHealth() const { return maxHealth; }
30 Uint16 Health() const { return health; }
31 int RelativeHealth(int max) const { return health * max / maxHealth; }
32 void SubtractHealth(int amount);
34 Uint16 MaxMana() const { return maxMana; }
35 Uint16 Mana() const { return mana; }
36 int RelativeMana(int max) const { return mana * max / maxMana; }
38 common::Stats &GetStats() { return stats; }
39 const common::Stats &GetStats() const { return stats; }
41 Uint16 ExpReward() const { return expReward; }
42 Uint16 GoldReward() const { return goldReward; }
44 const common::Item *DropItem() const { return dropItem; }
45 Uint8 DropChance() const { return dropChance; }
47 const /* Script */ void *AttackScript() { return attackScript; }
48 const /* Script */ void *DefenseScript() { return defenseScript; }
50 graphics::AnimationRunner &GetAnimation() { return animation; }
51 const graphics::AnimationRunner &GetAnimation() const { return animation; }
52 void SetAnimation(const graphics::AnimationRunner &a) { animation = a; }
54 const graphics::Animation *MeleeAnimation() const { return meleeAnimation; }
55 const graphics::Animation *AttackAnimation() const { return attackAnimation; }
56 const graphics::Animation *SpellAnimation() const { return spellAnimation; }
58 geometry::Vector<int> &Position() { return position; }
59 const geometry::Vector<int> &Position() const { return position; }
61 // temporary setters until loader is implemented
63 void SetName(const char *n) { name = n; }
64 void SetSprite(graphics::Sprite *s) { sprite = s; }
65 void SetLevel(Uint8 l) { level = l; }
66 void SetMaxHealth(Uint16 m) { maxHealth = m; }
67 void SetHealth(Uint16 h) { health = h; }
68 void SetMaxMana(Uint16 m) { maxMana = m; }
69 void SetMana(Uint16 m) { mana = m; }
70 void SetStats(const common::Stats &s) { stats = s; }
71 void SetReward(Uint16 exp, Uint16 gold) { expReward = exp; goldReward = gold; }
73 void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; }
74 void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; }
75 void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; }
77 AttackChoice &GetAttackChoice() { return attackChoice; }
78 const AttackChoice &GetAttackChoice() const { return attackChoice; }
80 static void CreateTypeDescription();
81 static void Construct(void *);
85 graphics::Sprite *sprite;
86 common::Item *dropItem;
87 /* Script */ void *attackScript;
88 /* Script */ void *defenseScript;
90 const graphics::Animation *meleeAnimation;
91 const graphics::Animation *attackAnimation;
92 const graphics::Animation *spellAnimation;
94 graphics::AnimationRunner animation;
96 geometry::Vector<int> position;
98 AttackChoice attackChoice;
100 int maxHealth, health;
105 int expReward, goldReward;
114 #endif /* BATTLE_MONSTER_H_ */