Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Game

Steal from merchants and become the most infamous pirate.

Hierarchy

  • BaseGame
    • Game

Implements

  • IBaseGame

Index

Properties

buryInterestRate

buryInterestRate: number

The rate buried gold increases each turn.

crewCost

crewCost: number

How much gold it costs to construct a single crew.

crewDamage

crewDamage: number

How much damage crew deal to each other.

crewHealth

crewHealth: number

The maximum amount of health a crew member can have.

crewMoves

crewMoves: number

The number of moves Units with only crew are given each turn.

crewRange

crewRange: number

A crew's attack range. Range is circular.

currentPlayer

currentPlayer: Player

The player whose turn it is currently. That player can send commands. Other players cannot.

currentTurn

currentTurn: number

The current turn number, starting at 0 for the first player's turn.

gameObjects

gameObjects: object

A mapping of every game object's ID to the actual game object. Primarily used by the server and client to easily refer to the game objects via ID.

Type declaration

healFactor

healFactor: number

How much health a Unit recovers when they rest.

mapHeight

mapHeight: number

The number of Tiles in the map along the y (vertical) axis.

mapWidth

mapWidth: number

The number of Tiles in the map along the x (horizontal) axis.

maxTurns

maxTurns: number

The maximum number of turns before the game will automatically end.

merchantGoldRate

merchantGoldRate: number

How much gold merchant Ports get each turn.

merchantInterestRate

merchantInterestRate: number

When a merchant ship spawns, the amount of additional gold it has relative to the Port's investment.

minInterestDistance

minInterestDistance: number

The Euclidean distance buried gold must be from the Player's Port to accumulate interest.

players

players: Player[]

List of all the players in the game.

ports

ports: Port[]

Every Port in the game. Merchant ports have owner set to null.

restRange

restRange: number

How far a Unit can be from a Port to rest. Range is circular.

session

session: string

A unique identifier for the game instance that is being played.

shipCost

shipCost: number

How much gold it costs to construct a ship.

shipDamage

shipDamage: number

How much damage ships deal to ships and ports.

shipHealth

shipHealth: number

The maximum amount of health a ship can have.

shipMoves

shipMoves: number

The number of moves Units with ships are given each turn.

shipRange

shipRange: number

A ship's attack range. Range is circular.

tiles

tiles: Tile[]

All the tiles in the map, stored in Row-major order. Use x + y * mapWidth to access the correct index.

timeAddedPerTurn

timeAddedPerTurn: number

The amount of time (in nano-seconds) added after each player performs a turn.

units

units: Unit[]

Every Unit in the game. Merchant units have targetPort set to a port.

Methods

getTileAt

  • getTileAt(x: number, y: number): Tile | undefined
  • Gets the Tile at a specified (x, y) position

    Parameters

    • x: number

      an integer between 0 and the mapWidth

    • y: number

      an integer between 0 and the mapHeight

    Returns Tile | undefined

    the Tile at (x, y) or null if out of bounds

Generated using TypeDoc