Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Cowboy

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

Hierarchy

Implements

  • IBaseGameObject

Index

Properties

canMove

canMove: boolean

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

drunkDirection

drunkDirection: "" | "North" | "East" | "South" | "West"

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

focus

focus: number

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

gameObjectName

gameObjectName: string

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.

health

health: number

How much health this Cowboy currently has.

id

id: string

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.

isDead

isDead: boolean

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

isDrunk

isDrunk: boolean

If this Cowboy is drunk, and will automatically walk.

job

job: "Bartender" | "Brawler" | "Sharpshooter"

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

logs

logs: string[]

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

owner

owner: Player

The Player that owns and can control this Cowboy.

tile

tile: Tile | undefined

The Tile that this Cowboy is located on.

tolerance

tolerance: number

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

turnsBusy

turnsBusy: number

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

Methods

act

  • act(tile: Tile, drunkDirection?: "" | "North" | "East" | "South" | "West"): Promise<boolean>
  • Does their job's action on a Tile.

    Parameters

    • tile: Tile

      The Tile you want this Cowboy to act on.

    • Default value drunkDirection: "" | "North" | "East" | "South" | "West" = ""

      The direction the bottle will cause drunk cowboys to be in, can be 'North', 'East', 'South', or 'West'.

    Returns Promise<boolean>

    True if the act worked, false otherwise.

log

  • log(message: string): Promise<void>
  • Adds a message to this GameObject's logs. Intended for your own debugging purposes, as strings stored here are saved in the gamelog.

    Parameters

    • message: string

      A string to add to this GameObject's log. Intended for debugging.

    Returns Promise<void>

move

  • move(tile: Tile): Promise<boolean>
  • Moves this Cowboy from its current Tile to an adjacent Tile.

    Parameters

    • tile: Tile

      The Tile you want to move this Cowboy to.

    Returns Promise<boolean>

    True if the move worked, false otherwise.

play

  • Sits down and plays a piano.

    Parameters

    • piano: Furnishing

      The Furnishing that is a piano you want to play.

    Returns Promise<boolean>

    True if the play worked, false otherwise.

toString

  • toString(): string
  • A toString override for easier debugging.

    example

    String(gameObject); 🠞 "GameObjectName #1245"

    Returns string

    A human readable representation of the game object.

Generated using TypeDoc