1 #ifndef GAMES_PIRATES_UNIT_H 
    2 #define GAMES_PIRATES_UNIT_H 
   14 #include <unordered_map> 
   16 #include <initializer_list> 
   18 #include "../../joueur/src/any.hpp" 
   20 #include "game_object.hpp" 
   22 #include "impl/pirates_fwd.hpp" 
   74     const std::vector<Tile>& 
path;
 
  112     bool bury(
int amount);
 
  124     bool dig(
int amount = 0);
 
  162    Unit_(std::initializer_list<std::pair<std::string, Any&&>> init);
 
  163    Unit_() : Unit_({}){}
 
  164    virtual void resize(
const std::string& name, std::size_t size) 
override;
 
  165    virtual void change_vec_values(
const std::string& name, std::vector<std::pair<std::size_t, Any>>& values) 
override;
 
  166    virtual void remove_key(
const std::string& name, Any& key) 
override;
 
  167    virtual std::unique_ptr<Any> add_key_value(
const std::string& name, Any& key, Any& value) 
override;
 
  168    virtual bool is_map(
const std::string& name) 
override;
 
  169    virtual void rebind_by_name(Any* to_change, 
const std::string& member, std::shared_ptr<Base_object> ref) 
override;
 
  180 #endif // GAMES_PIRATES_UNIT_H 
const int & moves
How many more times this Unit may move this turn. 
Definition: unit.hpp:64
 
const Player & owner
The Player that owns and can control this Unit, or null if the Unit is neutral. 
Definition: unit.hpp:69
 
const int & gold
How much gold this Unit is carrying. 
Definition: unit.hpp:59
 
const std::vector< Tile > & path
(Merchants only) The path this Unit will follow. The first element is the Tile this Unit will move to...
Definition: unit.hpp:74
 
const bool & acted
Whether this Unit has performed its action this turn. 
Definition: unit.hpp:44
 
const int & ship_health
If a ship is on this Tile, how much health it has remaining. 0 for no ship. 
Definition: unit.hpp:79
 
bool rest()
regenerates this _unit's health. _must be used in range of a port. 
 
A Tile in the game that makes up the 2D map grid. 
Definition: tile.hpp:37
 
bool deposit(int amount=0)
puts gold into an adjacent _port. _if that _port is the _player's port, the gold is added to that _pl...
 
bool bury(int amount)
buries gold on this _unit's _tile. _gold must be a certain distance away for it to get interest (_gam...
 
const Port & target_port
(Merchants only) The Port this Unit is moving to. 
Definition: unit.hpp:89
 
const int & crew
How many crew are on this Tile. This number will always be <= crewHealth. 
Definition: unit.hpp:49
 
bool withdraw(int amount=0)
takes gold from the _player. _you can only withdraw from your own _port. 
 
const int & stun_turns
(Merchants only) The number of turns this merchant ship won't be able to move. They will still attack...
Definition: unit.hpp:84
 
bool dig(int amount=0)
digs up gold on this _unit's _tile. 
 
A unit group in the game. This may consist of a ship and any number of crew. 
Definition: unit.hpp:37
 
bool attack(const Tile &tile, const std::string &target)
attacks either the 'crew' or 'ship' on a _tile in range. 
 
A port on a Tile. 
Definition: port.hpp:37
 
const int & crew_health
How much total health the crew on this Tile have. 
Definition: unit.hpp:54
 
bool move(const Tile &tile)
moves this _unit from its current _tile to an adjacent _tile. _if this _unit merges with another one...
 
bool split(const Tile &tile, int amount=1, int gold=0)
moves a number of crew from this _unit to the given _tile. _this will consume a move from those crew...
 
An object in the game. The most basic class that all game classes should inherit from automatically...
Definition: game_object.hpp:37
 
const Tile & tile
The Tile this Unit is on. 
Definition: unit.hpp:94
 
A player in this game. Every AI controls one player. 
Definition: player.hpp:37