Stats
Functions
Section titled “Functions”addPlayerStat()
Section titled “addPlayerStat()”addPlayerStat(
player,cacheFlag,amount):void
Defined in: packages/isaacscript-common/src/functions/stats.ts:32
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
Section titled “Parameters”player
Section titled “player”EntityPlayer
cacheFlag
Section titled “cacheFlag”CacheFlagValue
amount
Section titled “amount”number
Returns
Section titled “Returns”void
getDefaultPlayerStat()
Section titled “getDefaultPlayerStat()”getDefaultPlayerStat(
cacheFlag):number|undefined
Defined in: packages/isaacscript-common/src/functions/stats.ts:92
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
Section titled “Parameters”cacheFlag
Section titled “cacheFlag”CacheFlagValue
Returns
Section titled “Returns”number | undefined
getPlayerStat()
Section titled “getPlayerStat()”getPlayerStat<
T>(player,playerStat):PlayerStats[T]
Defined in: packages/isaacscript-common/src/functions/stats.ts:97
Helper function to get the stat for a player corresponding to the StatType.
Type Parameters
Section titled “Type Parameters”T extends PlayerStat
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
playerStat
Section titled “playerStat”T
Returns
Section titled “Returns”PlayerStats[T]
getPlayerStats()
Section titled “getPlayerStats()”getPlayerStats(
player):PlayerStats
Defined in: packages/isaacscript-common/src/functions/stats.ts:106
Helper function to get all of the stat for a player.
Parameters
Section titled “Parameters”player
Section titled “player”EntityPlayer
