X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FHero.h;h=74449026f93efe706ac469222d895e6194808517;hb=b53c2ec2621ccc654e819cb203dc26e0a482bd41;hp=d5284ae3d9a9f78f5bf3661be526d73ad04d9c94;hpb=c0068263474818f39e704eee12f753c0419f7708;p=l2e.git diff --git a/src/battle/Hero.h b/src/battle/Hero.h index d5284ae..7444902 100644 --- a/src/battle/Hero.h +++ b/src/battle/Hero.h @@ -8,6 +8,12 @@ #ifndef BATTLE_HERO_H_ #define BATTLE_HERO_H_ +#include "AttackChoice.h" +#include "Stats.h" +#include "../geometry/Point.h" +#include "../graphics/Animation.h" +#include "../graphics/Menu.h" + #include #include @@ -16,12 +22,13 @@ namespace common { class Spell; } namespace graphics { - class Animation; class Sprite; } namespace battle { +class Resources; + class Hero { public: @@ -38,6 +45,7 @@ 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; } @@ -48,12 +56,8 @@ public: 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; } @@ -76,13 +80,29 @@ public: bool HasRing() const { return ring; } bool HasJewel() const { return jewel; } - graphics::Animation *MeleeAnimation() { return meleeAnimation; } + 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; } - graphics::Animation *AttackAnimation() { return attackAnimation; } const graphics::Animation *AttackAnimation() const { return attackAnimation; } - graphics::Animation *SpellAnimation() { return spellAnimation; } const graphics::Animation *SpellAnimation() const { return spellAnimation; } + geometry::Point &Position() { return position; } + const geometry::Point &Position() const { return position; } + + graphics::Menu &SpellMenu() { return spellMenu; } + const graphics::Menu &SpellMenu() const { return spellMenu; } + graphics::Menu &IkariMenu() { return ikariMenu; } + const graphics::Menu &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; } @@ -95,6 +115,8 @@ public: void SetMana(Uint16 m) { mana = m; } void SetIP(Uint8 i) { ip = 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; } @@ -104,9 +126,9 @@ public: void AddSpell(const common::Spell *s) { spells.push_back(s); } - void SetMeleeAnimation(graphics::Animation *a) { meleeAnimation = a; } - void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; } - void SetSpellAnimation(graphics::Animation *a) { spellAnimation = a; } + void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; } + void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; } + void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; } private: const char *name; @@ -119,9 +141,18 @@ private: common::Item *ring; common::Item *jewel; - graphics::Animation *meleeAnimation; - graphics::Animation *attackAnimation; - graphics::Animation *spellAnimation; + const graphics::Animation *meleeAnimation; + const graphics::Animation *attackAnimation; + const graphics::Animation *spellAnimation; + + graphics::AnimationRunner animation; + + geometry::Point position; + + graphics::Menu spellMenu; + graphics::Menu ikariMenu; + + AttackChoice attackChoice; // TODO: vector does not seem to be a good choice std::vector spells; @@ -129,12 +160,7 @@ private: Uint16 maxHealth, health; Uint16 maxMana, mana; - Uint16 attack; - Uint16 defense; - Uint16 agility; - Uint16 intelligence; - Uint16 gut; - Uint16 magicResistance; + Stats stats; Uint8 level; Uint8 ip;