-/*
- * 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 {
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;
};
+
+inline Stats operator +(const Stats &lhs, const Stats &rhs) {
+ Stats temp(lhs);
+ temp = rhs;
+ return temp;
+}
+
}
-#endif /* COMMON_STATS_H_ */
+#endif