isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
69 lines • 3.31 kB
TypeScript
import { TrinketType } from "isaac-typescript-definitions";
export declare function addTrinketCostume(player: EntityPlayer, trinketType: TrinketType): void;
/**
* Helper function to check to see if any player has a particular trinket.
*
* @param trinketType The trinket type to check for.
* @param ignoreModifiers If set to true, only counts trinkets the player actually holds and ignores
* effects granted by other items. Default is false.
*/
export declare function anyPlayerHasTrinket(trinketType: TrinketType, ignoreModifiers?: boolean): boolean;
/**
* Returns the slot number corresponding to where a trinket can be safely inserted.
*
* For example:
*
* ```ts
* const player = Isaac.GetPlayer();
* const trinketSlot = getOpenTrinketSlotNum(player);
* if (trinketSlot !== undefined) {
* // They have one or more open trinket slots
* player.AddTrinket(TrinketType.SWALLOWED_PENNY);
* }
* ```
*/
export declare function getOpenTrinketSlot(player: EntityPlayer): int | undefined;
/**
* Helper function to get all of the trinkets that the player is currently holding. This will not
* include any smelted trinkets.
*/
export declare function getPlayerTrinkets(player: EntityPlayer): readonly TrinketType[];
/**
* Helper function to get only the players that have a certain trinket.
*
* This function is variadic, meaning that you can supply as many trinket types as you want to check
* for. It only returns the players that have all of the trinkets.
*/
export declare function getPlayersWithTrinket(...trinketTypes: readonly TrinketType[]): readonly EntityPlayer[];
/** Helper function to check to see if the player is holding one or more trinkets. */
export declare function hasAnyTrinket(player: EntityPlayer): boolean;
/**
* Returns whether the player can hold an additional trinket, beyond what they are currently
* carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
*
* If the player is the Tainted Soul, this always returns false, since that character cannot pick up
* items. (Only Tainted Forgotten can pick up items.)
*/
export declare function hasOpenTrinketSlot(player: EntityPlayer): boolean;
/**
* Helper function to check to see if a player has one or more trinkets.
*
* This function is variadic, meaning that you can supply as many trinket types as you want to check
* for. Returns true if the player has any of the supplied trinket types.
*
* This function always passes `false` to the `ignoreModifiers` argument.
*/
export declare function hasTrinket(player: EntityPlayer, ...trinketTypes: readonly TrinketType[]): boolean;
/**
* Helper function to remove all of the held trinkets from a player.
*
* This will not remove any smelted trinkets, unless the player happens to also be holding a trinket
* that they have smelted. (In that case, both the held and the smelted trinket will be removed.)
*/
export declare function removeAllPlayerTrinkets(player: EntityPlayer): void;
/**
* Helper function to remove a trinket costume from a player. Use this helper function to avoid
* having to request the trinket from the item config.
*/
export declare function removeTrinketCostume(player: EntityPlayer, trinketType: TrinketType): void;
//# sourceMappingURL=playerTrinkets.d.ts.map