C++ Joueur Client
 All Classes Namespaces Functions Variables
cpp_client::stumped::Beaver Class Reference

A beaver in the game. More...

#include <beaver.hpp>

Inheritance diagram for cpp_client::stumped::Beaver:
cpp_client::stumped::Game_object cpp_client::Base_object

Public Member Functions

bool attack (const Beaver &beaver)
 attacks another adjacent beaver. More...
 
bool build_lodge ()
 builds a lodge on the _beavers current _tile. More...
 
bool drop (const Tile &tile, const std::string &resource, int amount=0)
 drops some of the given resource on the beaver's _tile. More...
 
bool harvest (const Spawner &spawner)
 harvests the branches or food from a _spawner on an adjacent _tile. More...
 
bool move (const Tile &tile)
 moves this _beaver from its current _tile to an adjacent _tile. More...
 
bool pickup (const Tile &tile, const std::string &resource, int amount=0)
 picks up some branches or food on the beaver's 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 int & actions
 The number of actions remaining for the Beaver this turn. More...
 
const int & branches
 The amount of branches this Beaver is holding. More...
 
const int & food
 The amount of food this Beaver is holding. More...
 
const int & health
 How much health this Beaver has left. More...
 
const Jobjob
 The Job this Beaver was recruited to do. More...
 
const int & moves
 How many moves this Beaver has left this turn. More...
 
const Playerowner
 The Player that owns and can control this Beaver. More...
 
const bool & recruited
 True if the Beaver has finished being recruited and can do things, False otherwise. More...
 
const Tiletile
 The Tile this Beaver is on. More...
 
const int & turns_distracted
 Number of turns this Beaver is distracted for (0 means not distracted). 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 beaver 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::stumped::Beaver::attack ( const Beaver beaver)

attacks another adjacent beaver.

Parameters
beaverThe Beaver to attack. Must be on an adjacent Tile.
bool cpp_client::stumped::Beaver::build_lodge ( )

builds a lodge on the _beavers current _tile.

bool cpp_client::stumped::Beaver::drop ( const Tile tile,
const std::string &  resource,
int  amount = 0 
)

drops some of the given resource on the beaver's _tile.

Parameters
tileThe Tile to drop branches/food on. Must be the same Tile that the Beaver is on, or an adjacent one.
resourceThe type of resource to drop ('branches' or 'food').
amountThe amount of the resource to drop, numbers <= 0 will drop all the resource type.
bool cpp_client::stumped::Beaver::harvest ( const Spawner spawner)

harvests the branches or food from a _spawner on an adjacent _tile.

Parameters
spawnerThe Spawner you want to harvest. Must be on an adjacent Tile.
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::stumped::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::stumped::Beaver::move ( const Tile tile)

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

Parameters
tileThe Tile this Beaver should move to.
bool cpp_client::stumped::Beaver::pickup ( const Tile tile,
const std::string &  resource,
int  amount = 0 
)

picks up some branches or food on the beaver's tile.

Parameters
tileThe Tile to pickup branches/food from. Must be the same Tile that the Beaver is on, or an adjacent one.
resourceThe type of resource to pickup ('branches' or 'food').
amountThe amount of the resource to drop, numbers <= 0 will pickup all of the resource type.

Member Data Documentation

const int& cpp_client::stumped::Beaver::actions

The number of actions remaining for the Beaver this turn.

const int& cpp_client::stumped::Beaver::branches

The amount of branches this Beaver is holding.

const int& cpp_client::stumped::Beaver::food

The amount of food this Beaver is holding.

const std::string& cpp_client::stumped::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::stumped::Beaver::health

How much health this Beaver has left.

const std::string& cpp_client::stumped::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::stumped::Beaver::job

The Job this Beaver was recruited to do.

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

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

const int& cpp_client::stumped::Beaver::moves

How many moves this Beaver has left this turn.

const Player& cpp_client::stumped::Beaver::owner

The Player that owns and can control this Beaver.

const bool& cpp_client::stumped::Beaver::recruited

True if the Beaver has finished being recruited and can do things, False otherwise.

const Tile& cpp_client::stumped::Beaver::tile

The Tile this Beaver is on.

const int& cpp_client::stumped::Beaver::turns_distracted

Number of turns this Beaver is distracted for (0 means not distracted).


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