isaacscript-common 59.1.0 → 59.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.
@@ -12,7 +12,7 @@ import { ButtonAction } from 'isaac-typescript-definitions';
12
12
  import { CacheFlag } from 'isaac-typescript-definitions';
13
13
  import { CallbackPriority } from 'isaac-typescript-definitions/dist/src/enums/CallbackPriority';
14
14
  import { CardType } from 'isaac-typescript-definitions';
15
- import type { Challenge } from 'isaac-typescript-definitions';
15
+ import { Challenge } from 'isaac-typescript-definitions';
16
16
  import type { CoinSubType } from 'isaac-typescript-definitions';
17
17
  import type { CollectiblePedestalType } from 'isaac-typescript-definitions';
18
18
  import { CollectibleType } from 'isaac-typescript-definitions';
@@ -14326,6 +14326,9 @@ export declare const NUM_VANILLA_PILL_EFFECTS: int;
14326
14326
  /** Calculated from the `TrinketType` enum. (`TrinketType.NULL` is not included.) */
14327
14327
  export declare const NUM_VANILLA_TRINKET_TYPES: number;
14328
14328
 
14329
+ /** Helper function to see if the player is playing any challenge. */
14330
+ export declare function onAnyChallenge(): boolean;
14331
+
14329
14332
  /**
14330
14333
  * Helper function to check if the player has taken Dad's Note. This sets the game state flag of
14331
14334
  * `GameStateFlag.BACKWARDS_PATH` and causes floor generation to change.
@@ -14334,6 +14337,14 @@ export declare function onAscent(): boolean;
14334
14337
 
14335
14338
  export declare function onCathedral(): boolean;
14336
14339
 
14340
+ /**
14341
+ * Helper function to check to see if the player is playing a particular challenge.
14342
+ *
14343
+ * This function is variadic, meaning that you can specify as many challenges as you want to check
14344
+ * for.
14345
+ */
14346
+ export declare function onChallenge(...challenges: Challenge[]): boolean;
14347
+
14337
14348
  export declare function onChest(): boolean;
14338
14349
 
14339
14350
  export declare function onDarkRoom(): boolean;
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 59.1.0
3
+ isaacscript-common 59.2.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -54614,7 +54614,11 @@ ____exports.CHALLENGE_NAMES = {
54614
54614
  return ____exports
54615
54615
  end,
54616
54616
  ["src.functions.challenges"] = function(...)
54617
+ local ____lualib = require("lualib_bundle")
54618
+ local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
54617
54619
  local ____exports = {}
54620
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
54621
+ local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
54618
54622
  local ____challengeBosses = require("src.objects.challengeBosses")
54619
54623
  local CHALLENGE_BOSSES = ____challengeBosses.CHALLENGE_BOSSES
54620
54624
  local DEFAULT_CHALLENGE_BOSS_ID = ____challengeBosses.DEFAULT_CHALLENGE_BOSS_ID
@@ -54636,6 +54640,15 @@ function ____exports.getChallengeName(self, challenge)
54636
54640
  local challengeName = CHALLENGE_NAMES[challenge]
54637
54641
  return challengeName or DEFAULT_CHALLENGE_NAME
54638
54642
  end
54643
+ function ____exports.onAnyChallenge(self)
54644
+ local challenge = Isaac.GetChallenge()
54645
+ return challenge ~= Challenge.NULL
54646
+ end
54647
+ function ____exports.onChallenge(self, ...)
54648
+ local challenges = {...}
54649
+ local challenge = Isaac.GetChallenge()
54650
+ return __TS__ArrayIncludes(challenges, challenge)
54651
+ end
54639
54652
  return ____exports
54640
54653
  end,
54641
54654
  ["src.interfaces.ChargeBarSprites"] = function(...)
@@ -1,4 +1,5 @@
1
- import type { BossID, Challenge, PlayerType } from "isaac-typescript-definitions";
1
+ import type { BossID, PlayerType } from "isaac-typescript-definitions";
2
+ import { Challenge } from "isaac-typescript-definitions";
2
3
  /**
3
4
  * Get the final boss of a challenge. This will only work for vanilla challenges.
4
5
  *
@@ -20,4 +21,13 @@ export declare function getChallengeCharacter(challenge: Challenge): PlayerType;
20
21
  * For modded challenges, "Unknown" will be returned.
21
22
  */
22
23
  export declare function getChallengeName(challenge: Challenge): string;
24
+ /** Helper function to see if the player is playing any challenge. */
25
+ export declare function onAnyChallenge(): boolean;
26
+ /**
27
+ * Helper function to check to see if the player is playing a particular challenge.
28
+ *
29
+ * This function is variadic, meaning that you can specify as many challenges as you want to check
30
+ * for.
31
+ */
32
+ export declare function onChallenge(...challenges: Challenge[]): boolean;
23
33
  //# sourceMappingURL=challenges.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"challenges.d.ts","sourceRoot":"","sources":["../../../src/functions/challenges.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,SAAS,EACT,UAAU,EACX,MAAM,8BAA8B,CAAC;AActC;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAK7D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,CAKtE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAK7D"}
1
+ {"version":3,"file":"challenges.d.ts","sourceRoot":"","sources":["../../../src/functions/challenges.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAczD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAK7D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,CAKtE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAK7D;AAED,qEAAqE;AACrE,wBAAgB,cAAc,IAAI,OAAO,CAGxC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO,CAG/D"}
@@ -1,4 +1,8 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__ArrayIncludes = ____lualib.__TS__ArrayIncludes
1
3
  local ____exports = {}
4
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
5
+ local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
2
6
  local ____challengeBosses = require("src.objects.challengeBosses")
3
7
  local CHALLENGE_BOSSES = ____challengeBosses.CHALLENGE_BOSSES
4
8
  local DEFAULT_CHALLENGE_BOSS_ID = ____challengeBosses.DEFAULT_CHALLENGE_BOSS_ID
@@ -32,4 +36,18 @@ function ____exports.getChallengeName(self, challenge)
32
36
  local challengeName = CHALLENGE_NAMES[challenge]
33
37
  return challengeName or DEFAULT_CHALLENGE_NAME
34
38
  end
39
+ --- Helper function to see if the player is playing any challenge.
40
+ function ____exports.onAnyChallenge(self)
41
+ local challenge = Isaac.GetChallenge()
42
+ return challenge ~= Challenge.NULL
43
+ end
44
+ --- Helper function to check to see if the player is playing a particular challenge.
45
+ --
46
+ -- This function is variadic, meaning that you can specify as many challenges as you want to check
47
+ -- for.
48
+ function ____exports.onChallenge(self, ...)
49
+ local challenges = {...}
50
+ local challenge = Isaac.GetChallenge()
51
+ return __TS__ArrayIncludes(challenges, challenge)
52
+ end
35
53
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "59.1.0",
3
+ "version": "59.2.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,8 +1,5 @@
1
- import type {
2
- BossID,
3
- Challenge,
4
- PlayerType,
5
- } from "isaac-typescript-definitions";
1
+ import type { BossID, PlayerType } from "isaac-typescript-definitions";
2
+ import { Challenge } from "isaac-typescript-definitions";
6
3
  import {
7
4
  CHALLENGE_BOSSES,
8
5
  DEFAULT_CHALLENGE_BOSS_ID,
@@ -54,3 +51,20 @@ export function getChallengeName(challenge: Challenge): string {
54
51
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
55
52
  return challengeName ?? DEFAULT_CHALLENGE_NAME;
56
53
  }
54
+
55
+ /** Helper function to see if the player is playing any challenge. */
56
+ export function onAnyChallenge(): boolean {
57
+ const challenge = Isaac.GetChallenge();
58
+ return challenge !== Challenge.NULL;
59
+ }
60
+
61
+ /**
62
+ * Helper function to check to see if the player is playing a particular challenge.
63
+ *
64
+ * This function is variadic, meaning that you can specify as many challenges as you want to check
65
+ * for.
66
+ */
67
+ export function onChallenge(...challenges: Challenge[]): boolean {
68
+ const challenge = Isaac.GetChallenge();
69
+ return challenges.includes(challenge);
70
+ }