aboutsummaryrefslogtreecommitdiff
path: root/backend/Enemy.h
blob: f85172e2e08ad42429b2091eab482a0ba89c53d7 (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
#pragma once

#include "String.h"
#include "PtrList.h"
#include "ListIterator.h"
#include "Object.h"
#include "Range.h"

class Enemy {
public:
	void set_name(const String & name);
	const String & get_name() const;
	void set_description(const String & description);
	const String & get_description() const;
	void set_health(unsigned);
	unsigned get_health() const;
	bool is_dead() const;
	void take_damage(unsigned int dmg);
	virtual const String & get_displayname() const;
	void set_attack(float attack_chance);
	float get_attack() const;
	void set_damage(const Range<int> & range);
	Range<int> get_damage() const;

	void add_hidden_object(Object *);
	void remove_hidden_object(Object *);
	ListRange<Object *> get_hidden_objects();

private:
	friend class EnemyFactory;
	Enemy(const String & name, const String & description);
public:
	virtual ~Enemy() = default;

private:
	String name;
	String description;
	PtrList<Object> hidden_objects;
	unsigned int health_points = 0;
	float attack_chance = 0.0;
	int damage_min = 0;
	int damage_max = 0;
};