]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/Capsule.h
extracted common capsule base
[l2e.git] / src / battle / Capsule.h
index c5050f7be59548da08076876132139c486f8e0f2..7438492bc7f86a7046b999fc42ee4fb8e8755b18 100644 (file)
@@ -1,8 +1,11 @@
 #ifndef BATTLE_CAPSULE_H_
 #define BATTLE_CAPSULE_H_
 
+namespace common {
+       class Capsule;
+}
+
 #include "AttackChoice.h"
-#include "../common/fwd.h"
 #include "../common/Stats.h"
 #include "../geometry/Vector.h"
 #include "../graphics/Animation.h"
@@ -14,22 +17,19 @@ namespace battle {
 class Capsule {
 
 public:
-       Capsule();
+       Capsule(common::Capsule *master = 0);
 
 public:
-       const char *Name() const { return name; }
-       Uint8 Level() const { return level; }
-       const graphics::Sprite *Sprite() const { return battleSprite; }
+       bool Active() const { return master; }
 
-       Uint16 MaxHealth() const { return maxHealth; }
-       Uint16 Health() const { return health; }
-       int RelativeHealth(int max) const { return Health() * max / MaxHealth(); }
-       void SubtractHealth(int amount);
+       const char *Name() const;
+       Uint8 Level() const;
+       const graphics::Sprite *Sprite();
 
-       Uint16 MaxMana() const { return maxMana; }
-       Uint16 Mana() const { return mana; }
-       int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
-       bool CanUseMagic() const { return MaxMana() > 0; }
+       Uint16 MaxHealth() const;
+       Uint16 Health() const;
+       int RelativeHealth(int max) const;
+       void SubtractHealth(int amount);
 
        common::Stats &GetStats() { return stats; }
        const common::Stats &GetStats() const { return stats; }
@@ -38,9 +38,9 @@ public:
        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; }
+       const graphics::Animation *MeleeAnimation() const;
+       const graphics::Animation *AttackAnimation() const;
+       const graphics::Animation *SpellAnimation() const;
 
        geometry::Vector<int> &Position() { return position; }
        const geometry::Vector<int> &Position() const { return position; }
@@ -48,29 +48,10 @@ public:
        AttackChoice &GetAttackChoice() { return attackChoice; }
        const AttackChoice &GetAttackChoice() const { return attackChoice; }
 
-// temporary setters
-public:
-       void SetName(const char *n) { name = n; }
-       void SetHealth(int max, int cur) { maxHealth = max; health = cur; }
-       void SetMana(int max, int cur) { maxMana = max; mana = cur; }
-       void SetLevel(int l) { level = l; }
-       void SetBattleSprite(graphics::Sprite *s) { battleSprite = s; }
-       void SetMeleeAnimation(graphics::Animation *a) { meleeAnimation = a; }
-       void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; }
-       void SetSpellAnimation(graphics::Animation *a) { spellAnimation = a; }
-
 private:
-       const char *name;
-
-       int maxHealth, health;
-       int maxMana, mana;
-
-       int level;
+       common::Capsule *master;
 
-       graphics::Sprite *battleSprite;
-       graphics::Animation *meleeAnimation;
-       graphics::Animation *attackAnimation;
-       graphics::Animation *spellAnimation;
+       int health;
 
        graphics::AnimationRunner animation;
        geometry::Vector<int> position;