C++ Joueur Client
 All Classes Namespaces Functions Variables
cpp_client::saloon::Cowboy Class Reference

A person on the map that can move around and interact within the saloon. More...

#include <cowboy.hpp>

Inheritance diagram for cpp_client::saloon::Cowboy:
cpp_client::saloon::Game_object cpp_client::Base_object

Public Member Functions

bool act (const Tile &tile, const std::string &drunk_direction="")
 does their job's action on a _tile. More...
 
bool move (const Tile &tile)
 moves this _cowboy from its current _tile to an adjacent _tile. More...
 
bool play (const Furnishing &piano)
 sits down and plays a piano. 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 & can_move
 If the Cowboy can be moved this turn via its owner. More...
 
const std::string & drunk_direction
 The direction this Cowboy is moving while drunk. Will be 'North', 'East', 'South', or 'West' when drunk; or '' (empty string) when not drunk. More...
 
const int & focus
 How much focus this Cowboy has. Different Jobs do different things with their Cowboy's focus. More...
 
const int & health
 How much health this Cowboy currently has. More...
 
const bool & is_dead
 If this Cowboy is dead and has been removed from the game. More...
 
const bool & is_drunk
 If this Cowboy is drunk, and will automatically walk. More...
 
const std::string & job
 The job that this Cowboy does, and dictates how they fight and interact within the Saloon. More...
 
const Playerowner
 The Player that owns and can control this Cowboy. More...
 
const Tiletile
 The Tile that this Cowboy is located on. More...
 
const int & tolerance
 How many times this unit has been drunk before taking their siesta and resetting this to 0. More...
 
const int & turns_busy
 How many turns this unit has remaining before it is no longer busy and can act() or play() again. 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 person on the map that can move around and interact within the saloon.

Member Function Documentation

bool cpp_client::saloon::Cowboy::act ( const Tile tile,
const std::string &  drunk_direction = "" 
)

does their job's action on a _tile.

Parameters
tileThe Tile you want this Cowboy to act on.
drunk_directionThe direction the bottle will cause drunk cowboys to be in, can be 'North', 'East', 'South', or 'West'.
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
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::saloon::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::saloon::Cowboy::move ( const Tile tile)

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

Parameters
tileThe Tile you want to move this Cowboy to.
bool cpp_client::saloon::Cowboy::play ( const Furnishing piano)

sits down and plays a piano.

Parameters
pianoThe Furnishing that is a piano you want to play.

Member Data Documentation

const bool& cpp_client::saloon::Cowboy::can_move

If the Cowboy can be moved this turn via its owner.

const std::string& cpp_client::saloon::Cowboy::drunk_direction

The direction this Cowboy is moving while drunk. Will be 'North', 'East', 'South', or 'West' when drunk; or '' (empty string) when not drunk.

const int& cpp_client::saloon::Cowboy::focus

How much focus this Cowboy has. Different Jobs do different things with their Cowboy's focus.

const std::string& cpp_client::saloon::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::saloon::Cowboy::health

How much health this Cowboy currently has.

const std::string& cpp_client::saloon::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::saloon::Cowboy::is_dead

If this Cowboy is dead and has been removed from the game.

const bool& cpp_client::saloon::Cowboy::is_drunk

If this Cowboy is drunk, and will automatically walk.

const std::string& cpp_client::saloon::Cowboy::job

The job that this Cowboy does, and dictates how they fight and interact within the Saloon.

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

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

const Player& cpp_client::saloon::Cowboy::owner

The Player that owns and can control this Cowboy.

const Tile& cpp_client::saloon::Cowboy::tile

The Tile that this Cowboy is located on.

const int& cpp_client::saloon::Cowboy::tolerance

How many times this unit has been drunk before taking their siesta and resetting this to 0.

const int& cpp_client::saloon::Cowboy::turns_busy

How many turns this unit has remaining before it is no longer busy and can act() or play() again.


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