isaacscript-common 71.1.0 → 71.2.0

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.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -55086,6 +55086,8 @@ end
55086
55086
  return ____exports
55087
55087
  end,
55088
55088
  ["src.functions.curses"] = function(...)
55089
+ local ____lualib = require("lualib_bundle")
55090
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
55089
55091
  local ____exports = {}
55090
55092
  local ____cachedClasses = require("src.core.cachedClasses")
55091
55093
  local game = ____cachedClasses.game
@@ -55098,10 +55100,14 @@ function ____exports.getCurseIDByName(self, name)
55098
55100
  end
55099
55101
  return 1 << curseID - 1
55100
55102
  end
55101
- function ____exports.hasCurse(self, curse)
55103
+ function ____exports.hasCurse(self, ...)
55104
+ local curses = {...}
55102
55105
  local level = game:GetLevel()
55103
- local curses = level:GetCurses()
55104
- return hasFlag(nil, curses, curse)
55106
+ local levelCurses = level:GetCurses()
55107
+ return __TS__ArraySome(
55108
+ curses,
55109
+ function(____, curse) return hasFlag(nil, levelCurses, curse) end
55110
+ )
55105
55111
  end
55106
55112
  return ____exports
55107
55113
  end,
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "71.1.0",
3
+ "version": "71.2.0",
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
  }