X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FHero.h;h=03f909519400ffac8685e92b9b97301fd29425ae;hb=d872d756e64b8f1f57cba64ae19f479f8eab3927;hp=d7f6a49d97b0a89efaeffe8c752d46db5484f922;hpb=e70b263430990055abc58945aa385e52d935431d;p=l2e.git diff --git a/src/battle/Hero.h b/src/battle/Hero.h index d7f6a49..03f9095 100644 --- a/src/battle/Hero.h +++ b/src/battle/Hero.h @@ -8,8 +8,10 @@ #ifndef BATTLE_HERO_H_ #define BATTLE_HERO_H_ +#include #include +namespace common { class Spell; } namespace graphics { class Sprite; } namespace battle { @@ -25,13 +27,16 @@ public: Uint8 Level() const { return level; } const graphics::Sprite *Sprite() const { return sprite; } + const std::vector &Spells() const { return spells; } + Uint16 MaxHealth() const { return maxHealth; } Uint16 Health() const { return health; } int RelativeHealth(int max) const { return health * max / maxHealth; } Uint16 MaxMana() const { return maxMana; } Uint16 Mana() const { return mana; } - int RelativeMana(int max) const { return mana * max / maxMana; } + int RelativeMana(int max) const { return maxMana == 0 ? 0 : mana * max / maxMana; } + bool CanUseMagic() const { return maxMana > 0; } Uint8 IP() const { return ip; } int RelativeIP(int max) const { return ip * max / 255; } @@ -55,10 +60,15 @@ public: void SetMana(Uint16 m) { mana = m; } void SetIP(Uint8 i) { ip = i; } + void AddSpell(const common::Spell *s) { spells.push_back(s); } + private: const char *name; graphics::Sprite *sprite; - // TODO: equipment and spells lists + + // TODO: vector does not seem to be a good choice + std::vector spells; + // TODO: equipment list Uint16 maxHealth, health; Uint16 maxMana, mana;