]> git.localhorst.tv Git - l2e.git/blob - src/battle/Hero.h
added spell selection battle state
[l2e.git] / src / battle / Hero.h
1 /*
2  * Hero.h
3  *
4  *  Created on: Aug 6, 2012
5  *      Author: holy
6  */
7
8 #ifndef BATTLE_HERO_H_
9 #define BATTLE_HERO_H_
10
11 #include <SDL.h>
12
13 namespace graphics { class Sprite; }
14
15 namespace battle {
16
17 class Hero {
18
19 public:
20         Hero();
21         ~Hero();
22
23 public:
24         const char *Name() const { return name; }
25         Uint8 Level() const { return level; }
26         const graphics::Sprite *Sprite() const { return sprite; }
27
28         Uint16 MaxHealth() const { return maxHealth; }
29         Uint16 Health() const { return health; }
30         int RelativeHealth(int max) const { return health * max / maxHealth; }
31
32         Uint16 MaxMana() const { return maxMana; }
33         Uint16 Mana() const { return mana; }
34         int RelativeMana(int max) const { return maxMana == 0 ? 0 : mana * max / maxMana; }
35         bool CanUseMagic() const { return maxMana > 0; }
36
37         Uint8 IP() const { return ip; }
38         int RelativeIP(int max) const { return ip * max / 255; }
39
40         Uint16 Attack() const { return attack; }
41         Uint16 Defense() const { return defense; }
42         Uint16 Agility() const { return agility; }
43         Uint16 Intelligence() const { return intelligence; }
44         Uint16 Gut() const { return gut; }
45         Uint16 MagicResistance() const { return magicResistance; }
46
47 // temporary setters until loader is implemented
48 public:
49         void SetName(const char *n) { name = n; }
50         void SetLevel(Uint8 l) { level = l; }
51         void SetSprite(graphics::Sprite *s) { sprite = s; }
52
53         void SetMaxHealth(Uint16 h) { maxHealth = h; }
54         void SetHealth(Uint16 h) { health = h; }
55         void SetMaxMana(Uint16 m) { maxMana = m; }
56         void SetMana(Uint16 m) { mana = m; }
57         void SetIP(Uint8 i) { ip = i; }
58
59 private:
60         const char *name;
61         graphics::Sprite *sprite;
62         // TODO: equipment and spells lists
63
64         Uint16 maxHealth, health;
65         Uint16 maxMana, mana;
66
67         Uint16 attack;
68         Uint16 defense;
69         Uint16 agility;
70         Uint16 intelligence;
71         Uint16 gut;
72         Uint16 magicResistance;
73
74         Uint8 level;
75         Uint8 ip;
76
77 };
78
79 }
80
81 #endif /* BATTLE_HERO_H_ */