-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame_Api.h
100 lines (88 loc) · 2.53 KB
/
Game_Api.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//
// Created by alvar on 9/1/2018.
//
#ifndef GAME_API_GAME_API_H
#define GAME_API_GAME_API_H
#include "includes/json.hpp"
#define BASE_MOVEMENT_COUNTER 7
#define INIT_PLAYER_HEALTH 10
using std::string;
using std::vector;
using json = nlohmann::json;
typedef int node_id_t;
class Game_Api {
private:
// struct Unit { //make everything const
// Unit(string name, int h, int k, int s, node_id_t loc, Game_Api* api);
// void update(json unit_json);
// string _name;
// int _health;
// int _kung_fu;
// int _speed;
// int _movement_counter;
// node_id_t _location;
// node_id_t _destination;
// int _exp;
// int _victory_points;
// Game_Api* _api;
// };
struct DeathEffects {
int _rock;
int _paper;
int _scissors;
int _speed;
int _health;
};
struct Monster {
Monster(string name, int health, string stance, int speed, node_id_t location, int attack, json deathfx, Game_Api * api);
void update(json unit_json);
bool _dead;
string _name;
int _health;
int _base_health;
string _stance;
int _respawn_counter;
int _respawn_rate;
node_id_t _location;
int _attack;
DeathEffects _death_effects;
Game_Api* _api;
};
struct Player {
Player(string name, int health, int speed, node_id_t location, int movement_counter, Game_Api* api);
void update(json unit_json);
bool _dead;
string _name;
int _health;
string _stance;
int _speed;
node_id_t _location;
node_id_t _destination;
DeathEffects _death_effects;
int _movement_counter;
int _rock;
int _paper;
int _scissors;
Game_Api* _api;
};
struct Node {
vector<node_id_t> adjacent;
vector<Player*> players;
vector<Monster*> monsters;
};
public:
Player * _player1;
Player * _player2;
vector<Monster> all_monsters; //doesnt include players
vector<Node> nodes;
explicit Game_Api(int player_number, string json_str);
void update(json json_str);
void print();
void submit_decision(int destination, string stance);
Player* get_self();
Player* get_opponent();
vector<int> get_adjacent_nodes(int location);
private:
int _this_player_number;
};
#endif //MM2018_GAME_LOGIC_GAME_API_H