aboutsummaryrefslogtreecommitdiff
path: root/backend/Player.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 10:18:22 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 10:18:22 +0100
commit798948dbe6f012e194f053c4e862cf697f30b793 (patch)
tree32c71420d1188f98cfb41b6f0d9536c5fa4bf5a7 /backend/Player.h
parentd7012045bb61f117fb7b9c51ddd03e4c54f25fe6 (diff)
more WIP (move some Player things to backend)
Diffstat (limited to 'backend/Player.h')
-rw-r--r--backend/Player.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/backend/Player.h b/backend/Player.h
new file mode 100644
index 0000000..b101de2
--- /dev/null
+++ b/backend/Player.h
@@ -0,0 +1,40 @@
+#pragma once
+
+#include "WeaponObject.h"
+#include "ArmorObject.h"
+#include "PtrList.h"
+
+class Dungeon;
+class Location;
+
+class Player {
+public:
+ String name;
+ unsigned int health_points = 20;
+ float attack_chance = 0.4;
+ unsigned int gold = 0;
+ WeaponObject * weapon = nullptr;
+ ArmorObject * armor = nullptr;
+ bool cheating = false;
+ PtrList<Object> inventory;
+
+private:
+ Location * location = nullptr;
+
+public:
+ Player(Dungeon & dungeon);
+ virtual ~Player() = default;
+
+public:
+ void take_damage(unsigned int dmg);
+ float get_attack() const;
+ unsigned get_health() const;
+ Location & get_location() const;
+ void set_location(Location &);
+ void equip(WeaponObject *);
+ void equip(ArmorObject *);
+
+private:
+ Dungeon & dungeon;
+};
+