Skip to content

Player Health

addPlayerHealthType(player, healthType, numHearts): void

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:18

EntityPlayer

HealthType

int

void


canPickEternalHearts(player): boolean

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:78

Helper function to see if the provided player can pick up an eternal heart. (If a player already has an eternal heart and full heart containers, they are not able to pick up any additional eternal hearts.)

This function’s name matches the existing EntityPlayer methods.

EntityPlayer

boolean


doesPlayerHaveAllBlackHearts(player): boolean

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:99

Returns whether all of the player’s soul-heart-type hearts are black hearts.

Note that this function does not consider red heart containers.

For example:

  • If the player has one black heart, this function would return true.
  • If the player has one soul heart and two black hearts, this function would return false.
  • If the player has no black hearts, this function will return false.
  • If the player has one red heart container and three black hearts, this function would return true.

EntityPlayer

boolean


doesPlayerHaveAllSoulHearts(player): boolean

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:118

Returns whether all of the player’s soul-heart-type hearts are soul hearts.

Note that this function does not consider red heart containers.

For example:

  • If the player has two soul hearts and one black heart, this function would return false.
  • If the player has no soul hearts, this function will return false.
  • If the player has one red heart container and three soul hearts, this function would return true.

EntityPlayer

boolean


getPlayerAvailableHeartSlots(player): int

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:130

Returns the number of slots that the player has remaining for new heart containers, accounting for broken hearts. For example, if the player is Judas and has 1 red heart containers and 2 full soul hearts and 3 broken hearts, then this function would return 6 (i.e. 12 - 1 - 2 - 3).

EntityPlayer

int


getPlayerBlackHearts(player): int

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:151

Returns the number of black hearts that the player has, excluding any soul hearts. For example, if the player has one full black heart, one full soul heart, and one half black heart, this function returns 3.

This is different from the EntityPlayer.GetBlackHearts method, since that returns a bitmask.

EntityPlayer

int


getPlayerHealth(player): Readonly<PlayerHealth>

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:165

Helper function to get an object representing the player’s health. You can use this in combination with the setPlayerHealth function to restore the player’s health back to a certain configuration at a later time.

This is based on the REVEL.StoreHealth function in the Revelations mod.

EntityPlayer

Readonly<PlayerHealth>


getPlayerHealthType(player, healthType): int

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:242

EntityPlayer

HealthType

int


getPlayerHearts(player): int

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:306

Returns the number of red hearts that the player has, excluding any rotten hearts. For example, if the player has one full black heart, one full soul heart, and one half black heart, this function returns 3.

This is different from the EntityPlayer.GetHearts method, since that returns a value that includes rotten hearts.

EntityPlayer

int


getPlayerLastHeart(player): HealthType

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:317

Helper function that returns the type of the rightmost heart. This does not including golden hearts or broken hearts, since they cannot be damaged directly.

EntityPlayer

HealthType


getPlayerMaxHeartContainers(player): int

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:377

Returns the maximum heart containers that the provided player can have. Normally, this is 12, but it can change depending on the character (e.g. Keeper) and other things (e.g. Mother’s Kiss). This function does not account for Broken Hearts; use the getPlayerAvailableHeartSlots helper function for that.

EntityPlayer

int


getPlayerSoulHearts(player): int

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:424

Returns the number of soul hearts that the player has, excluding any black hearts. For example, if the player has one full black heart, one full soul heart, and one half black heart, this function returns 2.

This is different from the EntityPlayer.GetSoulHearts method, since that returns the combined number of soul hearts and black hearts.

EntityPlayer

int


getTaintedMagdaleneNonTemporaryMaxHearts()

Section titled “getTaintedMagdaleneNonTemporaryMaxHearts()”

getTaintedMagdaleneNonTemporaryMaxHearts(player): int

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:441

Helper function to determine how many heart containers that Tainted Magdalene has that will not be automatically depleted over time. By default, this is 2, but this function will return 4 so that it is consistent with the player.GetHearts and player.GetMaxHearts methods.

If Tainted Magdalene has Birthright, she will gained an additional non-temporary heart container.

This function does not validate whether the provided player is Tainted Magdalene; that should be accomplished before invoking this function.

EntityPlayer

int


newPlayerHealth(): PlayerHealth

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:452

Returns a PlayerHealth object with all zeros.

PlayerHealth


playerConvertBlackHeartsToSoulHearts(player): void

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:472

Helper function to remove all of a player’s black hearts and add the corresponding amount of soul hearts.

EntityPlayer

void


playerConvertSoulHeartsToBlackHearts(player): void

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:494

Helper function to remove all of a player’s soul hearts and add the corresponding amount of black hearts.

EntityPlayer

void


playerHasHealthLeft(player): boolean

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:518

Helper function to see if the player is out of health.

Specifically, this function will return false if the player has 0 red hearts, 0 soul/black hearts, and 0 bone hearts.

EntityPlayer

boolean


removeAllPlayerHealth(player): void

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:526

EntityPlayer

void


setPlayerHealth(player, playerHealth): void

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:559

Helper function to set a player’s health to a specific state. You can use this in combination with the getPlayerHealth function to restore the player’s health back to a certain configuration at a later time.

Based on the REVEL.LoadHealth function in the Revelations mod.

EntityPlayer

PlayerHealth

void


wouldDamageTaintedMagdaleneNonTemporaryHeartContainers()

Section titled “wouldDamageTaintedMagdaleneNonTemporaryHeartContainers()”

wouldDamageTaintedMagdaleneNonTemporaryHeartContainers(player, damageAmount): boolean

Defined in: packages/isaacscript-common/src/functions/playerHealth.ts:697

Helper function to see if a certain damage amount would deal “permanent” damage to Tainted Magdalene.

Tainted Magdalene has “permanent” health and “temporary” health. When standing still and doing nothing, all of Tainted Magdalene’s temporary health will eventually go away.

Before using this function, it is expected that you check to see if the player is Tainted Magdalene first, or else it will give a nonsensical result.

EntityPlayer

float

boolean