X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FCapsule.h;fp=src%2Fbattle%2FCapsule.h;h=c16196c6339b7fd7d9246825d9cbbad91ab54394;hb=e1edc92c4fb834c8061118e89c0d7e239742b030;hp=0000000000000000000000000000000000000000;hpb=a67f7e662c85b2b8d46f26a3c6e018b2df6eb318;p=l2e.git diff --git a/src/battle/Capsule.h b/src/battle/Capsule.h new file mode 100644 index 0000000..c16196c --- /dev/null +++ b/src/battle/Capsule.h @@ -0,0 +1,87 @@ +#ifndef BATTLE_CAPSULE_H_ +#define BATTLE_CAPSULE_H_ + +#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 +#include + +namespace battle { + +class Capsule { + +public: + Capsule(); + +public: + const char *Name() const { return name; } + Uint8 Level() const { return level; } + const graphics::Sprite *Sprite() const { return battleSprite; } + + Uint16 MaxHealth() const { return maxHealth; } + Uint16 Health() const { return health; } + 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) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); } + bool CanUseMagic() const { return MaxMana() > 0; } + + common::Stats &GetStats() { return stats; } + const common::Stats &GetStats() const { return stats; } + + 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; } + + geometry::Vector &Position() { return position; } + const geometry::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; + + graphics::Sprite *battleSprite; + graphics::Animation *meleeAnimation; + graphics::Animation *attackAnimation; + graphics::Animation *spellAnimation; + + graphics::AnimationRunner animation; + geometry::Vector position; + AttackChoice attackChoice; + common::Stats stats; + +}; + +} + +#endif /* BATTLE_CAPSULE_H_ */