#ifndef BATTLE_HERO_H_
#define BATTLE_HERO_H_
+#include <vector>
#include <SDL.h>
+namespace common { class Spell; }
namespace graphics { class Sprite; }
namespace battle {
Uint8 Level() const { return level; }
const graphics::Sprite *Sprite() const { return sprite; }
+ const std::vector<const common::Spell *> &Spells() const { return spells; }
+
Uint16 MaxHealth() const { return maxHealth; }
Uint16 Health() const { return health; }
- int RelativeHealth(int max) { return health * max / maxHealth; }
+ int RelativeHealth(int max) const { return health * max / maxHealth; }
Uint16 MaxMana() const { return maxMana; }
Uint16 Mana() const { return mana; }
- int RelativeMana(int max) { 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; }
Uint16 Attack() const { return attack; }
Uint16 Defense() const { return defense; }
// 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; }
+ 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; }
+
+ 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<const common::Spell *> spells;
+ // TODO: equipment list
Uint16 maxHealth, health;
Uint16 maxMana, mana;
Uint16 magicResistance;
Uint8 level;
+ Uint8 ip;
};