Skip to content

Stage

calculateStageType(stage): StageType

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

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

LevelStage

StageType


calculateStageTypeRepentance(stage): StageType

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

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

LevelStage

StageType


getEffectiveStage(): LevelStage

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

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.

LevelStage


getGotoCommand(roomType, roomVariant, useSpecialRoomsForRoomTypeDefault?): string

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

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

RoomType

The RoomType of the destination room.

int

The variant of the destination room.

boolean = false

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

string


getLevelName(stage?, stageType?): string

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

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.

LevelStage

Optional. If not specified, the current stage will be used.

StageType

Optional. If not specified, the current stage type will be used.

string


getStage(): LevelStage

Defined in: packages/isaacscript-common/src/functions/stage.ts:170

Alias for the Level.GetStage method.

LevelStage


getStageID(stage?, stageType?): StageID

Defined in: packages/isaacscript-common/src/functions/stage.ts:190

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.

LevelStage

Optional. If not specified, the stage corresponding to the current floor will be used.

StageType

Optional. If not specified, the stage type corresponding to the current floor will be used.

StageID


getStageIDName(stageID): string

Defined in: packages/isaacscript-common/src/functions/stage.ts:217

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 “???”.

StageID

string


getStageType(): StageType

Defined in: packages/isaacscript-common/src/functions/stage.ts:222

Alias for the Level.GetStageType method.

StageType


getStageTypeSuffix(stageType): string

Defined in: packages/isaacscript-common/src/functions/stage.ts:234

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

StageType

string


isFinalFloor(stage, stageType): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:246

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.

LevelStage

StageType

boolean


isRepentanceStage(stageType): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:259

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

StageType

boolean


isStageWithNaturalDevilRoom(effectiveStage): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:273

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

LevelStage

boolean


isStageWithRandomBossCollectible(stage): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:293

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.

LevelStage

boolean


isStageWithSecretExitToDownpour(stage): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:301

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

LevelStage

boolean


isStageWithSecretExitToMausoleum(stage, stageType): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:309

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

LevelStage

StageType

boolean


isStageWithSecretExitToMines(stage, stageType): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:325

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

LevelStage

StageType

boolean


isStageWithShovelTrapdoors(stage, stageType): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:341

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

LevelStage

StageType

boolean


isStageWithStoryBoss(stage): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:359

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

LevelStage

boolean


onAscent(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:367

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.

boolean


onCathedral(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:371

boolean


onChest(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:382

boolean


onDarkRoom(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:393

boolean


onEffectiveStage(…effectiveStages): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:409

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.

…readonly LevelStage[]

boolean


onFinalFloor(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:424

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.

boolean


onFirstFloor(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:438

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.

boolean


onRepentanceStage(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:449

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

boolean


onSheol(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:456

boolean


onStage(…stages): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:471

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.

…readonly LevelStage[]

boolean


onStageOrHigher(stage): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:478

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

LevelStage

boolean


onStageOrLower(stage): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:485

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

LevelStage

boolean


onStageType(…stageTypes): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:496

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.

…readonly StageType[]

boolean


onStageWithNaturalDevilRoom(): boolean

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

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.

boolean


onStageWithRandomBossCollectible(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:522

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.

boolean


onStageWithSecretExitToDownpour(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:533

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

boolean


onStageWithSecretExitToMausoleum(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:544

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

boolean


onStageWithSecretExitToMines(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:556

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

boolean


onStageWithShovelTrapdoors(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:568

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

boolean


onStageWithStoryBoss(): boolean

Defined in: packages/isaacscript-common/src/functions/stage.ts:582

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

boolean


setStage(stage, stageType, reseed?): void

Defined in: packages/isaacscript-common/src/functions/stage.ts:606

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.

LevelStage

The stage number to warp to.

StageType

The stage type to warp to.

boolean = false

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

void