]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/Capsule.h
added capsule mockup (battle)
[l2e.git] / src / battle / Capsule.h
diff --git a/src/battle/Capsule.h b/src/battle/Capsule.h
new file mode 100644 (file)
index 0000000..c16196c
--- /dev/null
@@ -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 <vector>
+#include <SDL.h>
+
+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<int> &Position() { return position; }
+       const geometry::Vector<int> &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<int> position;
+       AttackChoice attackChoice;
+       common::Stats stats;
+
+};
+
+}
+
+#endif /* BATTLE_CAPSULE_H_ */