X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FMonster.h;h=6aaf1f46164e96a182dd1b7fe1f602a4c5b2248b;hb=092a2dd175a4001a495c84ee85211734fb928c83;hp=0b35d31b742d43ca17bc8b906717806ccea2eecd;hpb=5421c812b9fc64371c7f8ce3886b0b091eef458f;p=l2e.git diff --git a/src/battle/Monster.h b/src/battle/Monster.h index 0b35d31..6aaf1f4 100644 --- a/src/battle/Monster.h +++ b/src/battle/Monster.h @@ -1,21 +1,28 @@ -/* - * Monster.h - * - * Created on: Aug 3, 2012 - * Author: holy - */ - #ifndef BATTLE_MONSTER_H_ #define BATTLE_MONSTER_H_ -#include +namespace common { + class Item; +} +namespace graphics { + class Animation; + class Sprite; +} -namespace graphics { class Sprite; } +#include "AttackChoice.h" +#include "../common/Stats.h" +#include "../math/Vector.h" +#include "../graphics/Animation.h" + +#include namespace battle { class Monster { +public: + static const int TYPE_ID = 202; + public: Monster(); ~Monster(); @@ -27,49 +34,84 @@ public: Uint16 MaxHealth() const { return maxHealth; } Uint16 Health() const { return health; } - int RelativeHealth(int max) { return health * max / maxHealth; } + int RelativeHealth(int max) const { return health * max / maxHealth; } + void SubtractHealth(int amount); Uint16 MaxMana() const { return maxMana; } Uint16 Mana() const { return mana; } - int RelativeMana(int max) { return mana * max / maxMana; } + int RelativeMana(int max) const { return mana * max / maxMana; } - Uint16 Attack() const { return attack; } - Uint16 Defense() const { return defense; } - Uint16 Agility() const { return agility; } - Uint16 Intelligence() const { return intelligence; } - Uint16 Gut() const { return gut; } - Uint16 MagicResistance() const { return magicResistance; } + common::Stats &GetStats() { return stats; } + const common::Stats &GetStats() const { return stats; } Uint16 ExpReward() const { return expReward; } Uint16 GoldReward() const { return goldReward; } - const /* Item */ void *DropItem() const { return dropItem; } + const common::Item *DropItem() const { return dropItem; } Uint8 DropChance() const { return dropChance; } const /* Script */ void *AttackScript() { return attackScript; } const /* Script */ void *DefenseScript() { return defenseScript; } + graphics::AnimationRunner &GetAnimation() { return animation; } + const graphics::AnimationRunner &GetAnimation() const { return animation; } + void SetAnimation(const graphics::AnimationRunner &a) { animation = a; } + + const graphics::Animation *MeleeAnimation() const { return meleeAnimation; } + const graphics::Animation *AttackAnimation() const { return attackAnimation; } + const graphics::Animation *SpellAnimation() const { return spellAnimation; } + + math::Vector &Position() { return position; } + const math::Vector &Position() const { return position; } + +// temporary setters until loader is implemented +public: + void SetName(const char *n) { name = n; } + void SetSprite(graphics::Sprite *s) { sprite = s; } + void SetLevel(Uint8 l) { level = l; } + void SetMaxHealth(Uint16 m) { maxHealth = m; } + void SetHealth(Uint16 h) { health = h; } + void SetMaxMana(Uint16 m) { maxMana = m; } + void SetMana(Uint16 m) { mana = m; } + void SetStats(const common::Stats &s) { stats = s; } + void SetReward(Uint16 exp, Uint16 gold) { expReward = exp; goldReward = gold; } + + void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; } + void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; } + void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; } + + AttackChoice &GetAttackChoice() { return attackChoice; } + const AttackChoice &GetAttackChoice() const { return attackChoice; } + + static void CreateTypeDescription(); + static void Construct(void *); + private: const char *name; graphics::Sprite *sprite; - /* Item */ void *dropItem; + common::Item *dropItem; /* Script */ void *attackScript; /* Script */ void *defenseScript; - Uint16 maxHealth, health; - Uint16 maxMana, mana; + const graphics::Animation *meleeAnimation; + const graphics::Animation *attackAnimation; + const graphics::Animation *spellAnimation; + + graphics::AnimationRunner animation; + + math::Vector position; + + AttackChoice attackChoice; + + int maxHealth, health; + int maxMana, mana; - Uint16 attack; - Uint16 defense; - Uint16 agility; - Uint16 intelligence; - Uint16 gut; - Uint16 magicResistance; + common::Stats stats; - Uint16 expReward, goldReward; + int expReward, goldReward; - Uint8 level; - Uint8 dropChance; + int level; + int dropChance; };