Home Reference Source
import Character from 'jumbogrove/src/jg/character.js'
public class | source

Character

This class is created from the character object you specify in your game.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

The ID you specified for this character.

public

The name you specified for this character.

public

state: *

Arbitrary, JSON-safe data about this character.

Private Members
private

Method Summary

Public Methods
public

Add an integer value to the given quality.

public

Returns the formatted value of the given quality.

public

Return the human-readable name for the given quality ID.

public

getQuality(id: string): *

Return the current value of this quality (without formatting it)

public

Return the initial value of this quality from the start of the game(without formatting it).

public

setQuality(id: string, value: *)

Qualities must be modified using this method.

Public Constructors

public constructor(args: object) source

Params:

NameTypeAttributeDescription
args object
args.id string
args.name string
args.priority number
args.showInSidebar Boolean
args.description string | function(): string

Currently unused

args.qualities quality[]
args.state *

Initial value of state

Public Members

public id: string source

The ID you specified for this character. Must be unique across all characters.

public name: string source

The name you specified for this character.

public state: * source

Arbitrary, JSON-safe data about this character. You may update it any time you want.

Private Members

private _shallowQualities: {} source

Public Methods

public addToQuality(id: string, delta: number): number source

Add an integer value to the given quality.

Params:

NameTypeAttributeDescription
id string

ID of the quality to modify on this character

delta number

Amount to add

Return:

number

The new value

public formatQuality(id: string): string source

Returns the formatted value of the given quality.

Params:

NameTypeAttributeDescription
id string

ID of the quality whose value you want

Return:

string

public formatQualityName(id: string): string source

Return the human-readable name for the given quality ID.

Params:

NameTypeAttributeDescription
id string

ID of the quality whose value you want

Return:

string

public getQuality(id: string): * source

Return the current value of this quality (without formatting it)

Params:

NameTypeAttributeDescription
id string

ID of the quality whose value you want

Return:

*

public getQualityInitial(id: string): * source

Return the initial value of this quality from the start of the game(without formatting it). You can use this to see how the value has changed since the start of the game.

Params:

NameTypeAttributeDescription
id string

ID of the quality whose value you want

Return:

*

public setQuality(id: string, value: *) source

Qualities must be modified using this method.

Params:

NameTypeAttributeDescription
id string

ID of the quality to modify on this character

value *

New value for the quality