-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroom_handler.h
63 lines (48 loc) · 1.99 KB
/
room_handler.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
57
58
59
60
61
62
63
/*
* Justin W Li
* room_handler.h
* Room and room handler defintions
*/
#ifndef ROOM_HANDLER_H
#define ROOM_HANDLER_H
#include <list> //std::list
//------------------
//----ROOM CLASS----
//------------------
//essentially tracks performance of player, adjusts difficulty as necessary
class room_handler
{
struct room {
unsigned int turns; //turns needed to complete room
//enemy spawns
unsigned int limit; //maximum number of enemies to be spawned
unsigned int spawned; //number of enemies spawned
//combat
unsigned int killed; //number of enemies killed
unsigned int died; //number of times player has died
unsigned int attacked; //total player has attacked successfully
unsigned int dodged; //total number has dodged successfully
room(unsigned int limit_ = 5);
};
std::list<room> rooms; //list storing room
int performance; //current player performance score
unsigned int next_limit; //maximum number of enemies to be spaned in next room
int room_number; //number of rooms that have been cleared
unsigned int max_rooms; //maximum number of rooms stored in rooms
void next(unsigned int limit = 5); //adds a room and ends combat in previous room if it exists
void evaluate(); //evaluates player performance
public:
room_handler();
bool can_spawn() const; //returns whether more enemies can be spawned
void room_over(); //to be called when room is complete
void reset(); //resets room's spawns
int get_performance(); //returns performance score
//metrics callback functions
void turnOver(); //notifies room that turn is over
void playerDodge(); //notifies room of player dodging enemy attack
void playerAttack(); //notifies room of player missing attack
void enemySpawn(); //notifies room of enemy spawn
void enemyDie(); //notifies room of enemy death
void playerDie(); //notifies room of player death
};
#endif