Class: Cowboy

Saloon. Cowboy

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

new Saloon.Cowboy()

Initializes a Cowboy with basic logic as provided by the Creer code generator. Never use this directly. It is for internal Joueur use.

Extends

Members

boolean canMove

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

string drunkDirection

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

number focus

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

string gameObjectName

Inherited From:
Saloon.GameObject#gameObjectName
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.

number health

How much health this Cowboy currently has.

string id

Inherited From:
Saloon.GameObject#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.

boolean isDead

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

boolean isDrunk

If this Cowboy is drunk, and will automatically walk.

string job

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

Array.<string> logs

Inherited From:
Saloon.GameObject#logs
Any strings logged will be stored here. Intended for debugging.
The Player that owns and can control this Cowboy.
The Tile that this Cowboy is located on.

number tolerance

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

number turnsBusy

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

Methods

boolean act(tile, drunkDirection)

Does their job's action on a Tile.
Name Type Description
tile Saloon.Tile The Tile you want this Cowboy to act on.
drunkDirection string optional The direction the bottle will cause drunk cowboys to be in, can be 'North', 'East', 'South', or 'West'.
Returns: boolean
True if the act worked, false otherwise.

log(message)

Inherited From:
Saloon.GameObject#log
Adds a message to this GameObject's logs. Intended for your own debugging purposes, as strings stored here are saved in the gamelog.
Name Type Description
message string A string to add to this GameObject's log. Intended for debugging.

boolean move(tile)

Moves this Cowboy from its current Tile to an adjacent Tile.
Name Type Description
tile Saloon.Tile The Tile you want to move this Cowboy to.
Returns: boolean
True if the move worked, false otherwise.

boolean play(piano)

Sits down and plays a piano.
Name Type Description
piano Saloon.Furnishing The Furnishing that is a piano you want to play.
Returns: boolean
True if the play worked, false otherwise.

string toString()

Inherited From:
BaseGameObject#toString
toString override for easier debugging
Returns: string
readable string in the format `GameObjectName #id`