X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FHero.h;h=bf02f0309ee5865cf2efae1735dfcabb0c6ad629;hb=cc3d698b8c1ad09d7a3f9e3f28bc84e0ac1735ea;hp=60bca6dd544d009462d492ed7f0da9caf53a8327;hpb=fb285efc25fccb50a2f1afb96fc1afe95f2d0ef1;p=l2e.git diff --git a/src/battle/Hero.h b/src/battle/Hero.h index 60bca6d..bf02f03 100644 --- a/src/battle/Hero.h +++ b/src/battle/Hero.h @@ -1,119 +1,102 @@ -/* - * Hero.h - * - * Created on: Aug 6, 2012 - * Author: holy - */ - #ifndef BATTLE_HERO_H_ #define BATTLE_HERO_H_ +#include "fwd.h" +#include "AttackChoice.h" +#include "../common/fwd.h" +#include "../common/Hero.h" +#include "../common/Stats.h" +#include "../geometry/Vector.h" +#include "../graphics/Animation.h" +#include "../graphics/fwd.h" +#include "../graphics/Menu.h" + #include #include -namespace common { - class Item; - class Spell; -} -namespace graphics { class Sprite; } - namespace battle { class Hero { public: Hero(); + Hero(common::Hero &); ~Hero(); public: - const char *Name() const { return name; } - Uint8 Level() const { return level; } - const graphics::Sprite *Sprite() const { return sprite; } + const char *Name() const { return master->Name(); } + Uint8 Level() const { return master->Level(); } + const graphics::Sprite *Sprite() const { return master->BattleSprite(); } - const std::vector &Spells() const { return spells; } + const std::vector &Spells() const { return master->Spells(); } - Uint16 MaxHealth() const { return maxHealth; } - Uint16 Health() const { return health; } + Uint16 MaxHealth() const { return master->MaxHealth(); } + Uint16 Health() const { return master->Health(); } int RelativeHealth(int max) const { return Health() * max / MaxHealth(); } + void SubtractHealth(int amount) { master->SubtractHealth(amount); } - Uint16 MaxMana() const { return maxMana; } - Uint16 Mana() const { return mana; } + Uint16 MaxMana() const { return master->MaxMana(); } + Uint16 Mana() const { return master->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 IP() const { return ip; } + Uint8 MaxIP() const { return master->MaxIP(); } + Uint8 IP() const { return master->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; } - - const common::Item *Weapon() const { return weapon; } - const common::Item *Armor() const { return armor; } - const common::Item *Shield() const { return shield; } - const common::Item *Helmet() const { return helmet; } - const common::Item *Ring() const { return ring; } - const common::Item *Jewel() const { return jewel; } - - bool HasWeapon() const { return weapon; } - bool HasArmor() const { return armor; } - bool HasShield() const { return shield; } - bool HasHelmet() const { return helmet; } - bool HasRing() const { return ring; } - bool HasJewel() const { return jewel; } - -// temporary setters until loader is implemented -public: - void SetName(const char *n) { name = n; } - void SetLevel(Uint8 l) { level = l; } - void SetSprite(graphics::Sprite *s) { sprite = s; } + common::Stats &GetStats() { return stats; } + const common::Stats &GetStats() const { return stats; } + + const common::Item *Weapon() const { return master->Equipment(common::Hero::EQUIP_WEAPON); } + const common::Item *Armor() const { return master->Equipment(common::Hero::EQUIP_ARMOR); } + const common::Item *Shield() const { return master->Equipment(common::Hero::EQUIP_SHIELD); } + const common::Item *Helmet() const { return master->Equipment(common::Hero::EQUIP_HELMET); } + const common::Item *Ring() const { return master->Equipment(common::Hero::EQUIP_RING); } + const common::Item *Jewel() const { return master->Equipment(common::Hero::EQUIP_JEWEL); } + + bool HasWeapon() const { return master->Equipped(common::Hero::EQUIP_WEAPON); } + bool HasArmor() const { return master->Equipped(common::Hero::EQUIP_ARMOR); } + bool HasShield() const { return master->Equipped(common::Hero::EQUIP_SHIELD); } + bool HasHelmet() const { return master->Equipped(common::Hero::EQUIP_HELMET); } + bool HasRing() const { return master->Equipped(common::Hero::EQUIP_RING); } + bool HasJewel() const { return master->Equipped(common::Hero::EQUIP_JEWEL); } + + graphics::AnimationRunner &GetAnimation() { return animation; } + const graphics::AnimationRunner &GetAnimation() const { return animation; } + void SetAnimation(const graphics::AnimationRunner &a) { animation = a; } - void SetMaxHealth(Uint16 h) { maxHealth = h; } - void SetHealth(Uint16 h) { health = h; } - void SetMaxMana(Uint16 m) { maxMana = m; } - void SetMana(Uint16 m) { mana = m; } - void SetIP(Uint8 i) { ip = i; } + const graphics::Animation *MeleeAnimation() const { return master->MeleeAnimation(); } + const graphics::Animation *AttackAnimation() const { return master->AttackAnimation(); } + const graphics::Animation *SpellAnimation() const { return master->SpellAnimation(); } - 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; } + geometry::Vector &Position() { return position; } + const geometry::Vector &Position() const { return position; } - void AddSpell(const common::Spell *s) { spells.push_back(s); } + 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 *); 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; - - // TODO: vector does not seem to be a good choice - std::vector spells; - // TODO: equipment list - - Uint16 maxHealth, health; - Uint16 maxMana, mana; - - Uint16 attack; - Uint16 defense; - Uint16 agility; - Uint16 intelligence; - Uint16 gut; - Uint16 magicResistance; - - Uint8 level; - Uint8 ip; + common::Hero *master; + + graphics::AnimationRunner animation; + + geometry::Vector position; + + graphics::Menu spellMenu; + graphics::Menu ikariMenu; + + AttackChoice attackChoice; + + common::Stats stats; };