aboutsummaryrefslogtreecommitdiff
path: root/backend/Player.h
blob: 8090063c42d41eea580705db8c35c00c73d0b617 (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
42
43
44
45
46
47
48
#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();
	Player(const Player &) = delete;
	Player(Player &&) = delete;
	Player & operator = (const Player &) = delete;
	Player & operator = (Player &&) = delete;

public:
	void take_damage(unsigned int dmg);
	void add_health(unsigned int bonus);
	float get_attack() const;
	void add_attack(float bonus);
	unsigned get_health() const;
	Location & get_location() const;
	void set_location(Location &);
	void equip(WeaponObject *);
	void equip(ArmorObject *);
	void equip(Object *);
	bool is_dead() const;

private:
	Dungeon & dungeon;
};