]> git.localhorst.tv Git - l2e.git/blobdiff - src/common/Stats.h
put stat increments in level ladder
[l2e.git] / src / common / Stats.h
index 620fc1d1cf4d537db99c45d3dd4db4aaa3020dc1..f2eed68089d991ef884838f20e6a645bc172bb2c 100644 (file)
@@ -1,19 +1,20 @@
-/*
- * Stats.h
- *
- *  Created on: Aug 19, 2012
- *      Author: holy
- */
-
 #ifndef COMMON_STATS_H_
 #define COMMON_STATS_H_
 
+namespace loader {
+       class TypeDescription;
+}
+
+#include <memory>
 #include <SDL.h>
 
 namespace common {
 
 class Stats {
 
+public:
+       static const int TYPE_ID = 305;
+
 public:
        Stats();
        Stats(Uint16 attack, Uint16 defense, Uint16 strength, Uint16 agility, Uint16 intelligence, Uint8 gut, Uint16 magicResistance);
@@ -38,6 +39,21 @@ public:
        static void CreateTypeDescription();
        static void Construct(void *);
 
+public:
+       Stats &operator +=(const Stats &other) {
+               attack += other.attack;
+               defense += other.defense;
+               strength += other.strength;
+               agility += other.agility;
+               intelligence += other.intelligence;
+               magicResistance += other.magicResistance;
+               gut += other.gut;
+               return *this;
+       }
+
+protected:
+       static void AddFields(loader::TypeDescription &, const Stats &, std::ptrdiff_t offset);
+
 private:
        int attack;
        int defense;
@@ -49,6 +65,13 @@ private:
 
 };
 
+
+inline Stats operator +(const Stats &lhs, const Stats &rhs) {
+       Stats temp(lhs);
+       temp = rhs;
+       return temp;
+}
+
 }
 
-#endif /* COMMON_STATS_H_ */
+#endif