Stage
Functions
Section titled “Functions”calculateStageType()
Section titled “calculateStageType()”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.
Parameters
Section titled “Parameters”LevelStage
Returns
Section titled “Returns”StageType
calculateStageTypeRepentance()
Section titled “calculateStageTypeRepentance()”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.
Parameters
Section titled “Parameters”LevelStage
Returns
Section titled “Returns”StageType
getEffectiveStage()
Section titled “getEffectiveStage()”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.
Returns
Section titled “Returns”LevelStage
getGotoCommand()
Section titled “getGotoCommand()”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.
Parameters
Section titled “Parameters”roomType
Section titled “roomType”RoomType
The RoomType of the destination room.
roomVariant
Section titled “roomVariant”int
The variant of the destination room.
useSpecialRoomsForRoomTypeDefault?
Section titled “useSpecialRoomsForRoomTypeDefault?”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.
Returns
Section titled “Returns”string
getLevelName()
Section titled “getLevelName()”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.
Parameters
Section titled “Parameters”stage?
Section titled “stage?”LevelStage
Optional. If not specified, the current stage will be used.
stageType?
Section titled “stageType?”StageType
Optional. If not specified, the current stage type will be used.
Returns
Section titled “Returns”string
getStage()
Section titled “getStage()”getStage():
LevelStage
Defined in: packages/isaacscript-common/src/functions/stage.ts:170
Alias for the Level.GetStage method.
Returns
Section titled “Returns”LevelStage
getStageID()
Section titled “getStageID()”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.
Parameters
Section titled “Parameters”stage?
Section titled “stage?”LevelStage
Optional. If not specified, the stage corresponding to the current floor will be used.
stageType?
Section titled “stageType?”StageType
Optional. If not specified, the stage type corresponding to the current floor will be used.
Returns
Section titled “Returns”StageID
getStageIDName()
Section titled “getStageIDName()”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 “???”.
Parameters
Section titled “Parameters”stageID
Section titled “stageID”StageID
Returns
Section titled “Returns”string
getStageType()
Section titled “getStageType()”getStageType():
StageType
Defined in: packages/isaacscript-common/src/functions/stage.ts:222
Alias for the Level.GetStageType method.
Returns
Section titled “Returns”StageType
getStageTypeSuffix()
Section titled “getStageTypeSuffix()”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”.
Parameters
Section titled “Parameters”stageType
Section titled “stageType”StageType
Returns
Section titled “Returns”string
isFinalFloor()
Section titled “isFinalFloor()”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.
Parameters
Section titled “Parameters”LevelStage
stageType
Section titled “stageType”StageType
Returns
Section titled “Returns”boolean
isRepentanceStage()
Section titled “isRepentanceStage()”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.
Parameters
Section titled “Parameters”stageType
Section titled “stageType”StageType
Returns
Section titled “Returns”boolean
isStageWithNaturalDevilRoom()
Section titled “isStageWithNaturalDevilRoom()”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).
Parameters
Section titled “Parameters”effectiveStage
Section titled “effectiveStage”LevelStage
Returns
Section titled “Returns”boolean
isStageWithRandomBossCollectible()
Section titled “isStageWithRandomBossCollectible()”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.
Parameters
Section titled “Parameters”LevelStage
Returns
Section titled “Returns”boolean
isStageWithSecretExitToDownpour()
Section titled “isStageWithSecretExitToDownpour()”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.
Parameters
Section titled “Parameters”LevelStage
Returns
Section titled “Returns”boolean
isStageWithSecretExitToMausoleum()
Section titled “isStageWithSecretExitToMausoleum()”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.
Parameters
Section titled “Parameters”LevelStage
stageType
Section titled “stageType”StageType
Returns
Section titled “Returns”boolean
isStageWithSecretExitToMines()
Section titled “isStageWithSecretExitToMines()”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.
Parameters
Section titled “Parameters”LevelStage
stageType
Section titled “stageType”StageType
Returns
Section titled “Returns”boolean
isStageWithShovelTrapdoors()
Section titled “isStageWithShovelTrapdoors()”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.
Parameters
Section titled “Parameters”LevelStage
stageType
Section titled “stageType”StageType
Returns
Section titled “Returns”boolean
isStageWithStoryBoss()
Section titled “isStageWithStoryBoss()”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).
Parameters
Section titled “Parameters”LevelStage
Returns
Section titled “Returns”boolean
onAscent()
Section titled “onAscent()”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.
Returns
Section titled “Returns”boolean
onCathedral()
Section titled “onCathedral()”onCathedral():
boolean
Defined in: packages/isaacscript-common/src/functions/stage.ts:371
Returns
Section titled “Returns”boolean
onChest()
Section titled “onChest()”onChest():
boolean
Defined in: packages/isaacscript-common/src/functions/stage.ts:382
Returns
Section titled “Returns”boolean
onDarkRoom()
Section titled “onDarkRoom()”onDarkRoom():
boolean
Defined in: packages/isaacscript-common/src/functions/stage.ts:393
Returns
Section titled “Returns”boolean
onEffectiveStage()
Section titled “onEffectiveStage()”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.
Parameters
Section titled “Parameters”effectiveStages
Section titled “effectiveStages”…readonly LevelStage[]
Returns
Section titled “Returns”boolean
onFinalFloor()
Section titled “onFinalFloor()”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.
Returns
Section titled “Returns”boolean
onFirstFloor()
Section titled “onFirstFloor()”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.
Returns
Section titled “Returns”boolean
onRepentanceStage()
Section titled “onRepentanceStage()”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.
Returns
Section titled “Returns”boolean
onSheol()
Section titled “onSheol()”onSheol():
boolean
Defined in: packages/isaacscript-common/src/functions/stage.ts:456
Returns
Section titled “Returns”boolean
onStage()
Section titled “onStage()”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.
Parameters
Section titled “Parameters”stages
Section titled “stages”…readonly LevelStage[]
Returns
Section titled “Returns”boolean
onStageOrHigher()
Section titled “onStageOrHigher()”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.
Parameters
Section titled “Parameters”LevelStage
Returns
Section titled “Returns”boolean
onStageOrLower()
Section titled “onStageOrLower()”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.
Parameters
Section titled “Parameters”LevelStage
Returns
Section titled “Returns”boolean
onStageType()
Section titled “onStageType()”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.
Parameters
Section titled “Parameters”stageTypes
Section titled “stageTypes”…readonly StageType[]
Returns
Section titled “Returns”boolean
onStageWithNaturalDevilRoom()
Section titled “onStageWithNaturalDevilRoom()”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.
Returns
Section titled “Returns”boolean
onStageWithRandomBossCollectible()
Section titled “onStageWithRandomBossCollectible()”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.
Returns
Section titled “Returns”boolean
onStageWithSecretExitToDownpour()
Section titled “onStageWithSecretExitToDownpour()”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.
Returns
Section titled “Returns”boolean
onStageWithSecretExitToMausoleum()
Section titled “onStageWithSecretExitToMausoleum()”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.
Returns
Section titled “Returns”boolean
onStageWithSecretExitToMines()
Section titled “onStageWithSecretExitToMines()”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.
Returns
Section titled “Returns”boolean
onStageWithShovelTrapdoors()
Section titled “onStageWithShovelTrapdoors()”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.
Returns
Section titled “Returns”boolean
onStageWithStoryBoss()
Section titled “onStageWithStoryBoss()”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).
Returns
Section titled “Returns”boolean
setStage()
Section titled “setStage()”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.
Parameters
Section titled “Parameters”LevelStage
The stage number to warp to.
stageType
Section titled “stageType”StageType
The stage type to warp to.
reseed?
Section titled “reseed?”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).
Returns
Section titled “Returns”void
