C++ Joueur Client
 All Classes Namespaces Functions Variables
cpp_client::newtonian::Unit Class Reference

A unit in the game. May be a manager, intern, or physicist. More...

#include <unit.hpp>

Inheritance diagram for cpp_client::newtonian::Unit:
cpp_client::newtonian::Game_object cpp_client::Base_object

Public Member Functions

bool act (const Tile &tile)
 makes the unit do something to a machine or unit adjacent to its tile. _interns sabotage, physicists work. _interns stun physicist, physicist stuns manager, manager stuns intern. More...
 
bool attack (const Tile &tile)
 attacks a unit on an adjacent tile. More...
 
bool drop (const Tile &tile, int amount, const std::string &material)
 drops materials at the units feet or 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, int amount, const std::string &material)
 picks up material at the units feet or adjacent tile. 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...
 

Public Attributes

const bool & acted
 Whether or not this Unit has performed its action this turn. More...
 
const int & blueium
 The amount of blueium carried by this unit. (0 to job carry capacity - other carried items). More...
 
const int & blueium_ore
 The amount of blueium ore carried by this unit. (0 to job carry capacity - other carried items). More...
 
const int & health
 The remaining health of a unit. More...
 
const Jobjob
 The Job this Unit has. More...
 
const int & moves
 The number of moves this unit has left this turn. More...
 
const Playerowner
 The Player that owns and can control this Unit. More...
 
const int & redium
 The amount of redium carried by this unit. (0 to job carry capacity - other carried items). More...
 
const int & redium_ore
 The amount of redium ore carried by this unit. (0 to job carry capacity - other carried items). More...
 
const int & stun_immune
 Duration of stun immunity. (0 to timeImmune). More...
 
const int & stun_time
 Duration the unit is stunned. (0 to the game constant stunTime). More...
 
const Tiletile
 The Tile this Unit is on. 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...
 

Detailed Description

A unit in the game. May be a manager, intern, or physicist.

Member Function Documentation

bool cpp_client::newtonian::Unit::act ( const Tile tile)

makes the unit do something to a machine or unit adjacent to its tile. _interns sabotage, physicists work. _interns stun physicist, physicist stuns manager, manager stuns intern.

Parameters
tileThe tile the unit acts on.
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::newtonian::Unit::attack ( const Tile tile)

attacks a unit on an adjacent tile.

Parameters
tileThe Tile to attack.
bool cpp_client::newtonian::Unit::drop ( const Tile tile,
int  amount,
const std::string &  material 
)

drops materials at the units feet or adjacent tile.

Parameters
tileThe tile the materials will be dropped on.
amountThe number of materials to dropped. Amounts <= 0 will drop all the materials.
materialThe material the unit will drop. 'redium', 'blueium', 'redium ore', or 'blueium ore'.
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::newtonian::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
messageA string to add to this GameObject's log. Intended for debugging.
bool cpp_client::newtonian::Unit::move ( const Tile tile)

moves this _unit from its current _tile to an adjacent _tile.

Parameters
tileThe Tile this Unit should move to.
bool cpp_client::newtonian::Unit::pickup ( const Tile tile,
int  amount,
const std::string &  material 
)

picks up material at the units feet or adjacent tile.

Parameters
tileThe tile the materials will be picked up from.
amountThe amount of materials to pick up. Amounts <= 0 will pick up all the materials that the unit can.
materialThe material the unit will pick up. 'redium', 'blueium', 'redium ore', or 'blueium ore'.

Member Data Documentation

const bool& cpp_client::newtonian::Unit::acted

Whether or not this Unit has performed its action this turn.

const int& cpp_client::newtonian::Unit::blueium

The amount of blueium carried by this unit. (0 to job carry capacity - other carried items).

const int& cpp_client::newtonian::Unit::blueium_ore

The amount of blueium ore carried by this unit. (0 to job carry capacity - other carried items).

const std::string& cpp_client::newtonian::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 int& cpp_client::newtonian::Unit::health

The remaining health of a unit.

const std::string& cpp_client::newtonian::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::newtonian::Unit::job

The Job this Unit has.

const std::vector<std::string>& cpp_client::newtonian::Game_object::logs
inherited

Any strings logged will be stored here. Intended for debugging.

const int& cpp_client::newtonian::Unit::moves

The number of moves this unit has left this turn.

const Player& cpp_client::newtonian::Unit::owner

The Player that owns and can control this Unit.

const int& cpp_client::newtonian::Unit::redium

The amount of redium carried by this unit. (0 to job carry capacity - other carried items).

const int& cpp_client::newtonian::Unit::redium_ore

The amount of redium ore carried by this unit. (0 to job carry capacity - other carried items).

const int& cpp_client::newtonian::Unit::stun_immune

Duration of stun immunity. (0 to timeImmune).

const int& cpp_client::newtonian::Unit::stun_time

Duration the unit is stunned. (0 to the game constant stunTime).

const Tile& cpp_client::newtonian::Unit::tile

The Tile this Unit is on.


The documentation for this class was generated from the following file: