GameEvent

GameEvent

A cancellable game event passed to piece callbacks. Carries a reference to the current player and board so callbacks can read game state and fire messages without needing to import Game.

Constructor

new GameEvent(player)

Source:
Parameters:
Name Type Description
player Player

@param {Board} board

Classes

GameEvent

Members

isCancelled

Description:
  • True if the event has been cancelled.

Source:

True if the event has been cancelled.

kills

Source:

Methods

cancel()

Description:
  • Cancel this event (prevents the default action).

Source:

cancelWithMessage(cellOrMessage, messageopt)

Description:
  • Cancel and queue a message to display to the player.

Source:
Parameters:
Name Type Attributes Description
cellOrMessage string | Cell
message string <optional>

kill(cell, agent)

Description:
  • Record that an agent has been killed (changeHealth returned 0). Callers are responsible for removing the agent from the board after processing all callbacks.

Source:
Parameters:
Name Type Description
cell Cell
agent object

suppressCancel()

Description:
  • Allow a cancelled event to proceed (used by Game controller).

Source: