]> git.localhorst.tv Git - l2e.git/blob - src/battle/Hero.h
added realistic test data
[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
36         Uint8 IP() const { return ip; }
37         int RelativeIP(int max) const { return ip * max / 255; }
38
39         Uint16 Attack() const { return attack; }
40         Uint16 Defense() const { return defense; }
41         Uint16 Agility() const { return agility; }
42         Uint16 Intelligence() const { return intelligence; }
43         Uint16 Gut() const { return gut; }
44         Uint16 MagicResistance() const { return magicResistance; }
45
46 // temporary setters until loader is implemented
47 public:
48         void SetName(const char *n) { name = n; }
49         void SetLevel(Uint8 l) { level = l; }
50         void SetSprite(graphics::Sprite *s) { sprite = s; }
51
52         void SetMaxHealth(Uint16 h) { maxHealth = h; }
53         void SetHealth(Uint16 h) { health = h; }
54         void SetMaxMana(Uint16 m) { maxMana = m; }
55         void SetMana(Uint16 m) { mana = m; }
56         void SetIP(Uint8 i) { ip = i; }
57
58 private:
59         const char *name;
60         graphics::Sprite *sprite;
61         // TODO: equipment and spells lists
62
63         Uint16 maxHealth, health;
64         Uint16 maxMana, mana;
65
66         Uint16 attack;
67         Uint16 defense;
68         Uint16 agility;
69         Uint16 intelligence;
70         Uint16 gut;
71         Uint16 magicResistance;
72
73         Uint8 level;
74         Uint8 ip;
75
76 };
77
78 }
79
80 #endif /* BATTLE_HERO_H_ */