X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FCapsule.h;h=80edd47fbd1d514a6357ab2f8c1b39c85075b9e6;hb=092a2dd175a4001a495c84ee85211734fb928c83;hp=c5050f7be59548da08076876132139c486f8e0f2;hpb=2255d436a0c2acc10b015827366a72b2ece86094;p=l2e.git diff --git a/src/battle/Capsule.h b/src/battle/Capsule.h index c5050f7..80edd47 100644 --- a/src/battle/Capsule.h +++ b/src/battle/Capsule.h @@ -1,35 +1,39 @@ #ifndef BATTLE_CAPSULE_H_ #define BATTLE_CAPSULE_H_ +namespace common { + class Capsule; +} +namespace math { + template + class Vector; +} + #include "AttackChoice.h" -#include "../common/fwd.h" #include "../common/Stats.h" -#include "../geometry/Vector.h" #include "../graphics/Animation.h" -#include "../graphics/fwd.h" #include "../graphics/Menu.h" +#include + 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,42 +42,23 @@ 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; } + math::Vector &Position() { return position; } + const math::Vector &Position() const { return position; } 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; + math::Vector position; AttackChoice attackChoice; common::Stats stats;