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

A unit in the game. May be a corvette, missleboat, martyr, transport, miner. More...

#include <unit.hpp>

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

Public Member Functions

bool attack (const Unit &enemy)
 attacks the specified unit. More...
 
bool dash (const double &x, const double &y)
 causes the unit to dash towards the designated destination. More...
 
bool mine (const Body &body)
 allows a miner to mine a asteroid. More...
 
bool move (const double &x, const double &y)
 moves this _unit from its current location to the new location specified. More...
 
bool safe (const double &x, const double &y)
 tells you if your ship can move to that location from were it is without clipping the sun. More...
 
bool shootdown (const Projectile &missile)
 attacks the specified projectile. More...
 
bool transfer (const Unit &unit, int amount, const std::string &material)
 grab materials from a friendly unit. _doesn't use a action. 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 double & dash_x
 The x value this unit is dashing to. More...
 
const double & dash_y
 The y value this unit is dashing to. More...
 
const int & energy
 The remaining health of the unit. More...
 
const int & genarium
 The amount of Genarium ore carried by this unit. (0 to job carry capacity - other carried items). More...
 
const bool & is_busy
 Tracks whether or not the ship is dashing or Mining. If true, it cannot do anything else. More...
 
const Jobjob
 The Job this Unit has. More...
 
const int & legendarium
 The amount of Legendarium ore carried by this unit. (0 to job carry capacity - other carried items). More...
 
const double & moves
 The distance this unit can still move. More...
 
const int & mythicite
 The amount of Mythicite carried by this unit. (0 to job carry capacity - other carried items). More...
 
const Playerowner
 The Player that owns and can control this Unit. More...
 
const Unitprotector
 The martyr ship that is currently shielding this ship if any. More...
 
const int & rarium
 The amount of Rarium carried by this unit. (0 to job carry capacity - other carried items). More...
 
const int & shield
 The shield that a martyr ship has. More...
 
const double & x
 The x value this unit is on. More...
 
const double & y
 The y value 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 corvette, missleboat, martyr, transport, miner.

Member Function Documentation

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::stardash::Unit::attack ( const Unit enemy)

attacks the specified unit.

Parameters
enemyThe Unit being attacked.
bool cpp_client::stardash::Unit::dash ( const double &  x,
const double &  y 
)

causes the unit to dash towards the designated destination.

Parameters
xThe x value of the destination's coordinates.
yThe y value of the destination's coordinates.
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::stardash::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::stardash::Unit::mine ( const Body body)

allows a miner to mine a asteroid.

Parameters
bodyThe object to be mined.
bool cpp_client::stardash::Unit::move ( const double &  x,
const double &  y 
)

moves this _unit from its current location to the new location specified.

Parameters
xThe x value of the destination's coordinates.
yThe y value of the destination's coordinates.
bool cpp_client::stardash::Unit::safe ( const double &  x,
const double &  y 
)

tells you if your ship can move to that location from were it is without clipping the sun.

Parameters
xThe x position of the location you wish to arrive.
yThe y position of the location you wish to arrive.
bool cpp_client::stardash::Unit::shootdown ( const Projectile missile)

attacks the specified projectile.

Parameters
missileThe projectile being shot down.
bool cpp_client::stardash::Unit::transfer ( const Unit unit,
int  amount,
const std::string &  material 
)

grab materials from a friendly unit. _doesn't use a action.

Parameters
unitThe unit you are grabbing the resources from.
amountThe amount of materials to you with to grab. Amounts <= 0 will pick up all the materials that the unit can.
materialThe material the unit will pick up. 'genarium', 'rarium', 'legendarium', or 'mythicite'.

Member Data Documentation

const bool& cpp_client::stardash::Unit::acted

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

const double& cpp_client::stardash::Unit::dash_x

The x value this unit is dashing to.

const double& cpp_client::stardash::Unit::dash_y

The y value this unit is dashing to.

const int& cpp_client::stardash::Unit::energy

The remaining health of the unit.

const std::string& cpp_client::stardash::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::stardash::Unit::genarium

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

const std::string& cpp_client::stardash::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 bool& cpp_client::stardash::Unit::is_busy

Tracks whether or not the ship is dashing or Mining. If true, it cannot do anything else.

const Job& cpp_client::stardash::Unit::job

The Job this Unit has.

const int& cpp_client::stardash::Unit::legendarium

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

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

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

const double& cpp_client::stardash::Unit::moves

The distance this unit can still move.

const int& cpp_client::stardash::Unit::mythicite

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

const Player& cpp_client::stardash::Unit::owner

The Player that owns and can control this Unit.

const Unit& cpp_client::stardash::Unit::protector

The martyr ship that is currently shielding this ship if any.

const int& cpp_client::stardash::Unit::rarium

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

const int& cpp_client::stardash::Unit::shield

The shield that a martyr ship has.

const double& cpp_client::stardash::Unit::x

The x value this unit is on.

const double& cpp_client::stardash::Unit::y

The y value this unit is on.


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