1 #ifndef GAMES_CATASTROPHE_UNIT_H 
    2 #define GAMES_CATASTROPHE_UNIT_H 
   14 #include <unordered_map> 
   16 #include <initializer_list> 
   18 #include "../../joueur/src/any.hpp" 
   20 #include "game_object.hpp" 
   22 #include "impl/catastrophe_fwd.hpp" 
  143     bool drop(
const Tile& 
tile, 
const std::string& resource, 
int amount = 0);
 
  163     bool pickup(
const Tile& 
tile, 
const std::string& resource, 
int amount = 0);
 
  181    Unit_(std::initializer_list<std::pair<std::string, Any&&>> init);
 
  182    Unit_() : Unit_({}){}
 
  183    virtual void resize(
const std::string& name, std::size_t size) 
override;
 
  184    virtual void change_vec_values(
const std::string& name, std::vector<std::pair<std::size_t, Any>>& values) 
override;
 
  185    virtual void remove_key(
const std::string& name, Any& key) 
override;
 
  186    virtual std::unique_ptr<Any> add_key_value(
const std::string& name, Any& key, Any& value) 
override;
 
  187    virtual bool is_map(
const std::string& name) 
override;
 
  188    virtual void rebind_by_name(Any* to_change, 
const std::string& member, std::shared_ptr<Base_object> ref) 
override;
 
  199 #endif // GAMES_CATASTROPHE_UNIT_H 
const int & moves
How many moves this Unit has left this turn. 
Definition: unit.hpp:74
 
const bool & starving
Whether this Unit is starving. Starving Units regenerate energy at half the rate they normally would ...
Definition: unit.hpp:89
 
bool construct(const Tile &tile, const std::string &type)
constructs a _structure on an adjacent _tile. 
 
A Tile in the game that makes up the 2D map grid. 
Definition: tile.hpp:37
 
An object in the game. The most basic class that all game classes should inherit from automatically...
Definition: game_object.hpp:37
 
bool move(const Tile &tile)
moves this _unit from its current _tile to an adjacent _tile. 
 
bool attack(const Tile &tile)
attacks an adjacent _tile. _costs an action for each _unit in this _unit's squad. _units in the squad...
 
const Job & job
The Job this Unit was recruited to do. 
Definition: unit.hpp:59
 
Information about a Unit's job. 
Definition: job.hpp:37
 
bool change_job(const std::string &job)
changes this _unit's _job. _must be at max energy (100) to change _jobs. 
 
const Tile & movement_target
The tile this Unit is moving to. This only applies to neutral fresh humans spawned on the road...
Definition: unit.hpp:69
 
bool rest()
regenerates energy. _must be in range of a friendly shelter to rest. _costs an action. _units cannot move after resting. 
 
const Player & owner
The Player that owns and can control this Unit, or null if the Unit is neutral. 
Definition: unit.hpp:79
 
const std::vector< Unit > & squad
The Units in the same squad as this Unit. Units in the same squad attack and defend together...
Definition: unit.hpp:84
 
const Tile & tile
The Tile this Unit is on. 
Definition: unit.hpp:94
 
bool pickup(const Tile &tile, const std::string &resource, int amount=0)
picks up some materials or food on or adjacent to the _unit's _tile. _does not count as an action...
 
const int & food
The amount of food this Unit is holding. 
Definition: unit.hpp:54
 
const double & energy
The amount of energy this Unit has (from 0.0 to 100.0). 
Definition: unit.hpp:49
 
bool deconstruct(const Tile &tile)
removes materials from an adjacent _tile's _structure. _you cannot deconstruct friendly structures (s...
 
bool harvest(const Tile &tile)
harvests the food on an adjacent _tile. 
 
const int & materials
The amount of materials this Unit is holding. 
Definition: unit.hpp:64
 
const bool & acted
Whether this Unit has performed its action this turn. 
Definition: unit.hpp:44
 
bool convert(const Tile &tile)
converts an adjacent _unit to your side. 
 
A unit in the game. 
Definition: unit.hpp:37
 
const int & turns_to_die
The number of turns before this Unit dies. This only applies to neutral fresh humans created from com...
Definition: unit.hpp:99
 
A player in this game. Every AI controls one player. 
Definition: player.hpp:37
 
bool drop(const Tile &tile, const std::string &resource, int amount=0)
drops some of the given resource on or adjacent to the _unit's _tile. _does not count as an action...