C++ Joueur Client
 All Classes Namespaces Functions Variables
cpp_client::coreminer::Miner Class Reference

A Miner in the game. More...

#include <miner.hpp>

Inheritance diagram for cpp_client::coreminer::Miner:
cpp_client::coreminer::Game_object cpp_client::Base_object

Public Member Functions

bool build (const Tile &tile, const std::string &type)
 builds a support, shield, or ladder on _miner's _tile, or an adjacent _tile. More...
 
bool buy (const std::string &resource, int amount)
 purchase a resource from the _player's base or hopper. More...
 
bool dump (const Tile &tile, const std::string &material, int amount)
 dumps materials from cargo to an adjacent _tile. _if the _tile is a base or a hopper _tile, materials are sold instead of placed. More...
 
bool mine (const Tile &tile, int amount)
 mines the _tile the _miner is on or an adjacent _tile. More...
 
bool move (const Tile &tile)
 moves this _miner from its current _tile to an adjacent _tile. More...
 
bool transfer (const Miner &miner, const std::string &resource, int amount)
 transfers a resource from the one _miner to another. More...
 
bool upgrade ()
 upgrade this _miner by installing an upgrade module. 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 int & bombs
 The number of bombs being carried by this Miner. More...
 
const int & building_materials
 The number of building materials carried by this Miner. More...
 
const Upgradecurrent_upgrade
 The Upgrade this Miner is on. More...
 
const int & dirt
 The amount of dirt carried by this Miner. More...
 
const int & health
 The remaining health of this Miner. More...
 
const int & mining_power
 The remaining mining power this Miner has this turn. More...
 
const int & moves
 The number of moves this Miner has left this turn. More...
 
const int & ore
 The amount of ore carried by this Miner. More...
 
const Playerowner
 The Player that owns and can control this Miner. More...
 
const Tiletile
 The Tile this Miner is on. More...
 
const int & upgrade_level
 The upgrade level of this Miner. Starts at 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...
 

Detailed Description

A Miner in the game.

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::coreminer::Miner::build ( const Tile tile,
const std::string &  type 
)

builds a support, shield, or ladder on _miner's _tile, or an adjacent _tile.

Parameters
tileThe Tile to build on.
typeThe structure to build (support, ladder, or shield).
bool cpp_client::coreminer::Miner::buy ( const std::string &  resource,
int  amount 
)

purchase a resource from the _player's base or hopper.

Parameters
resourceThe type of resource to buy.
amountThe amount of resource to buy. Amounts <= 0 will buy all of that material Player can.
bool cpp_client::coreminer::Miner::dump ( const Tile tile,
const std::string &  material,
int  amount 
)

dumps materials from cargo to an adjacent _tile. _if the _tile is a base or a hopper _tile, materials are sold instead of placed.

Parameters
tileThe Tile the materials will be dumped on.
materialThe material the Miner will drop. 'dirt', 'ore', or 'bomb'.
amountThe number of materials to drop. Amounts <= 0 will drop all of the material.
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::coreminer::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::coreminer::Miner::mine ( const Tile tile,
int  amount 
)

mines the _tile the _miner is on or an adjacent _tile.

Parameters
tileThe Tile the materials will be mined from.
amountThe amount of material to mine up. Amounts <= 0 will mine all the materials that the Miner can.
bool cpp_client::coreminer::Miner::move ( const Tile tile)

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

Parameters
tileThe Tile this Miner should move to.
bool cpp_client::coreminer::Miner::transfer ( const Miner miner,
const std::string &  resource,
int  amount 
)

transfers a resource from the one _miner to another.

Parameters
minerThe Miner to transfer materials to.
resourceThe type of resource to transfer.
amountThe amount of resource to transfer. Amounts <= 0 will transfer all the of the material.
bool cpp_client::coreminer::Miner::upgrade ( )

upgrade this _miner by installing an upgrade module.

Member Data Documentation

const int& cpp_client::coreminer::Miner::bombs

The number of bombs being carried by this Miner.

const int& cpp_client::coreminer::Miner::building_materials

The number of building materials carried by this Miner.

const Upgrade& cpp_client::coreminer::Miner::current_upgrade

The Upgrade this Miner is on.

const int& cpp_client::coreminer::Miner::dirt

The amount of dirt carried by this Miner.

const std::string& cpp_client::coreminer::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::coreminer::Miner::health

The remaining health of this Miner.

const std::string& cpp_client::coreminer::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 std::vector<std::string>& cpp_client::coreminer::Game_object::logs
inherited

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

const int& cpp_client::coreminer::Miner::mining_power

The remaining mining power this Miner has this turn.

const int& cpp_client::coreminer::Miner::moves

The number of moves this Miner has left this turn.

const int& cpp_client::coreminer::Miner::ore

The amount of ore carried by this Miner.

const Player& cpp_client::coreminer::Miner::owner

The Player that owns and can control this Miner.

const Tile& cpp_client::coreminer::Miner::tile

The Tile this Miner is on.

const int& cpp_client::coreminer::Miner::upgrade_level

The upgrade level of this Miner. Starts at 0.


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