]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/Hero.h
added type description of Hero
[l2e.git] / src / battle / Hero.h
index 60bca6dd544d009462d492ed7f0da9caf53a8327..122ee94112a21aac140f95a0187923dd820afef0 100644 (file)
@@ -8,6 +8,12 @@
 #ifndef BATTLE_HERO_H_
 #define BATTLE_HERO_H_
 
+#include "AttackChoice.h"
+#include "Stats.h"
+#include "../geometry/Vector.h"
+#include "../graphics/Animation.h"
+#include "../graphics/Menu.h"
+
 #include <vector>
 #include <SDL.h>
 
@@ -15,10 +21,14 @@ namespace common {
        class Item;
        class Spell;
 }
-namespace graphics { class Sprite; }
+namespace graphics {
+       class Sprite;
+}
 
 namespace battle {
 
+class Resources;
+
 class Hero {
 
 public:
@@ -35,22 +45,26 @@ public:
        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; }
 
-       Uint8 MaxIP() const { return 100; }
+       Uint8 MaxIP() const { return 255; }
        Uint8 IP() const { return ip; }
        int RelativeIP(int max) const { return IP() * max / MaxIP(); }
 
-       Uint16 Attack() const { return attack; }
-       Uint16 Defense() const { return defense; }
-       Uint16 Agility() const { return agility; }
-       Uint16 Intelligence() const { return intelligence; }
-       Uint16 Gut() const { return gut; }
-       Uint16 MagicResistance() const { return magicResistance; }
+       Stats &GetStats() { return stats; }
+       const Stats &GetStats() const { return stats; }
+
+       common::Item *Weapon() { return weapon; }
+       common::Item *Armor() { return armor; }
+       common::Item *Shield() { return shield; }
+       common::Item *Helmet() { return helmet; }
+       common::Item *Ring() { return ring; }
+       common::Item *Jewel() { return jewel; }
 
        const common::Item *Weapon() const { return weapon; }
        const common::Item *Armor() const { return armor; }
@@ -66,6 +80,29 @@ public:
        bool HasRing() const { return ring; }
        bool HasJewel() const { return jewel; }
 
+       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; }
+
+       graphics::Menu<const common::Spell *> &SpellMenu() { return spellMenu; }
+       const graphics::Menu<const common::Spell *> &SpellMenu() const { return spellMenu; }
+       graphics::Menu<const common::Item *> &IkariMenu() { return ikariMenu; }
+       const graphics::Menu<const common::Item *> &IkariMenu() const { return ikariMenu; }
+
+       AttackChoice &GetAttackChoice() { return attackChoice; }
+       const AttackChoice &GetAttackChoice() const { return attackChoice; }
+
+public:
+       void UpdateSpellMenu();
+       void UpdateIkariMenu(const Resources *);
+
 // temporary setters until loader is implemented
 public:
        void SetName(const char *n) { name = n; }
@@ -78,42 +115,57 @@ public:
        void SetMana(Uint16 m) { mana = m; }
        void SetIP(Uint8 i) { ip = i; }
 
-       void SetWeapon(const common::Item *i) { weapon = i; }
-       void SetArmor(const common::Item *i) { armor = i; }
-       void SetShield(const common::Item *i) { shield = i; }
-       void SetHelmet(const common::Item *i) { helmet = i; }
-       void SetRing(const common::Item *i) { ring = i; }
-       void SetJewel(const common::Item *i) { jewel = i; }
+       void SetStats(const Stats &s) { stats = s; }
+
+       void SetWeapon(common::Item *i) { weapon = i; }
+       void SetArmor(common::Item *i) { armor = i; }
+       void SetShield(common::Item *i) { shield = i; }
+       void SetHelmet(common::Item *i) { helmet = i; }
+       void SetRing(common::Item *i) { ring = i; }
+       void SetJewel(common::Item *i) { jewel = i; }
 
        void AddSpell(const common::Spell *s) { spells.push_back(s); }
 
+       void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; }
+       void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; }
+       void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; }
+
+       static void CreateTypeDescription();
+
 private:
        const char *name;
        graphics::Sprite *sprite;
 
-       const common::Item *weapon;
-       const common::Item *armor;
-       const common::Item *shield;
-       const common::Item *helmet;
-       const common::Item *ring;
-       const common::Item *jewel;
+       common::Item *weapon;
+       common::Item *armor;
+       common::Item *shield;
+       common::Item *helmet;
+       common::Item *ring;
+       common::Item *jewel;
+
+       const graphics::Animation *meleeAnimation;
+       const graphics::Animation *attackAnimation;
+       const graphics::Animation *spellAnimation;
+
+       graphics::AnimationRunner animation;
+
+       geometry::Vector<int> position;
+
+       graphics::Menu<const common::Spell *> spellMenu;
+       graphics::Menu<const common::Item *> ikariMenu;
+
+       AttackChoice attackChoice;
 
        // TODO: vector does not seem to be a good choice
        std::vector<const common::Spell *> spells;
-       // TODO: equipment list
 
-       Uint16 maxHealth, health;
-       Uint16 maxMana, mana;
+       int maxHealth, health;
+       int maxMana, mana;
 
-       Uint16 attack;
-       Uint16 defense;
-       Uint16 agility;
-       Uint16 intelligence;
-       Uint16 gut;
-       Uint16 magicResistance;
+       Stats stats;
 
-       Uint8 level;
-       Uint8 ip;
+       int level;
+       int ip;
 
 };