aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/headers/Actor.hpp9
-rw-r--r--src/main/headers/Item.hpp29
-rw-r--r--src/main/headers/MeleeWeapon.hpp21
-rw-r--r--src/main/headers/RangedWeapon.hpp13
-rw-r--r--src/main/headers/Stick.hpp11
-rw-r--r--src/main/headers/Weapon.hpp14
6 files changed, 96 insertions, 1 deletions
diff --git a/src/main/headers/Actor.hpp b/src/main/headers/Actor.hpp
index 0e74ee0..24b7c72 100644
--- a/src/main/headers/Actor.hpp
+++ b/src/main/headers/Actor.hpp
@@ -1,9 +1,10 @@
#ifndef ACTOR_HPP
#define ACTOR_HPP
-#include <vector>
+#include <list>
#include <string>
+#include "Item.hpp"
class Actor
{
@@ -17,6 +18,9 @@ public:
void damage(int amt);
void heal(int amt);
+ void store(Item &item);
+ Item& drop();
+
/* accessors */
bool alive() { return _alive; }
unsigned hp() { return _hp; }
@@ -29,6 +33,9 @@ protected:
unsigned _hp;
int _x, _y;
+ unsigned _inventorySize;
+ std::list<Item*> _inventory;
+
Actor(std::string _name, unsigned _maxHp);
};
diff --git a/src/main/headers/Item.hpp b/src/main/headers/Item.hpp
new file mode 100644
index 0000000..3664a0e
--- /dev/null
+++ b/src/main/headers/Item.hpp
@@ -0,0 +1,29 @@
+#ifndef ITEM_HPP
+#define ITEM_HPP
+
+#include <string>
+
+class Actor;
+
+/*
+ * TODO description
+ */
+class Item
+{
+public:
+ Item() = delete;
+ virtual ~Item() {}
+
+ virtual bool use(Actor &actor) = 0;
+ virtual bool use(Item &item) = 0;
+
+ bool stackable() { return _maxAmount == 1; }
+
+protected:
+ const unsigned _maxAmount;
+ const unsigned _amount; // stackable
+
+ std::string _name;
+};
+
+#endif
diff --git a/src/main/headers/MeleeWeapon.hpp b/src/main/headers/MeleeWeapon.hpp
new file mode 100644
index 0000000..e031333
--- /dev/null
+++ b/src/main/headers/MeleeWeapon.hpp
@@ -0,0 +1,21 @@
+#ifndef MELEEWEAPON_HPP
+#define MELEEWEAPON_HPP
+
+#include "Weapon.hpp"
+#include "Actor.hpp"
+
+
+class MeleeWeapon : public Weapon
+{
+public:
+ enum Type {
+ SWORD, AXE, LANCE
+ };
+
+ virtual bool use(Actor &actor);
+
+protected:
+ bool _throwable;
+};
+
+#endif
diff --git a/src/main/headers/RangedWeapon.hpp b/src/main/headers/RangedWeapon.hpp
new file mode 100644
index 0000000..57b6ea4
--- /dev/null
+++ b/src/main/headers/RangedWeapon.hpp
@@ -0,0 +1,13 @@
+#ifndef RANGEDWEAPON_HPP
+#define RANGEDWEAPON_HPP
+
+#include <string>
+
+class RangedWeapon : public Weapon
+{
+protected:
+ bool _charged;
+ unsigned _range;
+};
+
+#endif
diff --git a/src/main/headers/Stick.hpp b/src/main/headers/Stick.hpp
new file mode 100644
index 0000000..4ed2b45
--- /dev/null
+++ b/src/main/headers/Stick.hpp
@@ -0,0 +1,11 @@
+#ifndef STICK_HPP
+#define STICK_HPP
+
+#include "Item.hpp"
+
+class Stick : public Item
+{
+
+};
+
+#endif
diff --git a/src/main/headers/Weapon.hpp b/src/main/headers/Weapon.hpp
new file mode 100644
index 0000000..ef9d3d5
--- /dev/null
+++ b/src/main/headers/Weapon.hpp
@@ -0,0 +1,14 @@
+#ifndef WEAPON_HPP
+#define WEAPON_HPP
+
+#include "Item.hpp"
+#include "Actor.hpp"
+
+class Weapon : public Item
+{
+protected:
+ unsigned _damage;
+ unsigned _requiredLevel;
+};
+
+#endif