Skip to content

Player Trinkets

addTrinketCostume(player, trinketType): void

Defined in: packages/isaacscript-common/src/functions/playerTrinkets.ts:11

EntityPlayer

TrinketType

void


anyPlayerHasTrinket(trinketType, ignoreModifiers?): boolean

Defined in: packages/isaacscript-common/src/functions/playerTrinkets.ts:30

Helper function to check to see if any player has a particular trinket.

TrinketType

The trinket type to check for.

boolean

If set to true, only counts trinkets the player actually holds and ignores effects granted by other items. Default is false.

boolean


getOpenTrinketSlot(player): int | undefined

Defined in: packages/isaacscript-common/src/functions/playerTrinkets.ts:55

Returns the slot number corresponding to where a trinket can be safely inserted.

For example:

const player = Isaac.GetPlayer();
const trinketSlot = getOpenTrinketSlotNum(player);
if (trinketSlot !== undefined) {
// They have one or more open trinket slots
player.AddTrinket(TrinketType.SWALLOWED_PENNY);
}

EntityPlayer

int | undefined


getPlayersWithTrinket(…trinketTypes): readonly EntityPlayer[]

Defined in: packages/isaacscript-common/src/functions/playerTrinkets.ts:81

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.

…readonly TrinketType[]

readonly EntityPlayer[]


getPlayerTrinkets(player): readonly TrinketType[]

Defined in: packages/isaacscript-common/src/functions/playerTrinkets.ts:95

Helper function to get all of the trinkets that the player is currently holding. This will not include any smelted trinkets.

EntityPlayer

readonly TrinketType[]


hasAnyTrinket(player): boolean

Defined in: packages/isaacscript-common/src/functions/playerTrinkets.ts:111

Helper function to check to see if the player is holding one or more trinkets.

EntityPlayer

boolean


hasOpenTrinketSlot(player): boolean

Defined in: packages/isaacscript-common/src/functions/playerTrinkets.ts:127

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.)

EntityPlayer

boolean


hasTrinket(player, …trinketTypes): boolean

Defined in: packages/isaacscript-common/src/functions/playerTrinkets.ts:144

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.

EntityPlayer

…readonly TrinketType[]

boolean


removeAllPlayerTrinkets(player): void

Defined in: packages/isaacscript-common/src/functions/playerTrinkets.ts:157

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.)

EntityPlayer

void


removeTrinketCostume(player, trinketType): void

Defined in: packages/isaacscript-common/src/functions/playerTrinkets.ts:176

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.

EntityPlayer

TrinketType

void