Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Unit

A unit in the game. May be a manager, intern, or physicist.

Hierarchy

Implements

  • IBaseGameObject

Index

Properties

acted

acted: boolean

Whether or not this Unit has performed its action this turn.

blueium

blueium: number

The amount of blueium carried by this unit. (0 to job carry capacity - other carried items).

blueiumOre

blueiumOre: number

The amount of blueium ore carried by this unit. (0 to job carry capacity

  • other carried items).

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

The remaining health of a unit.

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.

job

job: Job

The Job this Unit has.

logs

logs: string[]

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

moves

moves: number

The number of moves this unit has left this turn.

owner

owner: Player | undefined

The Player that owns and can control this Unit.

redium

redium: number

The amount of redium carried by this unit. (0 to job carry capacity - other carried items).

rediumOre

rediumOre: number

The amount of redium ore carried by this unit. (0 to job carry capacity - other carried items).

stunImmune

stunImmune: number

Duration of stun immunity. (0 to timeImmune).

stunTime

stunTime: number

Duration the unit is stunned. (0 to the game constant stunTime).

tile

tile: Tile | undefined

The Tile this Unit is on.

Methods

act

  • act(tile: Tile): Promise<boolean>
  • Makes the unit do something to a machine or unit adjacent to its tile. Interns sabotage, physicists work. Interns stun physicist, physicist stuns manager, manager stuns intern.

    Parameters

    • tile: Tile

      The tile the unit acts on.

    Returns Promise<boolean>

    True if successfully acted, false otherwise.

attack

  • attack(tile: Tile): Promise<boolean>
  • Attacks a unit on an adjacent tile.

    Parameters

    • tile: Tile

      The Tile to attack.

    Returns Promise<boolean>

    True if successfully attacked, false otherwise.

drop

  • drop(tile: Tile, amount: number, material: "redium ore" | "redium" | "blueium" | "blueium ore"): Promise<boolean>
  • Drops materials at the units feet or adjacent tile.

    Parameters

    • tile: Tile

      The tile the materials will be dropped on.

    • amount: number

      The number of materials to dropped. Amounts <= 0 will drop all the materials.

    • material: "redium ore" | "redium" | "blueium" | "blueium ore"

      The material the unit will drop. 'redium', 'blueium', 'redium ore', or 'blueium ore'.

    Returns Promise<boolean>

    True if successfully deposited, 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 Unit from its current Tile to an adjacent Tile.

    Parameters

    • tile: Tile

      The Tile this Unit should move to.

    Returns Promise<boolean>

    True if it moved, false otherwise.

pickup

  • pickup(tile: Tile, amount: number, material: "redium ore" | "redium" | "blueium" | "blueium ore"): Promise<boolean>
  • Picks up material at the units feet or adjacent tile.

    Parameters

    • tile: Tile

      The tile the materials will be picked up from.

    • amount: number

      The amount of materials to pick up. Amounts <= 0 will pick up all the materials that the unit can.

    • material: "redium ore" | "redium" | "blueium" | "blueium ore"

      The material the unit will pick up. 'redium', 'blueium', 'redium ore', or 'blueium ore'.

    Returns Promise<boolean>

    True if successfully deposited, 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