A unit in the game.
More...
#include <unit.hpp>
|
bool | attack (const Tile &tile) |
| attacks an adjacent _tile. _costs an action for each _unit in this _unit's squad. _units in the squad without an action don't participate in combat. _units in combat cannot move afterwards. _attacking structures will not give materials. More...
|
|
bool | change_job (const std::string &job) |
| changes this _unit's _job. _must be at max energy (100) to change _jobs. More...
|
|
bool | construct (const Tile &tile, const std::string &type) |
| constructs a _structure on an adjacent _tile. More...
|
|
bool | convert (const Tile &tile) |
| converts an adjacent _unit to your side. More...
|
|
bool | deconstruct (const Tile &tile) |
| removes materials from an adjacent _tile's _structure. _you cannot deconstruct friendly structures (see _unit.attack ). More...
|
|
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. More...
|
|
bool | harvest (const Tile &tile) |
| harvests the food on an adjacent _tile. More...
|
|
bool | move (const Tile &tile) |
| moves this _unit from its current _tile to an adjacent _tile. More...
|
|
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. More...
|
|
bool | rest () |
| regenerates energy. _must be in range of a friendly shelter to rest. _costs an action. _units cannot move after resting. More...
|
|
void | log (const std::string &message) |
| adds a message to this _game_object's logs. _intended for your own debugging purposes, as strings stored here are saved in the gamelog. More...
|
|
template<typename T > |
std::shared_ptr< typename
T::element_type > | as () |
| Dynamically casts this object to another type. Returns nullptr if it cannot be converted to the type. More...
|
|
template<typename T > |
bool | is () |
| Determines if this object is of the specified object type More...
|
|
|
const bool & | acted |
| Whether this Unit has performed its action this turn. More...
|
|
const double & | energy |
| The amount of energy this Unit has (from 0.0 to 100.0). More...
|
|
const int & | food |
| The amount of food this Unit is holding. More...
|
|
const Job & | job |
| The Job this Unit was recruited to do. More...
|
|
const int & | materials |
| The amount of materials this Unit is holding. More...
|
|
const Tile & | movement_target |
| The tile this Unit is moving to. This only applies to neutral fresh humans spawned on the road. Otherwise, the tile this Unit is on. More...
|
|
const int & | moves |
| How many moves this Unit has left this turn. More...
|
|
const Player & | owner |
| The Player that owns and can control this Unit, or null if the Unit is neutral. More...
|
|
const std::vector< Unit > & | squad |
| The Units in the same squad as this Unit. Units in the same squad attack and defend together. More...
|
|
const bool & | starving |
| Whether this Unit is starving. Starving Units regenerate energy at half the rate they normally would while resting. More...
|
|
const Tile & | tile |
| The Tile this Unit is on. More...
|
|
const int & | turns_to_die |
| The number of turns before this Unit dies. This only applies to neutral fresh humans created from combat. Otherwise, 0. More...
|
|
const std::string & | game_object_name |
| String representing the top level Class that this game object is an instance of. Used for reflection to create new instances on clients, but exposed for convenience should AIs want this data. More...
|
|
const std::string & | id |
| A unique id for each instance of a GameObject or a sub class. Used for client and server communication. Should never change value after being set. More...
|
|
const std::vector< std::string > & | logs |
| Any strings logged will be stored here. Intended for debugging. More...
|
|
template<typename T >
std::shared_ptr<typename T::element_type> cpp_client::Base_object::as |
( |
| ) |
|
|
inlineinherited |
Dynamically casts this object to another type. Returns nullptr if it cannot be converted to the type.
- Returns
- A pointer to the desired type, or nullptr if it could not be converted
bool cpp_client::catastrophe::Unit::attack |
( |
const Tile & |
tile | ) |
|
attacks an adjacent _tile. _costs an action for each _unit in this _unit's squad. _units in the squad without an action don't participate in combat. _units in combat cannot move afterwards. _attacking structures will not give materials.
- Parameters
-
bool cpp_client::catastrophe::Unit::change_job |
( |
const std::string & |
job | ) |
|
changes this _unit's _job. _must be at max energy (100) to change _jobs.
- Parameters
-
job | The name of the Job to change to. |
bool cpp_client::catastrophe::Unit::construct |
( |
const Tile & |
tile, |
|
|
const std::string & |
type |
|
) |
| |
constructs a _structure on an adjacent _tile.
- Parameters
-
bool cpp_client::catastrophe::Unit::convert |
( |
const Tile & |
tile | ) |
|
converts an adjacent _unit to your side.
- Parameters
-
bool cpp_client::catastrophe::Unit::deconstruct |
( |
const Tile & |
tile | ) |
|
removes materials from an adjacent _tile's _structure. _you cannot deconstruct friendly structures (see _unit.attack
).
- Parameters
-
bool cpp_client::catastrophe::Unit::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.
- Parameters
-
tile | The Tile to drop materials/food on. |
resource | The type of resource to drop ('materials' or 'food'). |
amount | The amount of the resource to drop. Amounts <= 0 will drop as much as possible. |
bool cpp_client::catastrophe::Unit::harvest |
( |
const Tile & |
tile | ) |
|
harvests the food on an adjacent _tile.
- Parameters
-
tile | The Tile you want to harvest. |
template<typename T >
bool cpp_client::Base_object::is |
( |
| ) |
|
|
inlineinherited |
Determines if this object is of the specified object type
- Returns
- true if the object is the object type, false otherwise
void cpp_client::catastrophe::Game_object::log |
( |
const std::string & |
message | ) |
|
|
inherited |
adds a message to this _game_object's logs. _intended for your own debugging purposes, as strings stored here are saved in the gamelog.
- Parameters
-
message | A string to add to this GameObject's log. Intended for debugging. |
bool cpp_client::catastrophe::Unit::move |
( |
const Tile & |
tile | ) |
|
moves this _unit from its current _tile to an adjacent _tile.
- Parameters
-
bool cpp_client::catastrophe::Unit::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.
- Parameters
-
tile | The Tile to pickup materials/food from. |
resource | The type of resource to pickup ('materials' or 'food'). |
amount | The amount of the resource to pickup. Amounts <= 0 will pickup as much as possible. |
bool cpp_client::catastrophe::Unit::rest |
( |
| ) |
|
regenerates energy. _must be in range of a friendly shelter to rest. _costs an action. _units cannot move after resting.
const bool& cpp_client::catastrophe::Unit::acted |
Whether this Unit has performed its action this turn.
const double& cpp_client::catastrophe::Unit::energy |
The amount of energy this Unit has (from 0.0 to 100.0).
const int& cpp_client::catastrophe::Unit::food |
The amount of food this Unit is holding.
const std::string& cpp_client::catastrophe::Game_object::game_object_name |
|
inherited |
String representing the top level Class that this game object is an instance of. Used for reflection to create new instances on clients, but exposed for convenience should AIs want this data.
const std::string& cpp_client::catastrophe::Game_object::id |
|
inherited |
A unique id for each instance of a GameObject or a sub class. Used for client and server communication. Should never change value after being set.
const Job& cpp_client::catastrophe::Unit::job |
The Job this Unit was recruited to do.
const std::vector<std::string>& cpp_client::catastrophe::Game_object::logs |
|
inherited |
Any strings logged will be stored here. Intended for debugging.
const int& cpp_client::catastrophe::Unit::materials |
The amount of materials this Unit is holding.
const Tile& cpp_client::catastrophe::Unit::movement_target |
The tile this Unit is moving to. This only applies to neutral fresh humans spawned on the road. Otherwise, the tile this Unit is on.
const int& cpp_client::catastrophe::Unit::moves |
How many moves this Unit has left this turn.
const Player& cpp_client::catastrophe::Unit::owner |
The Player that owns and can control this Unit, or null if the Unit is neutral.
const std::vector<Unit>& cpp_client::catastrophe::Unit::squad |
The Units in the same squad as this Unit. Units in the same squad attack and defend together.
const bool& cpp_client::catastrophe::Unit::starving |
Whether this Unit is starving. Starving Units regenerate energy at half the rate they normally would while resting.
const Tile& cpp_client::catastrophe::Unit::tile |
const int& cpp_client::catastrophe::Unit::turns_to_die |
The number of turns before this Unit dies. This only applies to neutral fresh humans created from combat. Otherwise, 0.
The documentation for this class was generated from the following file: