Moved the game engine into its own unit and then made a failing test for it.
This commit is contained in:
parent
fb5bf9d733
commit
440be444ea
7 changed files with 82 additions and 49 deletions
22
game_engine.hpp
Normal file
22
game_engine.hpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include <string>
|
||||
#include <map>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class GameEngine {
|
||||
int hit_points = 0;
|
||||
map<string, int> damage_types{
|
||||
{"error", 4},
|
||||
{"warning", 1},
|
||||
{"note", 1},
|
||||
};
|
||||
|
||||
public:
|
||||
GameEngine(int hp);
|
||||
|
||||
int determine_damage(string &type);
|
||||
|
||||
bool hit(string &type);
|
||||
|
||||
bool is_dead();
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue