isaacscript-common 72.0.0 → 72.1.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.
@@ -1057,8 +1057,10 @@ export declare function anyPlayerIs(...matchingCharacters: PlayerType[]): boolea
1057
1057
 
1058
1058
  /**
1059
1059
  * Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
1060
+ *
1061
+ * @param exceptions Optional. An array of seed effects to ignore.
1060
1062
  */
1061
- export declare function anySeedEffectEnabled(): boolean;
1063
+ export declare function anySeedEffectEnabled(exceptions?: SeedEffect[]): boolean;
1062
1064
 
1063
1065
  declare type Arr<N extends number, T extends unknown[] = []> = T["length"] extends N ? T : Arr<N, [...T, unknown]>;
1064
1066
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 72.0.0
3
+ isaacscript-common 72.1.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -21890,6 +21890,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescri
21890
21890
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
21891
21891
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
21892
21892
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
21893
+ local ____frames = require("src.functions.frames")
21894
+ local isAfterRoomFrame = ____frames.isAfterRoomFrame
21893
21895
  local ____playerDataStructures = require("src.functions.playerDataStructures")
21894
21896
  local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
21895
21897
  local mapSetPlayer = ____playerDataStructures.mapSetPlayer
@@ -21913,7 +21915,7 @@ function PostHolyMantleRemoved.prototype.____constructor(self)
21913
21915
  local newNumHolyMantles = effects:GetCollectibleEffectNum(CollectibleType.HOLY_MANTLE)
21914
21916
  local oldNumHolyMantles = defaultMapGetPlayer(nil, v.run.playersHolyMantleMap, player)
21915
21917
  mapSetPlayer(nil, v.run.playersHolyMantleMap, player, newNumHolyMantles)
21916
- if newNumHolyMantles < oldNumHolyMantles then
21918
+ if newNumHolyMantles < oldNumHolyMantles and isAfterRoomFrame(nil, 0) then
21917
21919
  self:fire(player, oldNumHolyMantles, newNumHolyMantles)
21918
21920
  end
21919
21921
  end
@@ -34949,6 +34951,9 @@ return ____exports
34949
34951
  end,
34950
34952
  ["src.functions.run"] = function(...)
34951
34953
  local ____lualib = require("lualib_bundle")
34954
+ local Set = ____lualib.Set
34955
+ local __TS__New = ____lualib.__TS__New
34956
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
34952
34957
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
34953
34958
  local ____exports = {}
34954
34959
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
@@ -34971,10 +34976,17 @@ local ____log = require("src.functions.log")
34971
34976
  local log = ____log.log
34972
34977
  local ____types = require("src.functions.types")
34973
34978
  local isString = ____types.isString
34974
- function ____exports.anySeedEffectEnabled(self)
34979
+ function ____exports.anySeedEffectEnabled(self, exceptions)
34975
34980
  local seeds = game:GetSeeds()
34976
- local numSeedEffects = seeds:CountSeedEffects()
34977
- return numSeedEffects > 0
34981
+ if exceptions == nil then
34982
+ local numSeedEffects = seeds:CountSeedEffects()
34983
+ return numSeedEffects > 0
34984
+ end
34985
+ local exceptionsSet = __TS__New(Set, exceptions)
34986
+ return __TS__ArraySome(
34987
+ SEED_EFFECTS,
34988
+ function(____, seedEffect) return seeds:HasSeedEffect(seedEffect) and not exceptionsSet:has(seedEffect) end
34989
+ )
34978
34990
  end
34979
34991
  function ____exports.anyEasterEggEnabled(self)
34980
34992
  return ____exports.anySeedEffectEnabled(nil)
@@ -1 +1 @@
1
- {"version":3,"file":"PostHolyMantleRemoved.d.ts","sourceRoot":"","sources":["../../../../src/classes/callbacks/PostHolyMantleRemoved.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAKlE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQ3D,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,iBAAiB,CAAC,wBAAwB,CAAC;IACnF,CAAC;;;;MAAK;;IAatB,UAAmB,UAAU,0BAAoB;IAGjD,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAgBzC;CACH"}
1
+ {"version":3,"file":"PostHolyMantleRemoved.d.ts","sourceRoot":"","sources":["../../../../src/classes/callbacks/PostHolyMantleRemoved.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAMlE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAQ3D,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,iBAAiB,CAAC,wBAAwB,CAAC;IACnF,CAAC;;;;MAAK;;IAatB,UAAmB,UAAU,0BAAoB;IAGjD,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAoBzC;CACH"}
@@ -7,6 +7,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
7
7
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
8
8
  local ____ModCallbackCustom = require("src.enums.ModCallbackCustom")
9
9
  local ModCallbackCustom = ____ModCallbackCustom.ModCallbackCustom
10
+ local ____frames = require("src.functions.frames")
11
+ local isAfterRoomFrame = ____frames.isAfterRoomFrame
10
12
  local ____playerDataStructures = require("src.functions.playerDataStructures")
11
13
  local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
12
14
  local mapSetPlayer = ____playerDataStructures.mapSetPlayer
@@ -30,7 +32,7 @@ function PostHolyMantleRemoved.prototype.____constructor(self)
30
32
  local newNumHolyMantles = effects:GetCollectibleEffectNum(CollectibleType.HOLY_MANTLE)
31
33
  local oldNumHolyMantles = defaultMapGetPlayer(nil, v.run.playersHolyMantleMap, player)
32
34
  mapSetPlayer(nil, v.run.playersHolyMantleMap, player, newNumHolyMantles)
33
- if newNumHolyMantles < oldNumHolyMantles then
35
+ if newNumHolyMantles < oldNumHolyMantles and isAfterRoomFrame(nil, 0) then
34
36
  self:fire(player, oldNumHolyMantles, newNumHolyMantles)
35
37
  end
36
38
  end
@@ -4,8 +4,10 @@ import { SeedEffect } from "isaac-typescript-definitions";
4
4
  export declare function anyEasterEggEnabled(): boolean;
5
5
  /**
6
6
  * Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
7
+ *
8
+ * @param exceptions Optional. An array of seed effects to ignore.
7
9
  */
8
- export declare function anySeedEffectEnabled(): boolean;
10
+ export declare function anySeedEffectEnabled(exceptions?: SeedEffect[]): boolean;
9
11
  /**
10
12
  * Helper function to see if the current run can unlock achievements. For example, if playing on a
11
13
  * set seed or in a victory lap, achievements are disabled.
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAEL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAUtC,qDAAqD;AACrD,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAK9C;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAUlD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,UAAU,EAAE,CAO7C;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAGtC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAkBpD;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,0BAA0B,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAQ1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/functions/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAEL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAUtC,qDAAqD;AACrD,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,GAAG,OAAO,CAavE;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAUlD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,UAAU,EAAE,CAO7C;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAMnC;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAGtC;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI,CAkBpD;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,0BAA0B,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAQ1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAUlC"}
@@ -1,4 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
4
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
2
5
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
3
6
  local ____exports = {}
4
7
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
@@ -22,10 +25,19 @@ local log = ____log.log
22
25
  local ____types = require("src.functions.types")
23
26
  local isString = ____types.isString
24
27
  --- Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
25
- function ____exports.anySeedEffectEnabled(self)
28
+ --
29
+ -- @param exceptions Optional. An array of seed effects to ignore.
30
+ function ____exports.anySeedEffectEnabled(self, exceptions)
26
31
  local seeds = game:GetSeeds()
27
- local numSeedEffects = seeds:CountSeedEffects()
28
- return numSeedEffects > 0
32
+ if exceptions == nil then
33
+ local numSeedEffects = seeds:CountSeedEffects()
34
+ return numSeedEffects > 0
35
+ end
36
+ local exceptionsSet = __TS__New(Set, exceptions)
37
+ return __TS__ArraySome(
38
+ SEED_EFFECTS,
39
+ function(____, seedEffect) return seeds:HasSeedEffect(seedEffect) and not exceptionsSet:has(seedEffect) end
40
+ )
29
41
  end
30
42
  --- Alias for the `anySeedEffectEnabled` function.
31
43
  function ____exports.anyEasterEggEnabled(self)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "72.0.0",
3
+ "version": "72.1.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,5 +1,6 @@
1
1
  import { CollectibleType } from "isaac-typescript-definitions";
2
2
  import { ModCallbackCustom } from "../../enums/ModCallbackCustom";
3
+ import { isAfterRoomFrame } from "../../functions/frames";
3
4
  import {
4
5
  defaultMapGetPlayer,
5
6
  mapSetPlayer,
@@ -45,7 +46,11 @@ export class PostHolyMantleRemoved extends CustomCallback<ModCallbackCustom.POST
45
46
  );
46
47
  mapSetPlayer(v.run.playersHolyMantleMap, player, newNumHolyMantles);
47
48
 
48
- if (newNumHolyMantles < oldNumHolyMantles) {
49
+ // We check for being after room frame 0 to prevent the callback from firing when the player
50
+ // loses a lost curse from a white fire. (In this case, the player will have a Holy Mantle
51
+ // effect from the lost curse, and then when losing the curse, they will also lose the Holy
52
+ // Mantle.)
53
+ if (newNumHolyMantles < oldNumHolyMantles && isAfterRoomFrame(0)) {
49
54
  this.fire(player, oldNumHolyMantles, newNumHolyMantles);
50
55
  }
51
56
  };
@@ -20,12 +20,22 @@ export function anyEasterEggEnabled(): boolean {
20
20
 
21
21
  /**
22
22
  * Helper function to see if any seed effects (i.e. Easter Eggs) are enabled for the current run.
23
+ *
24
+ * @param exceptions Optional. An array of seed effects to ignore.
23
25
  */
24
- export function anySeedEffectEnabled(): boolean {
26
+ export function anySeedEffectEnabled(exceptions?: SeedEffect[]): boolean {
25
27
  const seeds = game.GetSeeds();
26
- const numSeedEffects = seeds.CountSeedEffects();
27
28
 
28
- return numSeedEffects > 0;
29
+ if (exceptions === undefined) {
30
+ const numSeedEffects = seeds.CountSeedEffects();
31
+ return numSeedEffects > 0;
32
+ }
33
+
34
+ const exceptionsSet = new Set(exceptions);
35
+ return SEED_EFFECTS.some(
36
+ (seedEffect) =>
37
+ seeds.HasSeedEffect(seedEffect) && !exceptionsSet.has(seedEffect),
38
+ );
29
39
  }
30
40
 
31
41
  /**