isaacscript-common 18.4.0 → 19.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +19 -27
- package/dist/isaacscript-common.lua +9 -6
- package/dist/src/functions/stage.d.ts +6 -1
- package/dist/src/functions/stage.d.ts.map +1 -1
- package/dist/src/functions/stage.lua +9 -1
- package/dist/src/functions/utils.d.ts +4 -17
- package/dist/src/functions/utils.d.ts.map +1 -1
- package/dist/src/functions/utils.lua +4 -17
- package/package.json +1 -1
- package/src/functions/stage.ts +14 -2
- package/src/functions/utils.ts +4 -20
package/dist/index.d.ts
CHANGED
|
@@ -4563,7 +4563,7 @@ export declare function getDoorsToRoomIndex(...roomGridIndex: int[]): GridEntity
|
|
|
4563
4563
|
* the third level of the run, but the game considers it to have a stage of 2. This function will
|
|
4564
4564
|
* consider Downpour 2 to have a stage of 3.
|
|
4565
4565
|
*/
|
|
4566
|
-
export declare function getEffectiveStage():
|
|
4566
|
+
export declare function getEffectiveStage(): LevelStage;
|
|
4567
4567
|
|
|
4568
4568
|
/**
|
|
4569
4569
|
* Helper function to get all of the effects in the room.
|
|
@@ -6857,19 +6857,6 @@ export declare function inDimension(dimension: Dimension): boolean;
|
|
|
6857
6857
|
|
|
6858
6858
|
export declare function inDoubleTrouble(): boolean;
|
|
6859
6859
|
|
|
6860
|
-
/**
|
|
6861
|
-
* Helper function to check if a variable is within a certain range, exclusive on both ends. (The
|
|
6862
|
-
* "e" stands for exclusive.)
|
|
6863
|
-
*
|
|
6864
|
-
* - For example, `inERange(1, 1, 3)` will return `false`.
|
|
6865
|
-
* - For example, `inERange(1.01, 1, 3)` will return `true`.
|
|
6866
|
-
*
|
|
6867
|
-
* @param num The number to check.
|
|
6868
|
-
* @param start The start of the range to check.
|
|
6869
|
-
* @param end The end of the range to check.
|
|
6870
|
-
*/
|
|
6871
|
-
export declare function inERange(num: int, start: int, end: int): boolean;
|
|
6872
|
-
|
|
6873
6860
|
export declare function inGenesisRoom(): boolean;
|
|
6874
6861
|
|
|
6875
6862
|
/**
|
|
@@ -6880,19 +6867,6 @@ export declare function inGenesisRoom(): boolean;
|
|
|
6880
6867
|
*/
|
|
6881
6868
|
export declare function inHomeCloset(): boolean;
|
|
6882
6869
|
|
|
6883
|
-
/**
|
|
6884
|
-
* Helper function to check if a variable is within a certain range, inclusive on both ends. (The
|
|
6885
|
-
* "i" stands for inclusive.)
|
|
6886
|
-
*
|
|
6887
|
-
* - For example, `inIRange(1, 1, 3)` will return `true`.
|
|
6888
|
-
* - For example, `inIRange(0, 1, 3)` will return `false`.
|
|
6889
|
-
*
|
|
6890
|
-
* @param num The number to check.
|
|
6891
|
-
* @param start The start of the range to check.
|
|
6892
|
-
* @param end The end of the range to check.
|
|
6893
|
-
*/
|
|
6894
|
-
export declare function inIRange(num: int, start: int, end: int): boolean;
|
|
6895
|
-
|
|
6896
6870
|
/**
|
|
6897
6871
|
* Initializes an array with all of the elements containing the specified default value.
|
|
6898
6872
|
*
|
|
@@ -6934,6 +6908,18 @@ export declare function inMinibossRoomOf(minibossID: MinibossID): boolean;
|
|
|
6934
6908
|
*/
|
|
6935
6909
|
export declare function inMirrorRoom(): boolean;
|
|
6936
6910
|
|
|
6911
|
+
/**
|
|
6912
|
+
* Helper function to check if a variable is within a certain range, inclusive on both ends.
|
|
6913
|
+
*
|
|
6914
|
+
* - For example, `inRange(1, 1, 3)` will return `true`.
|
|
6915
|
+
* - For example, `inRange(0, 1, 3)` will return `false`.
|
|
6916
|
+
*
|
|
6917
|
+
* @param num The number to check.
|
|
6918
|
+
* @param start The start of the range to check.
|
|
6919
|
+
* @param end The end of the range to check.
|
|
6920
|
+
*/
|
|
6921
|
+
export declare function inRange(num: int, start: int, end: int): boolean;
|
|
6922
|
+
|
|
6937
6923
|
/**
|
|
6938
6924
|
* Helper function to check if a given position is within a given rectangle.
|
|
6939
6925
|
*
|
|
@@ -11556,6 +11542,12 @@ export declare function onSetSeed(): boolean;
|
|
|
11556
11542
|
|
|
11557
11543
|
export declare function onSheol(): boolean;
|
|
11558
11544
|
|
|
11545
|
+
/**
|
|
11546
|
+
* Helper function to check if the current stage is one that has the possibility to grant a natural
|
|
11547
|
+
* Devil Room or Angel Room after killing the boss.
|
|
11548
|
+
*/
|
|
11549
|
+
export declare function onStageWithNaturalDevilRoom(): boolean;
|
|
11550
|
+
|
|
11559
11551
|
/**
|
|
11560
11552
|
* For the purposes of this function, doors to Secret Rooms or Super Secret Rooms that have not been
|
|
11561
11553
|
* discovered yet will not be opened.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common
|
|
3
|
+
isaacscript-common 19.0.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -15343,10 +15343,7 @@ function ____exports.iRange(self, start, ____end, increment)
|
|
|
15343
15343
|
end
|
|
15344
15344
|
return array
|
|
15345
15345
|
end
|
|
15346
|
-
function ____exports.
|
|
15347
|
-
return num > start and num < ____end
|
|
15348
|
-
end
|
|
15349
|
-
function ____exports.inIRange(self, num, start, ____end)
|
|
15346
|
+
function ____exports.inRange(self, num, start, ____end)
|
|
15350
15347
|
return num >= start and num <= ____end
|
|
15351
15348
|
end
|
|
15352
15349
|
function ____exports.isReflectionRender(self)
|
|
@@ -25438,6 +25435,8 @@ local STAGE_TYPE_TO_LETTER = ____stageTypeToLetter.STAGE_TYPE_TO_LETTER
|
|
|
25438
25435
|
local ____types = require("src.functions.types")
|
|
25439
25436
|
local asLevelStage = ____types.asLevelStage
|
|
25440
25437
|
local asNumber = ____types.asNumber
|
|
25438
|
+
local ____utils = require("src.functions.utils")
|
|
25439
|
+
local inRange = ____utils.inRange
|
|
25441
25440
|
function ____exports.isRepentanceStage(self, stageType)
|
|
25442
25441
|
return stageType == StageType.REPENTANCE or stageType == StageType.REPENTANCE_B
|
|
25443
25442
|
end
|
|
@@ -25541,7 +25540,7 @@ end
|
|
|
25541
25540
|
function ____exports.onFirstFloor(self)
|
|
25542
25541
|
local effectiveStage = ____exports.getEffectiveStage(nil)
|
|
25543
25542
|
local isOnAscent = ____exports.onAscent(nil)
|
|
25544
|
-
return effectiveStage ==
|
|
25543
|
+
return effectiveStage == LevelStage.BASEMENT_1 and not isOnAscent
|
|
25545
25544
|
end
|
|
25546
25545
|
function ____exports.onSheol(self)
|
|
25547
25546
|
local level = game:GetLevel()
|
|
@@ -25549,6 +25548,10 @@ function ____exports.onSheol(self)
|
|
|
25549
25548
|
local stageType = level:GetStageType()
|
|
25550
25549
|
return stage == LevelStage.SHEOL_CATHEDRAL and stageType == StageType.ORIGINAL
|
|
25551
25550
|
end
|
|
25551
|
+
function ____exports.onStageWithNaturalDevilRoom(self)
|
|
25552
|
+
local effectiveStage = ____exports.getEffectiveStage(nil)
|
|
25553
|
+
return inRange(nil, effectiveStage, 2, 8) and effectiveStage ~= LevelStage.BLUE_WOMB
|
|
25554
|
+
end
|
|
25552
25555
|
function ____exports.setStage(self, stage, stageType, reseed)
|
|
25553
25556
|
if reseed == nil then
|
|
25554
25557
|
reseed = false
|
|
@@ -14,7 +14,7 @@ export declare function calculateStageTypeRepentance(stage: LevelStage): StageTy
|
|
|
14
14
|
* the third level of the run, but the game considers it to have a stage of 2. This function will
|
|
15
15
|
* consider Downpour 2 to have a stage of 3.
|
|
16
16
|
*/
|
|
17
|
-
export declare function getEffectiveStage():
|
|
17
|
+
export declare function getEffectiveStage(): LevelStage;
|
|
18
18
|
/**
|
|
19
19
|
* Helper function to get the English name of the level. For example, "Caves 1".
|
|
20
20
|
*
|
|
@@ -69,6 +69,11 @@ export declare function onFirstFloor(): boolean;
|
|
|
69
69
|
*/
|
|
70
70
|
export declare function onRepentanceStage(): boolean;
|
|
71
71
|
export declare function onSheol(): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Helper function to check if the current stage is one that has the possibility to grant a natural
|
|
74
|
+
* Devil Room or Angel Room after killing the boss.
|
|
75
|
+
*/
|
|
76
|
+
export declare function onStageWithNaturalDevilRoom(): boolean;
|
|
72
77
|
/**
|
|
73
78
|
* Helper function to warp to a new stage/level.
|
|
74
79
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../../src/functions/stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,QAAQ,EACR,SAAS,EACV,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../../src/functions/stage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,QAAQ,EACR,SAAS,EACV,MAAM,8BAA8B,CAAC;AAStC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CA6B/D;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,CAmBzE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,UAAU,CAS9C;AAGD;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,CAAC,EAAE,UAAU,EAClB,SAAS,CAAC,EAAE,SAAS,GACpB,MAAM,CAaR;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,GAAG,MAAM,CAG3E;AAED,6CAA6C;AAC7C,wBAAgB,QAAQ,IAAI,UAAU,CAIrC;AAED,iDAAiD;AACjD,wBAAgB,YAAY,IAAI,SAAS,CAIxC;AAED,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAIvE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAI/D;AAED,wBAAgB,QAAQ,IAAI,OAAO,CAElC;AAED,wBAAgB,WAAW,IAAI,OAAO,CASrC;AAED,wBAAgB,OAAO,IAAI,OAAO,CASjC;AAED,wBAAgB,UAAU,IAAI,OAAO,CAQpC;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAUtC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAKtC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAK3C;AAED,wBAAgB,OAAO,IAAI,OAAO,CAQjC;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,IAAI,OAAO,CAKrD;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,SAAS,EACpB,MAAM,UAAQ,GACb,IAAI,CAUN;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAE9D"}
|
|
@@ -16,6 +16,8 @@ local STAGE_TYPE_TO_LETTER = ____stageTypeToLetter.STAGE_TYPE_TO_LETTER
|
|
|
16
16
|
local ____types = require("src.functions.types")
|
|
17
17
|
local asLevelStage = ____types.asLevelStage
|
|
18
18
|
local asNumber = ____types.asNumber
|
|
19
|
+
local ____utils = require("src.functions.utils")
|
|
20
|
+
local inRange = ____utils.inRange
|
|
19
21
|
--- Helper function to check if the provided stage type is equal to `StageType.REPENTANCE` or
|
|
20
22
|
-- `StageType.REPENTANCE_B`.
|
|
21
23
|
function ____exports.isRepentanceStage(self, stageType)
|
|
@@ -158,7 +160,7 @@ end
|
|
|
158
160
|
function ____exports.onFirstFloor(self)
|
|
159
161
|
local effectiveStage = ____exports.getEffectiveStage(nil)
|
|
160
162
|
local isOnAscent = ____exports.onAscent(nil)
|
|
161
|
-
return effectiveStage ==
|
|
163
|
+
return effectiveStage == LevelStage.BASEMENT_1 and not isOnAscent
|
|
162
164
|
end
|
|
163
165
|
function ____exports.onSheol(self)
|
|
164
166
|
local level = game:GetLevel()
|
|
@@ -166,6 +168,12 @@ function ____exports.onSheol(self)
|
|
|
166
168
|
local stageType = level:GetStageType()
|
|
167
169
|
return stage == LevelStage.SHEOL_CATHEDRAL and stageType == StageType.ORIGINAL
|
|
168
170
|
end
|
|
171
|
+
--- Helper function to check if the current stage is one that has the possibility to grant a natural
|
|
172
|
+
-- Devil Room or Angel Room after killing the boss.
|
|
173
|
+
function ____exports.onStageWithNaturalDevilRoom(self)
|
|
174
|
+
local effectiveStage = ____exports.getEffectiveStage(nil)
|
|
175
|
+
return inRange(nil, effectiveStage, 2, 8) and effectiveStage ~= LevelStage.BLUE_WOMB
|
|
176
|
+
end
|
|
169
177
|
--- Helper function to warp to a new stage/level.
|
|
170
178
|
--
|
|
171
179
|
-- @param stage The stage number to warp to.
|
|
@@ -31,29 +31,16 @@ export declare function getTraversalDescription(key: unknown, traversalDescripti
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function iRange(start: int, end?: int, increment?: number): int[];
|
|
33
33
|
/**
|
|
34
|
-
* Helper function to check if a variable is within a certain range,
|
|
35
|
-
* "e" stands for exclusive.)
|
|
34
|
+
* Helper function to check if a variable is within a certain range, inclusive on both ends.
|
|
36
35
|
*
|
|
37
|
-
* - For example, `
|
|
38
|
-
* - For example, `
|
|
36
|
+
* - For example, `inRange(1, 1, 3)` will return `true`.
|
|
37
|
+
* - For example, `inRange(0, 1, 3)` will return `false`.
|
|
39
38
|
*
|
|
40
39
|
* @param num The number to check.
|
|
41
40
|
* @param start The start of the range to check.
|
|
42
41
|
* @param end The end of the range to check.
|
|
43
42
|
*/
|
|
44
|
-
export declare function
|
|
45
|
-
/**
|
|
46
|
-
* Helper function to check if a variable is within a certain range, inclusive on both ends. (The
|
|
47
|
-
* "i" stands for inclusive.)
|
|
48
|
-
*
|
|
49
|
-
* - For example, `inIRange(1, 1, 3)` will return `true`.
|
|
50
|
-
* - For example, `inIRange(0, 1, 3)` will return `false`.
|
|
51
|
-
*
|
|
52
|
-
* @param num The number to check.
|
|
53
|
-
* @param start The start of the range to check.
|
|
54
|
-
* @param end The end of the range to check.
|
|
55
|
-
*/
|
|
56
|
-
export declare function inIRange(num: int, start: int, end: int): boolean;
|
|
43
|
+
export declare function inRange(num: int, start: int, end: int): boolean;
|
|
57
44
|
/**
|
|
58
45
|
* Helper function to see if the current render callback is rendering a water reflection.
|
|
59
46
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/functions/utils.ts"],"names":[],"mappings":";AAIA;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAYlE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,oBAAoB,EAAE,MAAM,GAC3B,MAAM,CAQR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAYlE;AAED
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/functions/utils.ts"],"names":[],"mappings":";AAIA;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAYlE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,OAAO,EACZ,oBAAoB,EAAE,MAAM,GAC3B,MAAM,CAQR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,SAAS,SAAI,GAAG,GAAG,EAAE,CAYlE;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAI5C;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAGxE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAI3D;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAG;AAEjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAqB1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,4BAA4B,CAE1C,CAAC,SAAS,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,EAC/B,IAAI,SAAS,MAAM,GAAG,MAAM,KACzB,IAAI,CAAG"}
|
|
@@ -70,28 +70,15 @@ function ____exports.iRange(self, start, ____end, increment)
|
|
|
70
70
|
end
|
|
71
71
|
return array
|
|
72
72
|
end
|
|
73
|
-
--- Helper function to check if a variable is within a certain range,
|
|
74
|
-
-- "e" stands for exclusive.)
|
|
73
|
+
--- Helper function to check if a variable is within a certain range, inclusive on both ends.
|
|
75
74
|
--
|
|
76
|
-
-- - For example, `
|
|
77
|
-
-- - For example, `
|
|
75
|
+
-- - For example, `inRange(1, 1, 3)` will return `true`.
|
|
76
|
+
-- - For example, `inRange(0, 1, 3)` will return `false`.
|
|
78
77
|
--
|
|
79
78
|
-- @param num The number to check.
|
|
80
79
|
-- @param start The start of the range to check.
|
|
81
80
|
-- @param end The end of the range to check.
|
|
82
|
-
function ____exports.
|
|
83
|
-
return num > start and num < ____end
|
|
84
|
-
end
|
|
85
|
-
--- Helper function to check if a variable is within a certain range, inclusive on both ends. (The
|
|
86
|
-
-- "i" stands for inclusive.)
|
|
87
|
-
--
|
|
88
|
-
-- - For example, `inIRange(1, 1, 3)` will return `true`.
|
|
89
|
-
-- - For example, `inIRange(0, 1, 3)` will return `false`.
|
|
90
|
-
--
|
|
91
|
-
-- @param num The number to check.
|
|
92
|
-
-- @param start The start of the range to check.
|
|
93
|
-
-- @param end The end of the range to check.
|
|
94
|
-
function ____exports.inIRange(self, num, start, ____end)
|
|
81
|
+
function ____exports.inRange(self, num, start, ____end)
|
|
95
82
|
return num >= start and num <= ____end
|
|
96
83
|
end
|
|
97
84
|
--- Helper function to see if the current render callback is rendering a water reflection.
|
package/package.json
CHANGED
package/src/functions/stage.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { ROOM_TYPE_GOTO_PREFIXES } from "../objects/roomTypeGotoPrefixes";
|
|
|
10
10
|
import { STAGE_TYPE_SUFFIXES } from "../objects/stageTypeSuffixes";
|
|
11
11
|
import { STAGE_TYPE_TO_LETTER } from "../objects/stageTypeToLetter";
|
|
12
12
|
import { asLevelStage, asNumber } from "./types";
|
|
13
|
+
import { inRange } from "./utils";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Helper function that calculates what the stage type should be for the provided stage. This
|
|
@@ -76,7 +77,7 @@ export function calculateStageTypeRepentance(stage: LevelStage): StageType {
|
|
|
76
77
|
* the third level of the run, but the game considers it to have a stage of 2. This function will
|
|
77
78
|
* consider Downpour 2 to have a stage of 3.
|
|
78
79
|
*/
|
|
79
|
-
export function getEffectiveStage():
|
|
80
|
+
export function getEffectiveStage(): LevelStage {
|
|
80
81
|
const level = game.GetLevel();
|
|
81
82
|
const stage = level.GetStage();
|
|
82
83
|
|
|
@@ -223,7 +224,7 @@ export function onFirstFloor(): boolean {
|
|
|
223
224
|
const effectiveStage = getEffectiveStage();
|
|
224
225
|
const isOnAscent = onAscent();
|
|
225
226
|
|
|
226
|
-
return effectiveStage ===
|
|
227
|
+
return effectiveStage === LevelStage.BASEMENT_1 && !isOnAscent;
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
/**
|
|
@@ -247,6 +248,17 @@ export function onSheol(): boolean {
|
|
|
247
248
|
);
|
|
248
249
|
}
|
|
249
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Helper function to check if the current stage is one that has the possibility to grant a natural
|
|
253
|
+
* Devil Room or Angel Room after killing the boss.
|
|
254
|
+
*/
|
|
255
|
+
export function onStageWithNaturalDevilRoom(): boolean {
|
|
256
|
+
const effectiveStage = getEffectiveStage();
|
|
257
|
+
return (
|
|
258
|
+
inRange(effectiveStage, 2, 8) && effectiveStage !== LevelStage.BLUE_WOMB
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
250
262
|
/**
|
|
251
263
|
* Helper function to warp to a new stage/level.
|
|
252
264
|
*
|
package/src/functions/utils.ts
CHANGED
|
@@ -72,32 +72,16 @@ export function iRange(start: int, end?: int, increment = 1): int[] {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
* Helper function to check if a variable is within a certain range,
|
|
76
|
-
* "e" stands for exclusive.)
|
|
75
|
+
* Helper function to check if a variable is within a certain range, inclusive on both ends.
|
|
77
76
|
*
|
|
78
|
-
* - For example, `
|
|
79
|
-
* - For example, `
|
|
77
|
+
* - For example, `inRange(1, 1, 3)` will return `true`.
|
|
78
|
+
* - For example, `inRange(0, 1, 3)` will return `false`.
|
|
80
79
|
*
|
|
81
80
|
* @param num The number to check.
|
|
82
81
|
* @param start The start of the range to check.
|
|
83
82
|
* @param end The end of the range to check.
|
|
84
83
|
*/
|
|
85
|
-
export function
|
|
86
|
-
return num > start && num < end;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Helper function to check if a variable is within a certain range, inclusive on both ends. (The
|
|
91
|
-
* "i" stands for inclusive.)
|
|
92
|
-
*
|
|
93
|
-
* - For example, `inIRange(1, 1, 3)` will return `true`.
|
|
94
|
-
* - For example, `inIRange(0, 1, 3)` will return `false`.
|
|
95
|
-
*
|
|
96
|
-
* @param num The number to check.
|
|
97
|
-
* @param start The start of the range to check.
|
|
98
|
-
* @param end The end of the range to check.
|
|
99
|
-
*/
|
|
100
|
-
export function inIRange(num: int, start: int, end: int): boolean {
|
|
84
|
+
export function inRange(num: int, start: int, end: int): boolean {
|
|
101
85
|
return num >= start && num <= end;
|
|
102
86
|
}
|
|
103
87
|
|