Skip to main content

Trinket Give

Functions

giveTrinketsBack

giveTrinketsBack(player, trinketSituation): void

Helper function to restore the player's trinkets back to the way they were before the temporarilyRemoveTrinket function was used. It will re-smelt any smelted trinkets that were removed.

Parameters

NameType
playerEntityPlayer
trinketSituationundefined | TrinketSituation

Returns

void

Defined in

packages/isaacscript-common/src/functions/trinketGive.ts:16


smeltTrinket

smeltTrinket(player, trinketType, numTrinkets?): void

Helper function to smelt a trinket. Before smelting, this function will automatically remove the trinkets that the player is holding, if any, and then give them back after the new trinket is smelted.

Parameters

NameTypeDefault valueDescription
playerEntityPlayerundefinedThe player to smelt the trinkets to.
trinketTypeTrinketTypeundefinedThe trinket type to smelt.
numTrinketsnumber1Optional. If specified, will smelt the given number of trinkets. Use this to avoid calling this function multiple times. Default is 1.

Returns

void

Defined in

packages/isaacscript-common/src/functions/trinketGive.ts:62


smeltTrinkets

smeltTrinkets(player, ...trinketTypes): void

Helper function to smelt two or more different trinkets. If you want to smelt one trinket (or multiple copies of one trinket), then use the smeltTrinket helper function instead.

This function is variadic, meaning that you can pass as many trinket types as you want to smelt.

Before smelting, this function will automatically remove the trinkets that the player is holding, if any, and then give them back after the new trinket is smelted.

Parameters

NameTypeDescription
playerEntityPlayerThe player to smelt the trinkets to.
...trinketTypesreadonly TrinketType[]The trinket types to smelt.

Returns

void

Defined in

packages/isaacscript-common/src/functions/trinketGive.ts:89


temporarilyRemoveTrinket

temporarilyRemoveTrinket(player, trinketType): TrinketSituation | undefined

Helper function to temporarily remove a specific kind of trinket from the player. Use this in combination with the giveTrinketsBack function to take away and give back a trinket on the same frame. This function correctly handles multiple trinket slots and ensures that all copies of the trinket are removed, including smelted trinkets.

Note that one smelted golden trinket is the same as two smelted normal trinkets.

Parameters

NameType
playerEntityPlayer
trinketTypeTrinketType

Returns

TrinketSituation | undefined

Undefined if the player does not have the trinket, or TrinketSituation if they do.

Defined in

packages/isaacscript-common/src/functions/trinketGive.ts:108


temporarilyRemoveTrinkets

temporarilyRemoveTrinkets(player): TrinketSituation | undefined

Helper function to temporarily removes a player's held trinkets, if any. This will not remove any smelted trinkets. Use this in combination with the giveTrinketsBack function to take away and give back trinkets on the same frame.

Parameters

NameType
playerEntityPlayer

Returns

TrinketSituation | undefined

Undefined if the player does not have any trinkets, or TrinketSituation if they do.

Defined in

packages/isaacscript-common/src/functions/trinketGive.ts:154