Pills
Functions
Section titled “Functions”getAllPillColors()
Section titled “getAllPillColors()”getAllPillColors(): readonly
PillColor[]
Defined in: packages/isaacscript-common/src/functions/pills.ts:47
Helper function to get an array with every non-null pill color. This includes all gold colors and all horse colors.
Returns
Section titled “Returns”readonly PillColor[]
getFalsePHDPillEffect()
Section titled “getFalsePHDPillEffect()”getFalsePHDPillEffect(
pillEffect):PillEffect
Defined in: packages/isaacscript-common/src/functions/pills.ts:55
Helper function to get the associated pill effect after False PHD is acquired. If a pill effect is not altered by False PHD, then the same pill effect will be returned.
Parameters
Section titled “Parameters”pillEffect
Section titled “pillEffect”PillEffect
Returns
Section titled “Returns”PillEffect
getHorsePillColor()
Section titled “getHorsePillColor()”getHorsePillColor(
pillColor):PillColor
Defined in: packages/isaacscript-common/src/functions/pills.ts:68
Helper function to get the corresponding horse pill color from a normal pill color.
For example, passing PillColor.BLUE_BLUE would result in 2049, which is the value that
corresponds to the horse pill color for blue/blue.
If passed a horse pill color, this function will return the unmodified pill color.
Parameters
Section titled “Parameters”pillColor
Section titled “pillColor”PillColor
Returns
Section titled “Returns”PillColor
getHorsePillColors()
Section titled “getHorsePillColors()”getHorsePillColors(): readonly
PillColor[]
Defined in: packages/isaacscript-common/src/functions/pills.ts:75
Helper function to get an array with every non-gold horse pill color.
Returns
Section titled “Returns”readonly PillColor[]
getNormalPillColorFromHorse()
Section titled “getNormalPillColorFromHorse()”getNormalPillColorFromHorse(
pillColor):PillColor
Defined in: packages/isaacscript-common/src/functions/pills.ts:86
Helper function to get the corresponding normal pill color from a horse pill color.
For example, passing 2049 would result in PillColor.BLUE_BLUE.
If called with a non-horse pill color, this function will return back the same color.
Parameters
Section titled “Parameters”pillColor
Section titled “pillColor”PillColor
Returns
Section titled “Returns”PillColor
getNormalPillColors()
Section titled “getNormalPillColors()”getNormalPillColors(): readonly
PillColor[]
Defined in: packages/isaacscript-common/src/functions/pills.ts:93
Helper function to get an array with every non-gold and non-horse pill color.
Returns
Section titled “Returns”readonly PillColor[]
getPHDPillEffect()
Section titled “getPHDPillEffect()”getPHDPillEffect(
pillEffect):PillEffect
Defined in: packages/isaacscript-common/src/functions/pills.ts:101
Helper function to get the associated pill effect after PHD is acquired. If a pill effect is not altered by PHD, then the same pill effect will be returned.
Parameters
Section titled “Parameters”pillEffect
Section titled “pillEffect”PillEffect
Returns
Section titled “Returns”PillEffect
getPillColorFromEffect()
Section titled “getPillColorFromEffect()”getPillColorFromEffect(
pillEffect):PillColor
Defined in: packages/isaacscript-common/src/functions/pills.ts:120
Helper function to get the corresponding pill color from an effect by repeatedly using the
ItemPool.GetPillEffect method.
Note that this will return the corresponding effect even if the passed pill color is not yet identified by the player.
Returns PillColor.NULL if there is the corresponding pill color cannot be found.
This function is especially useful in the POST_USE_PILL callback, since at that point, the used
pill is already consumed, and the callback only passes the effect. In this specific circumstance,
consider using the POST_USE_PILL_FILTER callback instead of the POST_USE_PILL callback, since
it correctly passes the color and handles the case of horse pills.
Parameters
Section titled “Parameters”pillEffect
Section titled “pillEffect”PillEffect
Returns
Section titled “Returns”PillColor
getPillEffectClass()
Section titled “getPillEffectClass()”getPillEffectClass(
pillEffect):ItemConfigPillEffectClass
Defined in: packages/isaacscript-common/src/functions/pills.ts:142
Helper function to get a pill effect class from a PillEffect enum value. In this context, the
class is equal to the numerical prefix in the “class” tag in the “pocketitems.xml” file. Use the
getPillEffectType helper function to determine whether the pill effect is positive, negative,
or neutral.
Due to limitations in the API, this function will not work properly for modded pill effects, and
will always return DEFAULT_PILL_EFFECT_CLASS in those cases.
Parameters
Section titled “Parameters”pillEffect
Section titled “pillEffect”PillEffect
Returns
Section titled “Returns”ItemConfigPillEffectClass
getPillEffectName()
Section titled “getPillEffectName()”getPillEffectName(
pillEffect):string
Defined in: packages/isaacscript-common/src/functions/pills.ts:162
Helper function to get a pill effect name from a PillEffect. Returns “Unknown” if the provided
pill effect is not valid.
This function works for both vanilla and modded pill effects.
For example, getPillEffectName(PillEffect.BAD_GAS) would return “Bad Gas”.
Parameters
Section titled “Parameters”pillEffect
Section titled “pillEffect”PillEffect
Returns
Section titled “Returns”string
getPillEffectType()
Section titled “getPillEffectType()”getPillEffectType(
pillEffect):ItemConfigPillEffectType
Defined in: packages/isaacscript-common/src/functions/pills.ts:189
Helper function to get a pill effect type from a PillEffect enum value. In this context, the
type is equal to positive, negative, or neutral. This is derived from the suffix of the “class”
tag in the “pocketitems.xml” file. Use the getPillEffectClass helper function to determine the
“power” of the pill.
Due to limitations in the API, this function will not work properly for modded pill effects, and
will always return DEFAULT_PILL_EFFECT_TYPE in those cases.
Parameters
Section titled “Parameters”pillEffect
Section titled “pillEffect”PillEffect
Returns
Section titled “Returns”ItemConfigPillEffectType
getVanillaPillEffectsOfType()
Section titled “getVanillaPillEffectsOfType()”getVanillaPillEffectsOfType(
pillEffectType): readonlyPillEffect[]
Defined in: packages/isaacscript-common/src/functions/pills.ts:201
Parameters
Section titled “Parameters”pillEffectType
Section titled “pillEffectType”ItemConfigPillEffectType
Returns
Section titled “Returns”readonly PillEffect[]
isGoldPill()
Section titled “isGoldPill()”isGoldPill(
pillColor):boolean
Defined in: packages/isaacscript-common/src/functions/pills.ts:208
Helper function to see if the given pill color is either a gold pill or a horse gold pill.
Parameters
Section titled “Parameters”pillColor
Section titled “pillColor”PillColor
Returns
Section titled “Returns”boolean
isHorsePill()
Section titled “isHorsePill()”isHorsePill(
pillColor):boolean
Defined in: packages/isaacscript-common/src/functions/pills.ts:217
Helper function to see if the given pill color is a horse pill.
Under the hood, this checks for pillColor > 2048.
Parameters
Section titled “Parameters”pillColor
Section titled “pillColor”PillColor
Returns
Section titled “Returns”boolean
isModdedPillEffect()
Section titled “isModdedPillEffect()”isModdedPillEffect(
pillEffect):boolean
Defined in: packages/isaacscript-common/src/functions/pills.ts:221
Parameters
Section titled “Parameters”pillEffect
Section titled “pillEffect”PillEffect
Returns
Section titled “Returns”boolean
isNormalPillColor()
Section titled “isNormalPillColor()”isNormalPillColor(
pillColor):boolean
Defined in: packages/isaacscript-common/src/functions/pills.ts:231
Helper function to see if the given pill color is not a gold pill and not a horse pill and not the null value.
Under the hood, this checks using the FIRST_PILL_COLOR and LAST_NORMAL_PILL_COLOR constants.
Parameters
Section titled “Parameters”pillColor
Section titled “pillColor”PillColor
Returns
Section titled “Returns”boolean
isValidPillEffect()
Section titled “isValidPillEffect()”isValidPillEffect(
pillEffect):pillEffect is PillEffect
Defined in: packages/isaacscript-common/src/functions/pills.ts:235
Parameters
Section titled “Parameters”pillEffect
Section titled “pillEffect”int
Returns
Section titled “Returns”pillEffect is PillEffect
isVanillaPillEffect()
Section titled “isVanillaPillEffect()”isVanillaPillEffect(
pillEffect):boolean
Defined in: packages/isaacscript-common/src/functions/pills.ts:241
Parameters
Section titled “Parameters”pillEffect
Section titled “pillEffect”PillEffect
Returns
Section titled “Returns”boolean
