Global

Methods

broadcastMessage(type, data, debugMessage)

Broadcasts a message to a all websocket clients.
Parameters:
Name Type Description
type messageTypeEnum The type of the message.
data Object The data to send.
debugMessage String The debug message to send.
Source:

damageCharacter(character, damage, poison)

Adds damage to a character in respect to their properties. (Decreases hp)
Parameters:
Name Type Description
character Character The character to damage.
damage Integer The amaount of damage.
poison Boolean If cause of damage is a poisoned cocktail.
Source:

doOperation(player, operation) → {Boolean}

Perfoms actions which a character can do with certain properties.
Parameters:
Name Type Description
player Player The player.
operation Operation The operation.
Source:
Returns:
If operation was valid.
Type
Boolean

endGame()

Ends the game.
Source:

getChance(character, chance) → {Boolean}

Returns true or false for a character with a specific chance in respect to their properties.
Parameters:
Name Type Description
character Character The character.
chance Double The chance.
Source:
Returns:
Random boolean.
Type
Boolean

getCharacterByPosition(coordinates) → {Character}

Returns a character (if on field) by position.
Parameters:
Name Type Description
coordinates Point The position.
Source:
Returns:
The character. (null if no character on that position)
Type
Character

getDistance(pos1, pos2) → {Integer}

Returns the distance of to points.
Parameters:
Name Type Description
pos1 Point The first point.
pos2 Point The second point.
Source:
Returns:
The distance of those two points.
Type
Integer

getGadget(character, gadget) → {Gadget}

Returns specific gadget of a character.
Parameters:
Name Type Description
character Character The character.
gadget gadgetEnum The gadget type.
Source:
Returns:
The gadget if. (Can be null if not found).
Type
Gadget

getGameState(ws) → {Object}

Returns the current game state in respect to a specific client.
Parameters:
Name Type Description
ws Websocket The websocket client.
Source:
Returns:
The game state.
Type
Object

getNearestCharacter(coordinates, maxDist) → {Character}

Returns the nearest character to a specific point.
Parameters:
Name Type Description
coordinates Point The point.
maxDist Integer The maximum distance.
Source:
Returns:
The nearest character.
Type
Character

getNeighbors(coordinates, rangeopt) → {Array.<Point>}

Returns all neighbors for a specific point.
Parameters:
Name Type Attributes Default Description
coordinates Point The position.
range Integer <optional>
1 The range of neighborhood.
Source:
Returns:
Array of neighbors.
Type
Array.<Point>

getRandomCharacter() → {Character}

Returns a random character on the map.
Source:
Returns:
Random character.
Type
Character

getRandomFreeNeighbor(coordinates, rangeopt) → {Point}

Returns a random free neighbor for a specific point.
Parameters:
Name Type Attributes Default Description
coordinates Point The position.
range Integer <optional>
1 The range of neighborhood.
Source:
Returns:
Random free neighbor.
Type
Point

getRandomNeighborCharacter(coordinates, rangeopt, sightopt) → {Character}

Returns a random neighbor character for a specific point.
Parameters:
Name Type Attributes Default Description
coordinates Point The position.
range Integer <optional>
1 The range of neighborhood.
sight Boolean <optional>
false If character has to be in sight (important for range > 1).
Source:
Returns:
Random neighbor character.
Type
Character

giveCharIP(character, ip)

Adds intelligence points to a character.
Parameters:
Name Type Description
character Character The character to damage.
ip Integer The amaount of intelligence points.
Source:

isCoordinatesValid(coordinates) → {Boolean}

If point is on the map.
Parameters:
Name Type Description
coordinates Point The coordinates.
Source:
Returns:
If is on map.
Type
Boolean

isInSight(position, target, chars) → {Boolean}

Return if two points are in sight.
Parameters:
Name Type Description
position Point The position.
target Point The target position.
chars Boolean If character block the sight.
Source:
Returns:
If in sight.
Type
Boolean

isNeighbor(position, target, rangeopt) → {Boolean}

Returns if one point is a neighbor of the other.
Parameters:
Name Type Attributes Default Description
position Point The position.
target Point The target position.
range Integer <optional>
1 The range of neighborhood.
Source:
Returns:
If they are neighbors.
Type
Boolean

nextTurn()

Starts the next turn or next round if all characters had their turn.
Source:

pauseGame()

Pauses the game.
Source:

prepareTurn(characterId)

Prepares a characters turn and sets their mps and aps in respect to their properties.
Parameters:
Name Type Description
characterId String The id of the character.
Source:

removeGadget(character, type)

Removes a specific gadget from a character.
Parameters:
Name Type Description
character Character The character to damage.
type gadgetEnum The gadget type.
Source:

removeProperty(character, type)

Removes a specific property from a character.
Parameters:
Name Type Description
character Character The character to damage.
type propertyEnum The property type.
Source:

resumeGame()

Resumes the game.
Source:

sendGameStatusMessage()

Broadcasts the current game state.
Source:

sendMessage(ws, type, data, debugMessage)

Sends a message to a websocket client.
Parameters:
Name Type Description
ws Websocket The receiving websocket client.
type messageTypeEnum The type of the message.
data Object The data to send.
debugMessage String The debug message to send.
Source:

setCharacterOrder()

Sets the order of all characters.
Source:

setGameCharacters(player, freeFields)

Initiates the characters of a player.
Parameters:
Name Type Description
player Player The player.
freeFields Array.<Field> The remaining free fields on the map.
Source:

startGame()

Sarts the game.
Source:

startRound()

Starts a new round
Source:

startTurn(characterId)

Starts a new turn for a specific character.
Parameters:
Name Type Description
characterId String The id of the character.
Source: