A unit in the game. May be a worker, zombie, ghoul, hound, abomination, wraith or horseman.
More...
#include <unit.hpp>
|
bool | attack (const Tile &tile) |
| attacks an enemy tower on an adjacent tile. More...
|
|
bool | build (const std::string &title) |
| unit, if it is a worker, builds a tower on the tile it is on, only workers can do this. More...
|
|
bool | fish (const Tile &tile) |
| stops adjacent to a river tile and begins fishing for mana. More...
|
|
bool | mine (const Tile &tile) |
| enters a mine and is put to work gathering resources. More...
|
|
bool | move (const Tile &tile) |
| moves this _unit from its current _tile to an 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...
|
|
|
const bool & | acted |
| Whether or not this Unit has performed its action this turn (attack or build). More...
|
|
const int & | health |
| The remaining health of a unit. More...
|
|
const Unit_job & | job |
| The type of unit this is. More...
|
|
const int & | moves |
| The number of moves this unit has left this turn. More...
|
|
const Player & | owner |
| The Player that owns and can control this Unit. More...
|
|
const Tile & | tile |
| 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...
|
|
A unit in the game. May be a worker, zombie, ghoul, hound, abomination, wraith or horseman.
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::necrowar::Unit::attack |
( |
const Tile & |
tile | ) |
|
attacks an enemy tower on an adjacent tile.
- Parameters
-
bool cpp_client::necrowar::Unit::build |
( |
const std::string & |
title | ) |
|
unit, if it is a worker, builds a tower on the tile it is on, only workers can do this.
- Parameters
-
title | The tower type to build, as a string. |
bool cpp_client::necrowar::Unit::fish |
( |
const Tile & |
tile | ) |
|
stops adjacent to a river tile and begins fishing for mana.
- Parameters
-
tile | The tile the unit will stand on as it fishes. |
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::necrowar::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::necrowar::Unit::mine |
( |
const Tile & |
tile | ) |
|
enters a mine and is put to work gathering resources.
- Parameters
-
tile | The tile the mine is located on. |
bool cpp_client::necrowar::Unit::move |
( |
const Tile & |
tile | ) |
|
moves this _unit from its current _tile to an adjacent _tile.
- Parameters
-
const bool& cpp_client::necrowar::Unit::acted |
Whether or not this Unit has performed its action this turn (attack or build).
const std::string& cpp_client::necrowar::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::necrowar::Unit::health |
The remaining health of a unit.
const std::string& cpp_client::necrowar::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 Unit_job& cpp_client::necrowar::Unit::job |
The type of unit this is.
const std::vector<std::string>& cpp_client::necrowar::Game_object::logs |
|
inherited |
Any strings logged will be stored here. Intended for debugging.
const int& cpp_client::necrowar::Unit::moves |
The number of moves this unit has left this turn.
const Player& cpp_client::necrowar::Unit::owner |
const Tile& cpp_client::necrowar::Unit::tile |
The documentation for this class was generated from the following file: