Skip to main content

Stats

Functions

addPlayerStat

addPlayerStat(player, cacheFlag, amount): void

Helper function to add a stat to a player based on the CacheFlag provided. Call this function from the EVALUATE_CACHE callback.

Note that for CacheFlag.FIRE_DELAY, the "amount" argument will be interpreted as the tear stat to add (and not the amount to mutate EntityPlayer.MaxFireDelay by).

This function supports the following cache flags:

  • CacheFlag.DAMAGE (1 << 0)
  • CacheFlag.FIRE_DELAY (1 << 1)
  • CacheFlag.SHOT_SPEED (1 << 2)
  • CacheFlag.RANGE (1 << 3)
  • CacheFlag.SPEED (1 << 4)
  • CacheFlag.LUCK (1 << 10)

Parameters

NameType
playerEntityPlayer
cacheFlagCacheFlagValue
amountnumber

Returns

void

Defined in

packages/isaacscript-common/src/functions/stats.ts:32


getDefaultPlayerStat

getDefaultPlayerStat(cacheFlag): number | undefined

Returns the starting stat that Isaac (the default character) starts with. For example, if you pass this function CacheFlag.DAMAGE, it will return 3.5.

Note that the default fire delay is represented in the tear stat, not the MaxFireDelay value.

Parameters

NameType
cacheFlagCacheFlagValue

Returns

number | undefined

Defined in

packages/isaacscript-common/src/functions/stats.ts:92


getPlayerStat

getPlayerStat<T>(player, playerStat): PlayerStats[T]

Helper function to get the stat for a player corresponding to the StatType.

Type parameters

NameType
Textends PlayerStat

Parameters

NameType
playerEntityPlayer
playerStatT

Returns

PlayerStats[T]

Defined in

packages/isaacscript-common/src/functions/stats.ts:97


getPlayerStats

getPlayerStats(player): PlayerStats

Helper function to get all of the stat for a player.

Parameters

NameType
playerEntityPlayer

Returns

PlayerStats

Defined in

packages/isaacscript-common/src/functions/stats.ts:106