UNPKG

isaacscript-common

Version:

Helper functions and features for IsaacScript mods.

142 lines 7.08 kB
import { HealthType } from "../enums/HealthType"; import type { PlayerHealth } from "../interfaces/PlayerHealth"; export declare function addPlayerHealthType(player: EntityPlayer, healthType: HealthType, numHearts: int): void; /** * 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. */ export declare function canPickEternalHearts(player: EntityPlayer): boolean; /** * 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. */ export declare function doesPlayerHaveAllBlackHearts(player: EntityPlayer): boolean; /** * 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. */ export declare function doesPlayerHaveAllSoulHearts(player: EntityPlayer): boolean; /** * 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). */ export declare function getPlayerAvailableHeartSlots(player: EntityPlayer): int; /** * 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. */ export declare function getPlayerBlackHearts(player: EntityPlayer): int; /** * 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. */ export declare function getPlayerHealth(player: EntityPlayer): Readonly<PlayerHealth>; export declare function getPlayerHealthType(player: EntityPlayer, healthType: HealthType): int; /** * 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. */ export declare function getPlayerHearts(player: EntityPlayer): int; /** * 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. */ export declare function getPlayerLastHeart(player: EntityPlayer): HealthType; /** * 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. */ export declare function getPlayerMaxHeartContainers(player: EntityPlayer): int; /** * 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. */ export declare function getPlayerSoulHearts(player: EntityPlayer): int; /** * 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. */ export declare function getTaintedMagdaleneNonTemporaryMaxHearts(player: EntityPlayer): int; /** Returns a `PlayerHealth` object with all zeros. */ export declare function newPlayerHealth(): PlayerHealth; /** * Helper function to remove all of a player's black hearts and add the corresponding amount of soul * hearts. */ export declare function playerConvertBlackHeartsToSoulHearts(player: EntityPlayer): void; /** * Helper function to remove all of a player's soul hearts and add the corresponding amount of black * hearts. */ export declare function playerConvertSoulHeartsToBlackHearts(player: EntityPlayer): void; /** * 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. */ export declare function playerHasHealthLeft(player: EntityPlayer): boolean; export declare function removeAllPlayerHealth(player: EntityPlayer): void; /** * 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. */ export declare function setPlayerHealth(player: EntityPlayer, playerHealth: PlayerHealth): void; /** * 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. */ export declare function wouldDamageTaintedMagdaleneNonTemporaryHeartContainers(player: EntityPlayer, damageAmount: float): boolean; //# sourceMappingURL=playerHealth.d.ts.map