Class: NPC

Pets~ NPC


new NPC(base, pets)

Create an NPC based off the opponent data, or at the given level.
Parameters:
Name Type Description
base number | Pets~Pet Amount of XP to give this npc, or a pet to base the data off of.
pets Pets~BasePets Information of available pets. // @param {Pets~BaseMoves} moves Information of base moves.
Source:

Extends

Members


<private> _lastInteractTime :number

The timestamp at which this object was last interacted with. This is used for purging from memory when not used for a while.
Type:
  • number
Inherited From:
Overrides:
Default Value:
  • Date.now()
Source:

attackMod :number

Attack modifier on top of base species stat.
Type:
  • number
Inherited From:
Overrides:
Source:

defenseMod :number

Defense modifier on top of base species stat.
Type:
  • number
Inherited From:
Overrides:
Source:

healthMod :number

Health modifier on top of base species stat.
Type:
  • number
Inherited From:
Overrides:
Source:

id :string

The ID of this pet. Does not check for uniqueness, but expects the ID to be unique per-user.
Type:
  • string
Inherited From:
Overrides:
Source:

lives :number

Current number of lives remaining.
Type:
  • number
Inherited From:
Overrides:
Default Value:
  • 3
Source:

name :string

The name of this pet.
Type:
  • string
Inherited From:
Overrides:
Source:

numPoints

Get the number of remaining points available to spend on modifiers.
Inherited From:
Overrides:
Source:

owner :string

ID of the owner of this pet.
Type:
  • string
Inherited From:
Overrides:
Source:

<nullable> petClass :string

The character class for this pet.
Type:
  • string
Inherited From:
Overrides:
Source:

restStartTimestamp :number

Timestamp at most recent time the pet has begun resting. Used for regenerating lives.
Type:
  • number
Inherited From:
Overrides:
Source:

serializable

Get a serializable version of this class instance. Strips all private variables, and all functions. Assumes all public variables are serializable if they aren't a function.
Inherited From:
Overrides:
Source:

species :string

The species ID of this pet.
Type:
  • string
Inherited From:
Overrides:
Source:

speedMod :number

Speed modifier on top of base species stat.
Type:
  • number
Inherited From:
Overrides:
Source:

xp :number

The number of experience points this pet has.
Type:
  • number
Inherited From:
Overrides:
Source:

Methods


addXP(xp [, auto])

Add XP to the pet, and trigger any level-up actions that may need to occur.
Parameters:
Name Type Argument Default Description
xp number Amount of XP to add.
auto boolean <optional>
false Auto level up after adding XP.
Inherited From:
Overrides:
Source:

autoLevelUp()

Automatically spend all remaining modifier points automatically until all are used up.
Inherited From:
Overrides:
Source:

lostBattle()

Signal this pet just lost a battle, and update accordingly.
Inherited From:
Overrides:
Source:

spendPoint(category [, num])

Spend points on a given modifier.
Parameters:
Name Type Argument Default Description
category string The name of the modifier to spend the points on.
num number <optional>
1 The number of points to spend.
Inherited From:
Overrides:
Source:

touch()

Touch this object to update the last `_lastInteractTime`.
Inherited From:
Overrides:
Source:

wonBattle()

Signal this pet just won a battle, and update accordingly.
Inherited From:
Overrides:
Source: