Class: Game

Pirates. Game

Steal from merchants and become the most infamous pirate.

new Pirates.Game()

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

Extends

  • BaseGame

Members

number buryInterestRate

The rate buried gold increases each turn.

number crewCost

How much gold it costs to construct a single crew.

number crewDamage

How much damage crew deal to each other.

number crewHealth

The maximum amount of health a crew member can have.

number crewMoves

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

number crewRange

A crew's attack range. Range is circular.

Pirates.Player currentPlayer

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

number currentTurn

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

Object.<string, Pirates.GameObject> gameObjects

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.

number healFactor

How much health a Unit recovers when they rest.

number mapHeight

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

number mapWidth

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

number maxTurns

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

number merchantGoldRate

How much gold merchant Ports get each turn.

number merchantInterestRate

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

number minInterestDistance

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

string name

The name of the game.

Array.<Pirates.Player> players

List of all the players in the game.

Array.<Pirates.Port> ports

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

number restRange

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

string session

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

number shipCost

How much gold it costs to construct a ship.

number shipDamage

How much damage ships deal to ships and ports.

number shipHealth

The maximum amount of health a ship can have.

number shipMoves

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

number shipRange

A ship's attack range. Range is circular.

Array.<Pirates.Tile> tiles

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

number timeAddedPerTurn

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

Array.<Pirates.Unit> units

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

Methods

Tile | null getTileAt(x, y)

Gets the Tile at a specified (x, y) position
Name Type Description
x number integer between 0 and the mapWidth
y number integer between 0 and the mapHeight
Returns: Tile | null
the Tile at (x, y) or null if out of bounds