aboutsummaryrefslogtreecommitdiff
path: root/backend/Player.h
blob: 0dce061995922e631d277b0230cd1232c1e58797 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#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 *);
	bool is_dead() const;

private:
	Dungeon & dungeon;
};