Class: Player

Player(area, targets, opponentPlayerName, name)

Player

Constructor

new Player(area, targets, opponentPlayerName, name)

Parameters:
Name Type Description
area Object This repreents the battle area of the player
targets Array Array of all the predefined targets
opponentPlayerName string Name of the opponent
name string player's name
Source:

Methods

getNextTarget(targetIndex) → {string}

Function to get next target of the player
Parameters:
Name Type Description
targetIndex Number : index of the desired target
Source:
Returns:
target at the index
Type
string

isDefeated() → {Boolean}

Function to check if the player is deafted or not
Source:
Returns:
returns true if area is destroyed else false
Type
Boolean

takeHit(coordinates) → {boolean}

Function to take a hit on this player
Parameters:
Name Type Description
coordinates string : hit target
Source:
Returns:
returns true if hit else false
Type
boolean