X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FHero.h;h=69db286c74d32fb69fa64a8ffe575439e90c0d4b;hb=185c6c79f8ba30981aad4e1d66f98143a344b95e;hp=ec87f4944cec872225fdff869c9306c3cf229968;hpb=d997e6743dfa0df245bc3f59ee97ecd63efb3c4f;p=l2e.git diff --git a/src/battle/Hero.h b/src/battle/Hero.h index ec87f49..69db286 100644 --- a/src/battle/Hero.h +++ b/src/battle/Hero.h @@ -27,11 +27,15 @@ public: 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; } @@ -42,8 +46,16 @@ public: // 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; } + private: const char *name; graphics::Sprite *sprite; @@ -60,6 +72,7 @@ private: Uint16 magicResistance; Uint8 level; + Uint8 ip; };