Skip to main content

Stage

Functions

calculateStageType

calculateStageType(stage): StageType

Helper function that calculates what the stage type should be for the provided stage. This emulates what the game's internal code does.

Parameters

NameType
stageLevelStage

Returns

StageType

Defined in

packages/isaacscript-common/src/functions/stage.ts:24


calculateStageTypeRepentance

calculateStageTypeRepentance(stage): StageType

Helper function that calculates what the Repentance stage type should be for the provided stage. This emulates what the game's internal code does.

Parameters

NameType
stageLevelStage

Returns

StageType

Defined in

packages/isaacscript-common/src/functions/stage.ts:59


getEffectiveStage

getEffectiveStage(): LevelStage

Helper function to account for Repentance floors being offset by 1. For example, Downpour 2 is the third level of the run, but the game considers it to have a stage of 2. This function will consider Downpour 2 to have a stage of 3.

Returns

LevelStage

Defined in

packages/isaacscript-common/src/functions/stage.ts:85


getGotoCommand

getGotoCommand(roomType, roomVariant, useSpecialRoomsForRoomTypeDefault?): string

Helper function to get the corresponding "goto" console command that would correspond to the provided room type and room variant.

Parameters

NameTypeDefault valueDescription
roomTypeRoomTypeundefinedThe RoomType of the destination room.
roomVariantintundefinedThe variant of the destination room.
useSpecialRoomsForRoomTypeDefaultbooleanfalseOptional. Whether to use s.default as the prefix for the goto command (instead of d) if the room type is RoomType.DEFAULT (1). False by default.

Returns

string

Defined in

packages/isaacscript-common/src/functions/stage.ts:106


getLevelName

getLevelName(stage?, stageType?): string

Helper function to get the English name of the level. For example, "Caves 1".

This is useful because the Level.GetName method returns a localized version of the level name, which will not display correctly on some fonts.

Note that this returns "Blue Womb" instead of "???" for stage 9.

Parameters

NameTypeDescription
stage?LevelStageOptional. If not specified, the current stage will be used.
stageType?StageTypeOptional. If not specified, the current stage type will be used.

Returns

string

Defined in

packages/isaacscript-common/src/functions/stage.ts:130


getStage

getStage(): LevelStage

Alias for the Level.GetStage method.

Returns

LevelStage

Defined in

packages/isaacscript-common/src/functions/stage.ts:175


getStageID

getStageID(stage?, stageType?): StageID

Helper function to get the stage ID that corresponds to a particular stage and stage type.

This is useful because getRoomStageID will not correctly return the StageID if the player is in a special room.

This correctly handles the case of Greed Mode. In Greed Mode, if an undefined stage and stage type combination are passed, StageID.SPECIAL_ROOMS (0) will be returned.

Parameters

NameTypeDescription
stage?LevelStageOptional. If not specified, the stage corresponding to the current floor will be used.
stageType?StageTypeOptional. If not specified, the stage type corresponding to the current floor will be used.

Returns

StageID

Defined in

packages/isaacscript-common/src/functions/stage.ts:195


getStageIDName

getStageIDName(stageID): string

Helper function to get the English name corresponding to a stage ID. For example, "Caves".

This is derived from the data in the "stages.xml" file.

Note that unlike "stages.xml", Blue Womb is specified with a name of "Blue Womb" instead of "???".

Parameters

NameType
stageIDStageID

Returns

string

Defined in

packages/isaacscript-common/src/functions/stage.ts:227


getStageType

getStageType(): StageType

Alias for the Level.GetStageType method.

Returns

StageType

Defined in

packages/isaacscript-common/src/functions/stage.ts:232


getStageTypeSuffix

getStageTypeSuffix(stageType): string

Helper function to convert a numerical StageType into the letter suffix supplied to the "stage" console command. For example, StageType.REPENTANCE is the stage type for Downpour, and the console command to go to Downpour is "stage 1c", so this function converts StageType.REPENTANCE to "c".

Parameters

NameType
stageTypeStageType

Returns

string

Defined in

packages/isaacscript-common/src/functions/stage.ts:244


isFinalFloor

isFinalFloor(stage, stageType): boolean

Returns whether the provided stage and stage type represent a "final floor". This is defined as a floor that prevents the player from entering the I AM ERROR room on.

For example, when using Undefined on The Chest, it has a 50% chance of teleporting the player to the Secret Room and a 50% chance of teleporting the player to the Super Secret Room, because the I AM ERROR room is never entered into the list of possibilities.

Parameters

NameType
stageLevelStage
stageTypeStageType

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:256


isRepentanceStage

isRepentanceStage(stageType): boolean

Helper function to check if the provided stage type is equal to StageType.REPENTANCE or StageType.REPENTANCE_B.

Parameters

NameType
stageTypeStageType

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:269


isStageWithNaturalDevilRoom

isStageWithNaturalDevilRoom(effectiveStage): boolean

Helper function to check if the provided effective stage is one that has the possibility to grant a natural Devil Room or Angel Room after killing the boss.

Note that in order for this function to work properly, you must provide it with the effective stage (e.g. from the getEffectiveStage helper function) and not the absolute stage (e.g. from the Level.GetStage method).

Parameters

NameType
effectiveStageLevelStage

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:283


isStageWithRandomBossCollectible

isStageWithRandomBossCollectible(stage): boolean

Helper function to check if the provided stage is one that will have a random collectible drop upon defeating the boss of the floor.

This happens on most stages but will not happen on Depths 2, Womb 2, Sheol, Cathedral, Dark Room, The Chest, and Home (due to the presence of a story boss).

Note that even though Delirium does not drop a random boss collectible, The Void is still considered to be a stage that has a random boss collectible since all of the non-Delirium Boss Rooms will drop random boss collectibles.

Parameters

NameType
stageLevelStage

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:303


isStageWithSecretExitToDownpour

isStageWithSecretExitToDownpour(stage): boolean

Helper function to check if the provided stage will spawn a locked door to Downpour/Dross after defeating the boss.

Parameters

NameType
stageLevelStage

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:311


isStageWithSecretExitToMausoleum

isStageWithSecretExitToMausoleum(stage, stageType): boolean

Helper function to check if the provided stage and stage type will spawn a spiked door to Mausoleum/Gehenna after defeating the boss.

Parameters

NameType
stageLevelStage
stageTypeStageType

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:319


isStageWithSecretExitToMines

isStageWithSecretExitToMines(stage, stageType): boolean

Helper function to check if the provided stage and stage type will spawn a wooden door to Mines/Ashpit after defeating the boss.

Parameters

NameType
stageLevelStage
stageTypeStageType

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:335


isStageWithShovelTrapdoors

isStageWithShovelTrapdoors(stage, stageType): boolean

Helper function to check if the current stage is one that would create a trapdoor if We Need to Go Deeper was used.

Parameters

NameType
stageLevelStage
stageTypeStageType

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:351


isStageWithStoryBoss

isStageWithStoryBoss(stage): boolean

Helper function to check if the provided stage is one with a story boss. Specifically, this is Depths 2 (Mom), Womb 2 (Mom's Heart / It Lives), Blue Womb (Hush), Sheol (Satan), Cathedral (Isaac), Dark Room (Lamb), The Chest (Blue Baby), The Void (Delirium), and Home (Dogma / The Beast).

Parameters

NameType
stageLevelStage

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:369


onAscent

onAscent(): boolean

Helper function to check if the player has taken Dad's Note. This sets the game state flag of GameStateFlag.BACKWARDS_PATH and causes floor generation to change.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:377


onCathedral

onCathedral(): boolean

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:381


onChest

onChest(): boolean

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:392


onDarkRoom

onDarkRoom(): boolean

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:403


onEffectiveStage

onEffectiveStage(...effectiveStages): boolean

Helper function to check if the current stage matches one of the given stages. This uses the getEffectiveStage helper function so that the Repentance floors are correctly adjusted.

This function is variadic, which means you can pass as many stages as you want to match for.

Parameters

NameType
...effectiveStagesreadonly LevelStage[]

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:419


onFinalFloor

onFinalFloor(): boolean

Returns whether the player is on the "final floor" of the particular run. The final floor is defined as one that prevents the player from entering the I AM ERROR room on.

For example, when using Undefined on The Chest, it has a 50% chance of teleporting the player to the Secret Room and a 50% chance of teleporting the player to the Super Secret Room, because the I AM ERROR room is never entered into the list of possibilities.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:434


onFirstFloor

onFirstFloor(): boolean

Returns whether the player is on the first floor of the particular run.

This is tricky to determine because we have to handle the cases of Downpour/Dross 1 not being the first floor and The Ascent.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:448


onRepentanceStage

onRepentanceStage(): boolean

Helper function to check if the current stage type is equal to StageType.REPENTANCE or StageType.REPENTANCE_B.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:459


onSheol

onSheol(): boolean

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:466


onStage

onStage(...stages): boolean

Helper function to check if the current stage matches one of the given stages.

This function is variadic, which means you can pass as many stages as you want to match for.

Parameters

NameType
...stagesreadonly LevelStage[]

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:481


onStageOrHigher

onStageOrHigher(stage): boolean

Helper function to check if the current stage is equal to or higher than the given stage.

Parameters

NameType
stageLevelStage

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:488


onStageOrLower

onStageOrLower(stage): boolean

Helper function to check if the current stage is equal to or higher than the given stage.

Parameters

NameType
stageLevelStage

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:495


onStageType

onStageType(...stageTypes): boolean

Helper function to check if the current stage matches one of the given stage types.

This function is variadic, which means you can pass as many room types as you want to match for.

Parameters

NameType
...stageTypesreadonly StageType[]

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:506


onStageWithNaturalDevilRoom

onStageWithNaturalDevilRoom(): boolean

Helper function to check if the current stage is one that has the possibility to grant a natural Devil Room or Angel Room after killing the boss.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:516


onStageWithRandomBossCollectible

onStageWithRandomBossCollectible(): boolean

Helper function to check if the current stage is one that will have a random collectible drop upon defeating the boss of the floor.

This happens on most stages but will not happen on Depths 2, Womb 2, Sheol, Cathedral, Dark Room, The Chest, and Home (due to the presence of a story boss).

Note that even though Delirium does not drop a random boss collectible, The Void is still considered to be a stage that has a random boss collectible since all of the non-Delirium Boss Rooms will drop random boss collectibles.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:532


onStageWithSecretExitToDownpour

onStageWithSecretExitToDownpour(): boolean

Helper function to check if the current stage will spawn a locked door to Downpour/Dross after defeating the boss.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:543


onStageWithSecretExitToMausoleum

onStageWithSecretExitToMausoleum(): boolean

Helper function to check if the current stage will spawn a spiked door to Mausoleum/Gehenna after defeating the boss.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:554


onStageWithSecretExitToMines

onStageWithSecretExitToMines(): boolean

Helper function to check if the current stage will spawn a wooden door to Mines/Ashpit after defeating the boss.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:566


onStageWithShovelTrapdoors

onStageWithShovelTrapdoors(): boolean

Helper function to check if the current stage is one that would create a trapdoor if We Need to Go Deeper was used.

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:578


onStageWithStoryBoss

onStageWithStoryBoss(): boolean

Helper function to check if the current stage is one with a story boss. Specifically, this is Depths 2 (Mom), Womb 2 (Mom's Heart / It Lives), Blue Womb (Hush), Sheol (Satan), Cathedral (Isaac), Dark Room (Lamb), The Chest (Blue Baby), The Void (Delirium), and Home (Dogma / The Beast).

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/stage.ts:592


setStage

setStage(stage, stageType, reseed?): void

Helper function to directly warp to a specific stage using the "stage" console command.

This is different from the vanilla Level.SetStage method, which will change the stage and/or stage type of the current floor without moving the player to a new floor.

Note that if you use this function on game frame 0, it will confuse the POST_GAME_STARTED_REORDERED, POST_NEW_LEVEL_REORDERED, and POST_NEW_ROOM_REORDERED custom callbacks. If you are using the function in this situation, remember to call the reorderedCallbacksSetStage function.

Parameters

NameTypeDefault valueDescription
stageLevelStageundefinedThe stage number to warp to.
stageTypeStageTypeundefinedThe stage type to warp to.
reseedbooleanfalseOptional. Whether to reseed the floor upon arrival. Default is false. Set this to true if you are warping to the same stage but a different stage type (or else the floor layout will be identical to the old floor).

Returns

void

Defined in

packages/isaacscript-common/src/functions/stage.ts:616