X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FCapsule.h;h=7438492bc7f86a7046b999fc42ee4fb8e8755b18;hb=11cf419b542070def1d0edaa69d2389ab1ab427b;hp=c5050f7be59548da08076876132139c486f8e0f2;hpb=2255d436a0c2acc10b015827366a72b2ece86094;p=l2e.git diff --git a/src/battle/Capsule.h b/src/battle/Capsule.h index c5050f7..7438492 100644 --- a/src/battle/Capsule.h +++ b/src/battle/Capsule.h @@ -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 &Position() { return position; } const geometry::Vector &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 position;