4 * Created on: Aug 6, 2012
12 #include "AttackChoice.h"
13 #include "../common/fwd.h"
14 #include "../common/Hero.h"
15 #include "../common/Stats.h"
16 #include "../geometry/Vector.h"
17 #include "../graphics/Animation.h"
18 #include "../graphics/fwd.h"
19 #include "../graphics/Menu.h"
34 const char *Name() const { return master->Name(); }
35 Uint8 Level() const { return master->Level(); }
36 const graphics::Sprite *Sprite() const { return master->BattleSprite(); }
38 const std::vector<const common::Spell *> &Spells() const { return master->Spells(); }
40 Uint16 MaxHealth() const { return master->MaxHealth(); }
41 Uint16 Health() const { return master->Health(); }
42 int RelativeHealth(int max) const { return Health() * max / MaxHealth(); }
43 void SubtractHealth(int amount) { master->SubtractHealth(amount); }
45 Uint16 MaxMana() const { return master->MaxMana(); }
46 Uint16 Mana() const { return master->Mana(); }
47 int RelativeMana(int max) const { return MaxMana() == 0 ? 0 : Mana() * max / MaxMana(); }
48 bool CanUseMagic() const { return MaxMana() > 0; }
50 Uint8 MaxIP() const { return master->MaxIP(); }
51 Uint8 IP() const { return master->IP(); }
52 int RelativeIP(int max) const { return IP() * max / MaxIP(); }
54 common::Stats &GetStats() { return stats; }
55 const common::Stats &GetStats() const { return stats; }
57 const common::Item *Weapon() const { return master->Equipment(common::Hero::EQUIP_WEAPON); }
58 const common::Item *Armor() const { return master->Equipment(common::Hero::EQUIP_ARMOR); }
59 const common::Item *Shield() const { return master->Equipment(common::Hero::EQUIP_SHIELD); }
60 const common::Item *Helmet() const { return master->Equipment(common::Hero::EQUIP_HELMET); }
61 const common::Item *Ring() const { return master->Equipment(common::Hero::EQUIP_RING); }
62 const common::Item *Jewel() const { return master->Equipment(common::Hero::EQUIP_JEWEL); }
64 bool HasWeapon() const { return master->Equipped(common::Hero::EQUIP_WEAPON); }
65 bool HasArmor() const { return master->Equipped(common::Hero::EQUIP_ARMOR); }
66 bool HasShield() const { return master->Equipped(common::Hero::EQUIP_SHIELD); }
67 bool HasHelmet() const { return master->Equipped(common::Hero::EQUIP_HELMET); }
68 bool HasRing() const { return master->Equipped(common::Hero::EQUIP_RING); }
69 bool HasJewel() const { return master->Equipped(common::Hero::EQUIP_JEWEL); }
71 graphics::AnimationRunner &GetAnimation() { return animation; }
72 const graphics::AnimationRunner &GetAnimation() const { return animation; }
73 void SetAnimation(const graphics::AnimationRunner &a) { animation = a; }
75 const graphics::Animation *MeleeAnimation() const { return master->MeleeAnimation(); }
76 const graphics::Animation *AttackAnimation() const { return master->AttackAnimation(); }
77 const graphics::Animation *SpellAnimation() const { return master->SpellAnimation(); }
79 geometry::Vector<int> &Position() { return position; }
80 const geometry::Vector<int> &Position() const { return position; }
82 graphics::Menu<const common::Spell *> &SpellMenu() { return spellMenu; }
83 const graphics::Menu<const common::Spell *> &SpellMenu() const { return spellMenu; }
84 graphics::Menu<const common::Item *> &IkariMenu() { return ikariMenu; }
85 const graphics::Menu<const common::Item *> &IkariMenu() const { return ikariMenu; }
87 AttackChoice &GetAttackChoice() { return attackChoice; }
88 const AttackChoice &GetAttackChoice() const { return attackChoice; }
91 void UpdateSpellMenu();
92 void UpdateIkariMenu(const Resources *);
97 graphics::AnimationRunner animation;
99 geometry::Vector<int> position;
101 graphics::Menu<const common::Spell *> spellMenu;
102 graphics::Menu<const common::Item *> ikariMenu;
104 AttackChoice attackChoice;
112 #endif /* BATTLE_HERO_H_ */