isaacscript-common 71.1.0 → 71.2.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.
@@ -3749,8 +3749,8 @@ declare class DisableInputs extends Feature {
3749
3749
  /**
3750
3750
  * Helper function to disable specific inputs, like opening the console.
3751
3751
  *
3752
- * This function is variadic, meaning that you can pass as many inputs as you want to disable. (To
3753
- * disable all inputs, see the `disableAllInputs` function.
3752
+ * This function is variadic, meaning that you can specify as many inputs as you want to disable.
3753
+ * (To disable all inputs, see the `disableAllInputs` function.
3754
3754
  *
3755
3755
  * Use the `enableAllInputs` helper function to set things back to normal.
3756
3756
  *
@@ -8082,7 +8082,15 @@ export declare function hasCollectible(player: EntityPlayer, ...collectibleTypes
8082
8082
  */
8083
8083
  export declare function hasCollectibleInActiveSlot(player: EntityPlayer, collectibleType: CollectibleType, ...activeSlots: ActiveSlot[]): boolean;
8084
8084
 
8085
- export declare function hasCurse(curse: LevelCurse): boolean;
8085
+ /**
8086
+ * Helper function to check if the current floor has a particular curse.
8087
+ *
8088
+ * This function is variadic, meaning that you can specify as many curses as you want. The function
8089
+ * will return true if the level has one or more of the curses.
8090
+ *
8091
+ * Under the hood, this function uses the `Level.GetCurses` method.
8092
+ */
8093
+ export declare function hasCurse(...curses: LevelCurse[]): boolean;
8086
8094
 
8087
8095
  /**
8088
8096
  * Helper function to check if the current room has one or more doors that lead to the given room
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 71.1.0
3
+ isaacscript-common 71.2.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -42173,6 +42173,32 @@ function RunNextRoom.prototype.runNextRoom(self, func)
42173
42173
  ____v_run_queuedFunctions_0[#____v_run_queuedFunctions_0 + 1] = func
42174
42174
  end
42175
42175
  __TS__DecorateLegacy({Exported}, RunNextRoom.prototype, "runNextRoom", true)
42176
+ return ____exports
42177
+ end,
42178
+ ["src.functions.curses"] = function(...)
42179
+ local ____lualib = require("lualib_bundle")
42180
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
42181
+ local ____exports = {}
42182
+ local ____cachedClasses = require("src.core.cachedClasses")
42183
+ local game = ____cachedClasses.game
42184
+ local ____flag = require("src.functions.flag")
42185
+ local hasFlag = ____flag.hasFlag
42186
+ function ____exports.getCurseIDByName(self, name)
42187
+ local curseID = Isaac.GetCurseIdByName(name)
42188
+ if curseID == -1 then
42189
+ error(("Failed to get the curse ID corresponding to the curse name of \"" .. tostring(curseID)) .. "\". Does this name match what you put in the \"content/curses.xml\" file?")
42190
+ end
42191
+ return 1 << curseID - 1
42192
+ end
42193
+ function ____exports.hasCurse(self, ...)
42194
+ local curses = {...}
42195
+ local level = game:GetLevel()
42196
+ local levelCurses = level:GetCurses()
42197
+ return __TS__ArraySome(
42198
+ curses,
42199
+ function(____, curse) return hasFlag(nil, levelCurses, curse) end
42200
+ )
42201
+ end
42176
42202
  return ____exports
42177
42203
  end,
42178
42204
  ["src.functions.nextStage"] = function(...)
@@ -42180,10 +42206,13 @@ local ____exports = {}
42180
42206
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
42181
42207
  local GameStateFlag = ____isaac_2Dtypescript_2Ddefinitions.GameStateFlag
42182
42208
  local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
42209
+ local LevelCurse = ____isaac_2Dtypescript_2Ddefinitions.LevelCurse
42183
42210
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
42184
42211
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
42185
42212
  local ____cachedClasses = require("src.core.cachedClasses")
42186
42213
  local game = ____cachedClasses.game
42214
+ local ____curses = require("src.functions.curses")
42215
+ local hasCurse = ____curses.hasCurse
42187
42216
  local ____roomData = require("src.functions.roomData")
42188
42217
  local getRoomGridIndex = ____roomData.getRoomGridIndex
42189
42218
  local ____stage = require("src.functions.stage")
@@ -42223,7 +42252,7 @@ function ____exports.getNextStage(self)
42223
42252
  if repentanceStage then
42224
42253
  return asNumber(nil, stage) + 1
42225
42254
  end
42226
- if stage == LevelStage.DEPTHS_2 then
42255
+ if stage == LevelStage.DEPTHS_2 or stage == LevelStage.DEPTHS_1 and hasCurse(nil, LevelCurse.LABYRINTH) then
42227
42256
  return LevelStage.DEPTHS_2
42228
42257
  end
42229
42258
  return stage
@@ -55083,26 +55112,6 @@ function ____exports.renderChargeBar(self, sprites, position, normalCharges, bat
55083
55112
  sprites.meterBattery:Render(position, batteryChargesClamp)
55084
55113
  sprites.lines:Render(position)
55085
55114
  end
55086
- return ____exports
55087
- end,
55088
- ["src.functions.curses"] = function(...)
55089
- local ____exports = {}
55090
- local ____cachedClasses = require("src.core.cachedClasses")
55091
- local game = ____cachedClasses.game
55092
- local ____flag = require("src.functions.flag")
55093
- local hasFlag = ____flag.hasFlag
55094
- function ____exports.getCurseIDByName(self, name)
55095
- local curseID = Isaac.GetCurseIdByName(name)
55096
- if curseID == -1 then
55097
- error(("Failed to get the curse ID corresponding to the curse name of \"" .. tostring(curseID)) .. "\". Does this name match what you put in the \"content/curses.xml\" file?")
55098
- end
55099
- return 1 << curseID - 1
55100
- end
55101
- function ____exports.hasCurse(self, curse)
55102
- local level = game:GetLevel()
55103
- local curses = level:GetCurses()
55104
- return hasFlag(nil, curses, curse)
55105
- end
55106
55115
  return ____exports
55107
55116
  end,
55108
55117
  ["src.functions.decorators"] = function(...)
@@ -27,8 +27,8 @@ export declare class DisableInputs extends Feature {
27
27
  /**
28
28
  * Helper function to disable specific inputs, like opening the console.
29
29
  *
30
- * This function is variadic, meaning that you can pass as many inputs as you want to disable. (To
31
- * disable all inputs, see the `disableAllInputs` function.
30
+ * This function is variadic, meaning that you can specify as many inputs as you want to disable.
31
+ * (To disable all inputs, see the `disableAllInputs` function.
32
32
  *
33
33
  * Use the `enableAllInputs` helper function to set things back to normal.
34
34
  *
@@ -8,5 +8,13 @@ import type { LevelCurse } from "isaac-typescript-definitions";
8
8
  * a bit flag.
9
9
  */
10
10
  export declare function getCurseIDByName(name: string): LevelCurse;
11
- export declare function hasCurse(curse: LevelCurse): boolean;
11
+ /**
12
+ * Helper function to check if the current floor has a particular curse.
13
+ *
14
+ * This function is variadic, meaning that you can specify as many curses as you want. The function
15
+ * will return true if the level has one or more of the curses.
16
+ *
17
+ * Under the hood, this function uses the `Level.GetCurses` method.
18
+ */
19
+ export declare function hasCurse(...curses: LevelCurse[]): boolean;
12
20
  //# sourceMappingURL=curses.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"curses.d.ts","sourceRoot":"","sources":["../../../src/functions/curses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI/D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAWzD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAInD"}
1
+ {"version":3,"file":"curses.d.ts","sourceRoot":"","sources":["../../../src/functions/curses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI/D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAWzD;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAKzD"}
@@ -1,3 +1,5 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
1
3
  local ____exports = {}
2
4
  local ____cachedClasses = require("src.core.cachedClasses")
3
5
  local game = ____cachedClasses.game
@@ -16,9 +18,19 @@ function ____exports.getCurseIDByName(self, name)
16
18
  end
17
19
  return 1 << curseID - 1
18
20
  end
19
- function ____exports.hasCurse(self, curse)
21
+ --- Helper function to check if the current floor has a particular curse.
22
+ --
23
+ -- This function is variadic, meaning that you can specify as many curses as you want. The function
24
+ -- will return true if the level has one or more of the curses.
25
+ --
26
+ -- Under the hood, this function uses the `Level.GetCurses` method.
27
+ function ____exports.hasCurse(self, ...)
28
+ local curses = {...}
20
29
  local level = game:GetLevel()
21
- local curses = level:GetCurses()
22
- return hasFlag(nil, curses, curse)
30
+ local levelCurses = level:GetCurses()
31
+ return __TS__ArraySome(
32
+ curses,
33
+ function(____, curse) return hasFlag(nil, levelCurses, curse) end
34
+ )
23
35
  end
24
36
  return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"nextStage.d.ts","sourceRoot":"","sources":["../../../src/functions/nextStage.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,SAAS,EACV,MAAM,8BAA8B,CAAC;AAUtC;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,UAAU,CAyFzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,UAAQ,GAAG,SAAS,CAiF3D"}
1
+ {"version":3,"file":"nextStage.d.ts","sourceRoot":"","sources":["../../../src/functions/nextStage.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EACV,SAAS,EACV,MAAM,8BAA8B,CAAC;AAWtC;;;;;;;GAOG;AACH,wBAAgB,YAAY,IAAI,UAAU,CA4FzC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,UAAQ,GAAG,SAAS,CAiF3D"}
@@ -2,10 +2,13 @@ local ____exports = {}
2
2
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
3
  local GameStateFlag = ____isaac_2Dtypescript_2Ddefinitions.GameStateFlag
4
4
  local GridRoom = ____isaac_2Dtypescript_2Ddefinitions.GridRoom
5
+ local LevelCurse = ____isaac_2Dtypescript_2Ddefinitions.LevelCurse
5
6
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
6
7
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
7
8
  local ____cachedClasses = require("src.core.cachedClasses")
8
9
  local game = ____cachedClasses.game
10
+ local ____curses = require("src.functions.curses")
11
+ local hasCurse = ____curses.hasCurse
9
12
  local ____roomData = require("src.functions.roomData")
10
13
  local getRoomGridIndex = ____roomData.getRoomGridIndex
11
14
  local ____stage = require("src.functions.stage")
@@ -51,7 +54,7 @@ function ____exports.getNextStage(self)
51
54
  if repentanceStage then
52
55
  return asNumber(nil, stage) + 1
53
56
  end
54
- if stage == LevelStage.DEPTHS_2 then
57
+ if stage == LevelStage.DEPTHS_2 or stage == LevelStage.DEPTHS_1 and hasCurse(nil, LevelCurse.LABYRINTH) then
55
58
  return LevelStage.DEPTHS_2
56
59
  end
57
60
  return stage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "71.1.0",
3
+ "version": "71.2.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -146,8 +146,8 @@ export class DisableInputs extends Feature {
146
146
  /**
147
147
  * Helper function to disable specific inputs, like opening the console.
148
148
  *
149
- * This function is variadic, meaning that you can pass as many inputs as you want to disable. (To
150
- * disable all inputs, see the `disableAllInputs` function.
149
+ * This function is variadic, meaning that you can specify as many inputs as you want to disable.
150
+ * (To disable all inputs, see the `disableAllInputs` function.
151
151
  *
152
152
  * Use the `enableAllInputs` helper function to set things back to normal.
153
153
  *
@@ -23,8 +23,17 @@ export function getCurseIDByName(name: string): LevelCurse {
23
23
  return (1 << (curseID - 1)) as LevelCurse;
24
24
  }
25
25
 
26
- export function hasCurse(curse: LevelCurse): boolean {
26
+ /**
27
+ * Helper function to check if the current floor has a particular curse.
28
+ *
29
+ * This function is variadic, meaning that you can specify as many curses as you want. The function
30
+ * will return true if the level has one or more of the curses.
31
+ *
32
+ * Under the hood, this function uses the `Level.GetCurses` method.
33
+ */
34
+ export function hasCurse(...curses: LevelCurse[]): boolean {
27
35
  const level = game.GetLevel();
28
- const curses = level.GetCurses();
29
- return hasFlag(curses, curse);
36
+ const levelCurses = level.GetCurses();
37
+
38
+ return curses.some((curse) => hasFlag(levelCurses, curse));
30
39
  }
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  GameStateFlag,
3
3
  GridRoom,
4
+ LevelCurse,
4
5
  LevelStage,
5
6
  StageType,
6
7
  } from "isaac-typescript-definitions";
7
8
  import { game } from "../core/cachedClasses";
9
+ import { hasCurse } from "./curses";
8
10
  import { getRoomGridIndex } from "./roomData";
9
11
  import {
10
12
  calculateStageType,
@@ -56,7 +58,10 @@ export function getNextStage(): LevelStage {
56
58
  return asNumber(stage) + 1;
57
59
  }
58
60
 
59
- if (stage === LevelStage.DEPTHS_2) {
61
+ if (
62
+ stage === LevelStage.DEPTHS_2 ||
63
+ (stage === LevelStage.DEPTHS_1 && hasCurse(LevelCurse.LABYRINTH))
64
+ ) {
60
65
  // From Depths 2 to Mausoleum 2 through the strange door.
61
66
  return LevelStage.DEPTHS_2;
62
67
  }