A unit in the game. May be a corvette, missleboat, martyr, transport, miner.
More...
#include <unit.hpp>
|
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...
|
|
|
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 Job & | job |
| 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 Player & | owner |
| The Player that owns and can control this Unit. More...
|
|
const Unit & | protector |
| 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...
|
|
A unit in the game. May be a corvette, missleboat, martyr, transport, miner.
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
-
enemy | The 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
-
x | The x value of the destination's coordinates. |
y | The 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
-
message | A 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
-
body | The 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
-
x | The x value of the destination's coordinates. |
y | The 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
-
x | The x position of the location you wish to arrive. |
y | The y position of the location you wish to arrive. |
bool cpp_client::stardash::Unit::shootdown |
( |
const Projectile & |
missile | ) |
|
attacks the specified projectile.
- Parameters
-
missile | The 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
-
unit | The unit you are grabbing the resources from. |
amount | The amount of materials to you with to grab. Amounts <= 0 will pick up all the materials that the unit can. |
material | The material the unit will pick up. 'genarium', 'rarium', 'legendarium', or 'mythicite'. |
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 |
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 |
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: