]> git.localhorst.tv Git - l2e.git/blob - src/common/Stats.h
f07528a2f5db86331cf9cd088eb51d9da66b8cdb
[l2e.git] / src / common / Stats.h
1 #ifndef COMMON_STATS_H_
2 #define COMMON_STATS_H_
3
4 #include <SDL.h>
5
6 namespace common {
7
8 class Stats {
9
10 public:
11         static const int TYPE_ID = 305;
12
13 public:
14         Stats();
15         Stats(Uint16 attack, Uint16 defense, Uint16 strength, Uint16 agility, Uint16 intelligence, Uint8 gut, Uint16 magicResistance);
16
17 public:
18         Uint16 Attack() const { return attack; }
19         Uint16 Defense() const { return defense; }
20         Uint16 Strength() const { return strength; }
21         Uint16 Agility() const { return agility; }
22         Uint16 Intelligence() const { return intelligence; }
23         Uint8 Gut() const { return gut; }
24         Uint16 MagicResistance() const { return magicResistance; }
25
26         void SetAttack(Uint16 a) { attack = a; }
27         void SetDefense(Uint16 d) { defense = d; }
28         void SetStrength(Uint16 s) { strength = s; }
29         void SetAgility(Uint16 a) { agility = a; }
30         void SetIntelligence(Uint16 i) { intelligence = i; }
31         void SetGut(Uint8 g) { gut = g; }
32         void SetMagicResistance(Uint16 m) { magicResistance = m; }
33
34         static void CreateTypeDescription();
35         static void Construct(void *);
36
37 private:
38         int attack;
39         int defense;
40         int strength;
41         int agility;
42         int intelligence;
43         int magicResistance;
44         int gut;
45
46 };
47
48
49 inline Stats operator +(const Stats &lhs, const Stats &rhs) {
50         return Stats(
51                         lhs.Attack() + rhs.Attack(),
52                         lhs.Defense() + rhs.Defense(),
53                         lhs.Strength() + rhs.Strength(),
54                         lhs.Agility() + rhs.Agility(),
55                         lhs.Intelligence() + rhs.Intelligence(),
56                         lhs.Gut() + rhs.Gut(),
57                         lhs.MagicResistance() + rhs.MagicResistance());
58 }
59
60 }
61
62 #endif