-
Notifications
You must be signed in to change notification settings - Fork 0
/
citizen.h
56 lines (43 loc) · 1.15 KB
/
citizen.h
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
49
50
51
52
53
54
55
56
#ifndef CITIZEN_H
#define CITIZEN_H
#include "citizen.h"
#include "helper.h"
#include "monster.h"
#include <algorithm>
#include <cassert>
#include <memory>
#include <type_traits>
const Age MIN_ADULT_AGE = 18;
const Age MAX_ADULT_AGE = 100;
const Age MIN_TEENAGER_AGE = 11;
const Age MAX_TEENAGER_AGE = 17;
class Citizen {
public:
HealthPoints getHealth() const;
Age getAge() const;
void takeDamage(AttackPower attack_power);
Citizen(HealthPoints health, Age age);
private:
Age _age;
HealthPoints _health;
};
class Adult : public Citizen {
public:
Adult(HealthPoints health, Age age);
};
class Teenager : public Citizen {
public:
Teenager(HealthPoints health, Age age);
};
class Sheriff : public Citizen, Attacker {
public:
Sheriff(HealthPoints health, Age age, AttackPower attack_power);
void fightBack(Monster& who_attacked);
};
std::shared_ptr<Adult>
createAdult(HealthPoints healthPoints, Age age);
std::shared_ptr<Teenager>
createTeenager(HealthPoints healthPoints, Age age);
std::shared_ptr<Sheriff>
createSheriff(HealthPoints healthPoints, Age age, AttackPower attack_power);
#endif // CITIZEN_H