Class: GamePlayer

GamePlayer

A character in the team/hidden/reserve

new GamePlayer (kind, id, instanceID, skills, json)

Name Type Description
kind CharacterKind The kind of the character (hero or monster)
id number The ID of the character
instanceID number The instance id of the character
skills Array.<GameSkill> List of all the learned skills
json object optional Json object describing the items
Properties:
Name Type Description
k CharacterKind The kind of the character (hero or monster)
id number The ID of the character
instid number The instance id of the character
character SystemHero The system character
name string The character name
sk Array.<GameSkill> List of all the learned skills
equip Array.<GameItem> List of the equiped weapons/armors
expList Array.<number> The exp list for each level
levelingUp boolean Indicate if leveling up
testedLevelUp boolean Indicate if the level up was tested

Methods

GamePlayer.getEquipmentLength ()number static

Get the max size of equipment kind names
Returns:
Type Description
number

GamePlayer.getTemporaryPlayer (values)GamePlayer static

Get the max size of equipment kind names
Name Type Description
values Array.<number> The values
Returns:
Type Description
GamePlayer

getSaveCharacter ()Object

Get a compressed object for saving the character in a file
Returns:
Type Description
Object

getSaveStat ()Array.<number>

Get the statistics for save character
Returns:
Type Description
Array.<number>

getSaveEquip ()Array.<Array.<number>>

Get the equips for save character
Returns:
Type Description
Array.<Array.<number>>

isDead ()boolean

Check if the character is dead
Returns:
Type Description
boolean

instanciate (level)

Instanciate a character in a particular level
Name Type Description
level number The level of the new character

getEquipmentStatsAndBonus (item, equipmentID)Array.<Array.<number>>

Get the stats thanks to equipments
Name Type Description
item SystemItem The system item
equipmentID number The equipment ID
Returns:
Type Description
Array.<Array.<number>>

updateEquipmentStats (list, bonus)Array.<Array.<number>>

Update stats with equipment stats
Name Type Description
list Array.<number> The stats list
bonus Array.<number> The bonus list
Returns:
Type Description
Array.<Array.<number>>

initStatValue (statistic, bonus)

Initialize stat value
Name Type Description
statistic SystemStatistic The statistic
bonus number The value

updateStatValue (statistic, bonus)

Update stats value
Name Type Description
statistic SystemStatistic The statistic
bonus number The value

updateAllStatsValues ()

Update all the stats values

getBarAbbreviation (stat)

Get the bar abbreviation
Name Type Description
stat SystemStatistic The statistic

read (json)

Read the JSON associated to the character and items
Name Type Description
json object Json object describing the items

getCharacterInformations ()SystemHero

Get the character informations system
Returns:
Type Description
SystemHero

getCurrentLevel ()number

Get the current level
Returns:
Type Description
number

levelUp ()

Apply level up

getRewardExperience ()number

Get the experience reward
Returns:
Type Description
number

getRewardCurrencies ()Object

Get the currencies reward
Returns:
Type Description
Object

getRewardLoots ()Array.<Object>

Get the loots reward
Returns:
Type Description
Array.<Object>

updateRemainingXP (fullTime)

Update remaining xp according to full time
Name Type Description
fullTime number Full time in milliseconds

updateObtainedExperience ()

Update obtained experience

updateExperience ()boolean

Update experience and check if leveling up
Returns:
Type Description
boolean

passExperience ()

Pass the progressive experience and directly update experience

pauseExperience ()

Pause experience (when leveling up)

unpauseExperience ()

Unpause experience

isExperienceUpdated ()boolean

Check if experience is updated
Returns:
Type Description
boolean