isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
31 lines • 1.57 kB
TypeScript
import { CacheFlag } from "isaac-typescript-definitions";
import { PlayerStat } from "../enums/PlayerStat";
import type { PlayerStats } from "../interfaces/PlayerStats";
/**
* 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)
*/
export declare function addPlayerStat(player: EntityPlayer, cacheFlag: CacheFlag, amount: number): void;
/**
* 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.
*/
export declare function getDefaultPlayerStat(cacheFlag: CacheFlag): number | undefined;
/** Helper function to get the stat for a player corresponding to the `StatType`. */
export declare function getPlayerStat<T extends PlayerStat>(player: EntityPlayer, playerStat: T): PlayerStats[T];
/** Helper function to get all of the stat for a player. */
export declare function getPlayerStats(player: EntityPlayer): PlayerStats;
//# sourceMappingURL=stats.d.ts.map