Skip to main content

Player Trinkets

Functions

addTrinketCostume

addTrinketCostume(player, trinketType): void

Parameters

NameType
playerEntityPlayer
trinketTypeTrinketType

Returns

void

Defined in

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


anyPlayerHasTrinket

anyPlayerHasTrinket(trinketType, ignoreModifiers?): boolean

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

Parameters

NameTypeDescription
trinketTypeTrinketTypeThe trinket type to check for.
ignoreModifiers?booleanIf set to true, only counts trinkets the player actually holds and ignores effects granted by other items. Default is false.

Returns

boolean

Defined in

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


getOpenTrinketSlot

getOpenTrinketSlot(player): int | undefined

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);
}

Parameters

NameType
playerEntityPlayer

Returns

int | undefined

Defined in

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


getPlayerTrinkets

getPlayerTrinkets(player): readonly TrinketType[]

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

Parameters

NameType
playerEntityPlayer

Returns

readonly TrinketType[]

Defined in

packages/isaacscript-common/src/functions/playerTrinkets.ts:79


getPlayersWithTrinket

getPlayersWithTrinket(...trinketTypes): readonly EntityPlayer[]

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.

Parameters

NameType
...trinketTypesreadonly TrinketType[]

Returns

readonly EntityPlayer[]

Defined in

packages/isaacscript-common/src/functions/playerTrinkets.ts:100


hasAnyTrinket

hasAnyTrinket(player): boolean

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

Parameters

NameType
playerEntityPlayer

Returns

boolean

Defined in

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


hasOpenTrinketSlot

hasOpenTrinketSlot(player): 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.)

Parameters

NameType
playerEntityPlayer

Returns

boolean

Defined in

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


hasTrinket

hasTrinket(player, ...trinketTypes): 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.

Parameters

NameType
playerEntityPlayer
...trinketTypesreadonly TrinketType[]

Returns

boolean

Defined in

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


removeAllPlayerTrinkets

removeAllPlayerTrinkets(player): void

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

Parameters

NameType
playerEntityPlayer

Returns

void

Defined in

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


removeTrinketCostume

removeTrinketCostume(player, trinketType): 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.

Parameters

NameType
playerEntityPlayer
trinketTypeTrinketType

Returns

void

Defined in

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