1 #ifndef GAMES_PIRATES_GAME_H
2 #define GAMES_PIRATES_GAME_H
14 #include <unordered_map>
16 #include <initializer_list>
18 #include "../../joueur/src/any.hpp"
21 #include "../../joueur/src/base_game.hpp"
22 #include "impl/pirates_fwd.hpp"
45 class Game :
public Base_game
212 Game_(std::initializer_list<std::pair<std::string, Any&&>> init);
213 Game_() : Game_({}){}
214 virtual void resize(
const std::string& name, std::size_t size)
override;
215 virtual void change_vec_values(
const std::string& name, std::vector<std::pair<std::size_t, Any>>& values)
override;
216 virtual void remove_key(
const std::string& name, Any& key)
override;
217 virtual std::unique_ptr<Any> add_key_value(
const std::string& name, Any& key, Any& value)
override;
218 virtual bool is_map(
const std::string& name)
override;
219 virtual void rebind_by_name(Any* to_change,
const std::string& member, std::shared_ptr<Base_object> ref)
override;
230 #endif // GAMES_PIRATES_GAME_H
const int & ship_cost
How much gold it costs to construct a ship.
Definition: game.hpp:152
const std::vector< Port > & ports
Every Port in the game. Merchant ports have owner set to null.
Definition: game.hpp:137
const double & heal_factor
How much health a Unit recovers when they rest.
Definition: game.hpp:97
const int & map_height
The number of Tiles in the map along the y (vertical) axis.
Definition: game.hpp:102
const int & max_turns
The maximum number of turns before the game will automatically end.
Definition: game.hpp:112
const int & ship_health
The maximum amount of health a ship can have.
Definition: game.hpp:162
const std::vector< Player > & players
List of all the players in the game.
Definition: game.hpp:132
const double & rest_range
How far a Unit can be from a Port to rest. Range is circular.
Definition: game.hpp:142
A Tile in the game that makes up the 2D map grid.
Definition: tile.hpp:37
const std::string & session
A unique identifier for the game instance that is being played.
Definition: game.hpp:147
const int & ship_damage
How much damage ships deal to ships and ports.
Definition: game.hpp:157
const double & merchant_gold_rate
How much gold merchant Ports get each turn.
Definition: game.hpp:117
const std::unordered_map< std::string, Game_object > & game_objects
A mapping of every game object's ID to the actual game object. Primarily used by the server and clien...
Definition: game.hpp:92
const int & crew_cost
How much gold it costs to construct a single crew.
Definition: game.hpp:57
const std::vector< Tile > & tiles
All the tiles in the map, stored in Row-major order. Use x + y * mapWidth to access the correct index...
Definition: game.hpp:177
const Player & current_player
The player whose turn it is currently. That player can send commands. Other players cannot...
Definition: game.hpp:82
const int & map_width
The number of Tiles in the map along the x (horizontal) axis.
Definition: game.hpp:107
const double & ship_range
A ship's attack range. Range is circular.
Definition: game.hpp:172
Steal from merchants and become the most infamous pirate.
Definition: game.hpp:45
const int & current_turn
The current turn number, starting at 0 for the first player's turn.
Definition: game.hpp:87
const double & merchant_interest_rate
When a merchant ship spawns, the amount of additional gold it has relative to the Port's investment...
Definition: game.hpp:122
const int & time_added_per_turn
The amount of time (in nano-seconds) added after each player performs a turn.
Definition: game.hpp:182
const double & crew_range
A crew's attack range. Range is circular.
Definition: game.hpp:77
const int & crew_damage
How much damage crew deal to each other.
Definition: game.hpp:62
const int & ship_moves
The number of moves Units with ships are given each turn.
Definition: game.hpp:167
const int & crew_health
The maximum amount of health a crew member can have.
Definition: game.hpp:67
const double & min_interest_distance
The Euclidean distance buried gold must be from the Player's Port to accumulate interest.
Definition: game.hpp:127
const double & bury_interest_rate
The rate buried gold increases each turn.
Definition: game.hpp:52
Tile get_tile_at(const int x, const int y)
Gets the Tile at a specified (x, y) position
const std::vector< Unit > & units
Every Unit in the game. Merchant units have targetPort set to a port.
Definition: game.hpp:187
const int & crew_moves
The number of moves Units with only crew are given each turn.
Definition: game.hpp:72
A player in this game. Every AI controls one player.
Definition: player.hpp:37