isaacscript-common 8.4.6 → 8.5.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.
Files changed (63) hide show
  1. package/dist/features/characterStats.d.ts.map +1 -1
  2. package/dist/features/characterStats.lua +1 -2
  3. package/dist/features/firstLast.d.ts +6 -3
  4. package/dist/features/firstLast.d.ts.map +1 -1
  5. package/dist/features/firstLast.lua +6 -3
  6. package/dist/functions/bosses.d.ts +5 -2
  7. package/dist/functions/bosses.d.ts.map +1 -1
  8. package/dist/functions/bosses.lua +11 -6
  9. package/dist/functions/collectibleCacheFlag.d.ts +1 -1
  10. package/dist/functions/collectibleCacheFlag.d.ts.map +1 -1
  11. package/dist/functions/collectibleCacheFlag.lua +1 -2
  12. package/dist/functions/collectibleSet.lua +32 -32
  13. package/dist/functions/collectibleTag.d.ts +1 -1
  14. package/dist/functions/collectibleTag.d.ts.map +1 -1
  15. package/dist/functions/collectibleTag.lua +1 -3
  16. package/dist/functions/eden.d.ts +1 -1
  17. package/dist/functions/eden.d.ts.map +1 -1
  18. package/dist/functions/eden.lua +1 -2
  19. package/dist/functions/flying.d.ts +1 -1
  20. package/dist/functions/flying.d.ts.map +1 -1
  21. package/dist/functions/flying.lua +5 -2
  22. package/dist/functions/input.d.ts +2 -2
  23. package/dist/functions/input.d.ts.map +1 -1
  24. package/dist/functions/input.lua +2 -4
  25. package/dist/functions/playerHealth.d.ts +93 -0
  26. package/dist/functions/playerHealth.d.ts.map +1 -1
  27. package/dist/functions/playerHealth.lua +216 -33
  28. package/dist/functions/players.d.ts +1 -111
  29. package/dist/functions/players.d.ts.map +1 -1
  30. package/dist/functions/players.lua +20 -279
  31. package/dist/functions/revive.d.ts.map +1 -1
  32. package/dist/functions/revive.lua +2 -1
  33. package/dist/functions/stats.d.ts +16 -0
  34. package/dist/functions/stats.d.ts.map +1 -1
  35. package/dist/functions/stats.lua +78 -0
  36. package/dist/functions/transformations.d.ts +1 -1
  37. package/dist/functions/transformations.d.ts.map +1 -1
  38. package/dist/functions/trinketCacheFlag.d.ts +1 -1
  39. package/dist/functions/trinketCacheFlag.d.ts.map +1 -1
  40. package/dist/functions/trinketCacheFlag.lua +1 -3
  41. package/dist/functions/trinketSet.lua +32 -32
  42. package/dist/index.d.ts +19 -30
  43. package/dist/sets/bossSets.d.ts +1 -0
  44. package/dist/sets/bossSets.d.ts.map +1 -1
  45. package/dist/sets/bossSets.lua +19 -0
  46. package/package.json +1 -1
  47. package/src/features/characterStats.ts +1 -2
  48. package/src/features/firstLast.ts +6 -3
  49. package/src/functions/bosses.ts +15 -6
  50. package/src/functions/collectibleCacheFlag.ts +3 -3
  51. package/src/functions/collectibleSet.ts +32 -32
  52. package/src/functions/collectibleTag.ts +2 -3
  53. package/src/functions/eden.ts +3 -3
  54. package/src/functions/flying.ts +4 -4
  55. package/src/functions/input.ts +4 -5
  56. package/src/functions/playerHealth.ts +269 -7
  57. package/src/functions/players.ts +1 -348
  58. package/src/functions/revive.ts +2 -6
  59. package/src/functions/stats.ts +75 -0
  60. package/src/functions/transformations.ts +1 -1
  61. package/src/functions/trinketCacheFlag.ts +2 -3
  62. package/src/functions/trinketSet.ts +32 -32
  63. package/src/sets/bossSets.ts +24 -0
@@ -8,42 +8,42 @@ local ____firstLast = require("features.firstLast")
8
8
  local getModdedTrinketTypes = ____firstLast.getModdedTrinketTypes
9
9
  local ____trinkets = require("functions.trinkets")
10
10
  local getVanillaTrinketTypes = ____trinkets.getVanillaTrinketTypes
11
- local ALL_TRINKETS_ARRAY = {}
12
- local ALL_TRINKETS_SET = __TS__New(Set)
13
- local VANILLA_TRINKETS_ARRAY = {}
14
- local VANILLA_TRINKETS_SET = __TS__New(Set)
15
- local MODDED_TRINKETS_ARRAY = {}
16
- local MODDED_TRINKETS_SET = __TS__New(Set)
17
- local function lazyInitVanillaTrinkets(self)
18
- if #VANILLA_TRINKETS_ARRAY > 0 then
11
+ local ALL_TRINKET_TYPES_ARRAY = {}
12
+ local ALL_TRINKET_TYPES_SET = __TS__New(Set)
13
+ local VANILLA_TRINKET_TYPES_ARRAY = {}
14
+ local VANILLA_TRINKET_TYPES_SET = __TS__New(Set)
15
+ local MODDED_TRINKET_TYPES_ARRAY = {}
16
+ local MODDED_TRINKET_TYPES_SET = __TS__New(Set)
17
+ local function lazyInitVanillaTrinketTypes(self)
18
+ if #VANILLA_TRINKET_TYPES_ARRAY > 0 then
19
19
  return
20
20
  end
21
21
  local vanillaTrinketTypes = getVanillaTrinketTypes(nil)
22
22
  for ____, trinketType in ipairs(vanillaTrinketTypes) do
23
23
  local itemConfigItem = itemConfig:GetTrinket(trinketType)
24
24
  if itemConfigItem ~= nil then
25
- VANILLA_TRINKETS_ARRAY[#VANILLA_TRINKETS_ARRAY + 1] = trinketType
26
- VANILLA_TRINKETS_SET:add(trinketType)
25
+ VANILLA_TRINKET_TYPES_ARRAY[#VANILLA_TRINKET_TYPES_ARRAY + 1] = trinketType
26
+ VANILLA_TRINKET_TYPES_SET:add(trinketType)
27
27
  end
28
28
  end
29
29
  end
30
- local function lazyInitModdedTrinkets(self)
31
- if #MODDED_TRINKETS_ARRAY > 0 then
30
+ local function lazyInitModdedTrinketTypes(self)
31
+ if #MODDED_TRINKET_TYPES_ARRAY > 0 then
32
32
  return
33
33
  end
34
- lazyInitVanillaTrinkets(nil)
35
- for ____, trinketType in ipairs(VANILLA_TRINKETS_ARRAY) do
36
- ALL_TRINKETS_ARRAY[#ALL_TRINKETS_ARRAY + 1] = trinketType
37
- ALL_TRINKETS_SET:add(trinketType)
34
+ lazyInitVanillaTrinketTypes(nil)
35
+ for ____, trinketType in ipairs(VANILLA_TRINKET_TYPES_ARRAY) do
36
+ ALL_TRINKET_TYPES_ARRAY[#ALL_TRINKET_TYPES_ARRAY + 1] = trinketType
37
+ ALL_TRINKET_TYPES_SET:add(trinketType)
38
38
  end
39
39
  local moddedTrinketTypes = getModdedTrinketTypes(nil)
40
40
  for ____, trinketType in ipairs(moddedTrinketTypes) do
41
41
  local itemConfigItem = itemConfig:GetTrinket(trinketType)
42
42
  if itemConfigItem ~= nil then
43
- MODDED_TRINKETS_ARRAY[#MODDED_TRINKETS_ARRAY + 1] = trinketType
44
- MODDED_TRINKETS_SET:add(trinketType)
45
- ALL_TRINKETS_ARRAY[#ALL_TRINKETS_ARRAY + 1] = trinketType
46
- ALL_TRINKETS_SET:add(trinketType)
43
+ MODDED_TRINKET_TYPES_ARRAY[#MODDED_TRINKET_TYPES_ARRAY + 1] = trinketType
44
+ MODDED_TRINKET_TYPES_SET:add(trinketType)
45
+ ALL_TRINKET_TYPES_ARRAY[#ALL_TRINKET_TYPES_ARRAY + 1] = trinketType
46
+ ALL_TRINKET_TYPES_SET:add(trinketType)
47
47
  end
48
48
  end
49
49
  end
@@ -55,8 +55,8 @@ end
55
55
  -- This function can only be called if at least one callback has been executed. This is because not
56
56
  -- all trinkets will necessarily be present when a mod first loads (due to mod load order).
57
57
  function ____exports.getModdedTrinketArray(self)
58
- lazyInitModdedTrinkets(nil)
59
- return MODDED_TRINKETS_ARRAY
58
+ lazyInitModdedTrinketTypes(nil)
59
+ return MODDED_TRINKET_TYPES_ARRAY
60
60
  end
61
61
  --- Returns a set containing every valid trinket type in the game, including modded trinkets.
62
62
  --
@@ -66,8 +66,8 @@ end
66
66
  -- This function can only be called if at least one callback has been executed. This is because not
67
67
  -- all trinkets will necessarily be present when a mod first loads (due to mod load order).
68
68
  function ____exports.getModdedTrinketSet(self)
69
- lazyInitModdedTrinkets(nil)
70
- return MODDED_TRINKETS_SET
69
+ lazyInitModdedTrinketTypes(nil)
70
+ return MODDED_TRINKET_TYPES_SET
71
71
  end
72
72
  --- Returns an array containing every modded trinket type in the game.
73
73
  --
@@ -77,8 +77,8 @@ end
77
77
  -- This function can only be called if at least one callback has been executed. This is because not
78
78
  -- all trinkets will necessarily be present when a mod first loads (due to mod load order).
79
79
  function ____exports.getTrinketArray(self)
80
- lazyInitModdedTrinkets(nil)
81
- return ALL_TRINKETS_ARRAY
80
+ lazyInitModdedTrinketTypes(nil)
81
+ return ALL_TRINKET_TYPES_ARRAY
82
82
  end
83
83
  --- Returns a set containing every modded trinket type in the game.
84
84
  --
@@ -88,23 +88,23 @@ end
88
88
  -- This function can only be called if at least one callback has been executed. This is because not
89
89
  -- all trinkets will necessarily be present when a mod first loads (due to mod load order).
90
90
  function ____exports.getTrinketSet(self)
91
- lazyInitModdedTrinkets(nil)
92
- return ALL_TRINKETS_SET
91
+ lazyInitModdedTrinketTypes(nil)
92
+ return ALL_TRINKET_TYPES_SET
93
93
  end
94
94
  --- Returns an array containing every valid vanilla trinket type in the game.
95
95
  --
96
96
  -- Use this if you need to iterate over the trinkets in order. If you need to do O(1) lookups, then
97
97
  -- use the `getVanillaTrinketSet` helper function instead.
98
98
  function ____exports.getVanillaTrinketArray(self)
99
- lazyInitVanillaTrinkets(nil)
100
- return VANILLA_TRINKETS_ARRAY
99
+ lazyInitVanillaTrinketTypes(nil)
100
+ return VANILLA_TRINKET_TYPES_ARRAY
101
101
  end
102
102
  --- Returns a set containing every valid vanilla trinket type in the game.
103
103
  --
104
104
  -- Use this if you need to do O(1) lookups. If you need to iterate over the trinkets in order, then
105
105
  -- use the `getVanillaTrinketArray` helper function instead.
106
106
  function ____exports.getVanillaTrinketSet(self)
107
- lazyInitVanillaTrinkets(nil)
108
- return VANILLA_TRINKETS_SET
107
+ lazyInitVanillaTrinketTypes(nil)
108
+ return VANILLA_TRINKET_TYPES_SET
109
109
  end
110
110
  return ____exports
package/dist/index.d.ts CHANGED
@@ -294,23 +294,6 @@ export declare function addRoomClearChargeToSlot(player: EntityPlayer, activeSlo
294
294
  */
295
295
  export declare function addSetsToSet<T>(mainSet: Set<T>, ...setsToAdd: Array<Set<T> | ReadonlySet<T>>): void;
296
296
 
297
- /**
298
- * Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
299
- * from the `EVALUATE_CACHE` callback.
300
- *
301
- * Note that for `CacheFlag.FIRE_DELAY`, the "amount" argument will be interpreted as the tear stat
302
- * to add (and not the amount to mutate `EntityPlayer.MaxFireDelay` by).
303
- *
304
- * This function supports the following cache flags:
305
- * - CacheFlag.DAMAGE (1 << 0)
306
- * - CacheFlag.FIRE_DELAY (1 << 1)
307
- * - CacheFlag.SHOT_SPEED (1 << 2)
308
- * - CacheFlag.RANGE (1 << 3)
309
- * - CacheFlag.SPEED (1 << 4)
310
- * - CacheFlag.LUCK (1 << 10)
311
- */
312
- export declare function addStat(player: EntityPlayer, cacheFlag: CacheFlag, amount: number): void;
313
-
314
297
  /**
315
298
  * - Converts the specified amount of tears stat into the format of `EntityPlayer.MaxFireDelay` and
316
299
  * adds it to the player.
@@ -2298,8 +2281,11 @@ export declare function getAliveNPCs(entityType?: EntityType, variant?: number,
2298
2281
  * The set contains strings with the entity type and variant, separated by a period.
2299
2282
  *
2300
2283
  * Also see the `getBossSet` and `getCombinedBossSet` functions.
2284
+ *
2285
+ * @param includeStoryBosses Optional. Whether to include "story" bosses like Mom and It Lives!
2286
+ * Default is true.
2301
2287
  */
2302
- export declare function getAllBossesSet(): Set<string>;
2288
+ export declare function getAllBossesSet(includeStoryBosses?: boolean): ReadonlySet<string>;
2303
2289
 
2304
2290
  /**
2305
2291
  * Helper function to get an array with every valid card sub-type. This includes modded cards.
@@ -2739,7 +2725,7 @@ export declare function getCollectibleSet(): ReadonlySet<CollectibleType>;
2739
2725
  * This function can only be called if at least one callback has been executed. This is because not
2740
2726
  * all collectibles will necessarily be present when a mod first loads (due to mod load order).
2741
2727
  */
2742
- export declare function getCollectiblesForCacheFlag(cacheFlag: CacheFlag): Set<CollectibleType>;
2728
+ export declare function getCollectiblesForCacheFlag(cacheFlag: CacheFlag): ReadonlySet<CollectibleType>;
2743
2729
 
2744
2730
  /**
2745
2731
  * Helper function to get the remaining collectibles in a given item pool. This function is
@@ -2770,7 +2756,7 @@ export declare function getCollectibleTags(collectibleType: CollectibleType): Bi
2770
2756
  * const guppyCollectibleTypes = getCollectibleTypesForTransformation(PlayerForm.GUPPY);
2771
2757
  * ```
2772
2758
  */
2773
- export declare function getCollectibleTypesForTransformation(playerForm: PlayerForm): Set<CollectibleType>;
2759
+ export declare function getCollectibleTypesForTransformation(playerForm: PlayerForm): ReadonlySet<CollectibleType>;
2774
2760
 
2775
2761
  /**
2776
2762
  * Helper function to get all of the collectible types in the game that have a certain tag.
@@ -2782,7 +2768,7 @@ export declare function getCollectibleTypesForTransformation(playerForm: PlayerF
2782
2768
  * const offensiveCollectibleTypes = getCollectibleTypesWithTag(ItemConfigTag.OFFENSIVE);
2783
2769
  * ```
2784
2770
  */
2785
- export declare function getCollectibleTypesWithTag(itemConfigTag: ItemConfigTag): Set<CollectibleType>;
2771
+ export declare function getCollectibleTypesWithTag(itemConfigTag: ItemConfigTag): ReadonlySet<CollectibleType>;
2786
2772
 
2787
2773
  /**
2788
2774
  * Gets the entities that have a hitbox that overlaps with any part of the square that the grid
@@ -2802,7 +2788,7 @@ export declare function getCollidingEntitiesWithGridEntity(gridEntity: GridEntit
2802
2788
  *
2803
2789
  * Also see the `getAllBossesSet` and `getBossSet` functions.
2804
2790
  */
2805
- export declare function getCombinedBossSet(stage: int): Set<string> | undefined;
2791
+ export declare function getCombinedBossSet(stage: int): ReadonlySet<string> | undefined;
2806
2792
 
2807
2793
  /**
2808
2794
  * Helper function to get all of the crawl spaces in the room.
@@ -2903,7 +2889,7 @@ export declare function getDoorSlotsForRoomShape(roomShape: RoomShape): Readonly
2903
2889
  */
2904
2890
  export declare function getDoorsToRoomIndex(...roomGridIndex: int[]): GridEntityDoor[];
2905
2891
 
2906
- export declare function getEdenPassives(): Set<CollectibleType>;
2892
+ export declare function getEdenPassives(): ReadonlySet<CollectibleType>;
2907
2893
 
2908
2894
  /**
2909
2895
  * Helper function to account for Repentance floors being offset by 1. For example, Downpour 2 is
@@ -3169,7 +3155,7 @@ export declare function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>>;
3169
3155
  * @param pruneConditionalItems Whether or not collectibles that only grant flight conditionally
3170
3156
  * should be included in the set (like Empty Vessel).
3171
3157
  */
3172
- export declare function getFlyingCollectibles(pruneConditionalItems: boolean): Set<CollectibleType>;
3158
+ export declare function getFlyingCollectibles(pruneConditionalItems: boolean): ReadonlySet<CollectibleType>;
3173
3159
 
3174
3160
  /**
3175
3161
  * Returns a set of all of the trinkets that grant flight. (All trinkets that grant flight do so
@@ -3535,11 +3521,11 @@ export declare function getModdedCollectibleSet(): ReadonlySet<CollectibleType>;
3535
3521
  /**
3536
3522
  * Helper function to get an array that represents the all modded collectible types.
3537
3523
  *
3538
- * This function is only useful when building collectible type objects. For most purposes, you
3539
- * should use the `getModdedCollectibleSet` helper function instead.
3540
- *
3541
3524
  * Returns an empty array if there are no modded collectible types.
3542
3525
  *
3526
+ * This function is only useful when building collectible type objects. For most purposes, you
3527
+ * should use the `getModdedCollectibleArray` or `getModdedCollectibleSet` helper function instead.
3528
+ *
3543
3529
  * (This function is named differently from the `getVanillaCollectibleTypeRange` function because
3544
3530
  * all modded collectible types are contiguous. Thus, each value represents a real
3545
3531
  * `CollectibleType`.)
@@ -3586,12 +3572,15 @@ export declare function getModdedTrinketSet(): ReadonlySet<TrinketType>;
3586
3572
  *
3587
3573
  * Returns an empty array if there are no modded trinket types.
3588
3574
  *
3575
+ * This function is only useful when building collectible type objects. For most purposes, you
3576
+ * should use the `getModdedCollectibleArray` or `getModdedCollectibleSet` helper function instead.
3577
+ *
3589
3578
  * This function can only be called if at least one callback has been executed. This is because not
3590
3579
  * all trinkets will necessarily be present when a mod first loads (due to mod load order).
3591
3580
  */
3592
3581
  export declare function getModdedTrinketTypes(): TrinketType[];
3593
3582
 
3594
- export declare function getMoveActions(): Set<ButtonAction>;
3583
+ export declare function getMoveActions(): ReadonlySet<ButtonAction>;
3595
3584
 
3596
3585
  /**
3597
3586
  * Helper function to get the first player with the lowest frame count. Useful to find a freshly
@@ -4836,7 +4825,7 @@ export declare function getScreenTopRightPos(): Vector;
4836
4825
  */
4837
4826
  export declare function getSetCombinations<T>(set: Set<T> | ReadonlySet<T>, includeEmptyArray: boolean): ReadonlyArray<ReadonlySet<T>>;
4838
4827
 
4839
- export declare function getShootActions(): Set<ButtonAction>;
4828
+ export declare function getShootActions(): ReadonlySet<ButtonAction>;
4840
4829
 
4841
4830
  /**
4842
4831
  * Helper function to get all of the slots in the room.
@@ -5065,7 +5054,7 @@ export declare function getTrinketSet(): ReadonlySet<TrinketType>;
5065
5054
  * This function can only be called if at least one callback has been executed. This is because not
5066
5055
  * all trinkets will necessarily be present when a mod first loads (due to mod load order).
5067
5056
  */
5068
- export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): Set<TrinketType>;
5057
+ export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): ReadonlySet<TrinketType>;
5069
5058
 
5070
5059
  /**
5071
5060
  * Helper function to get an array that contains every trinket type.
@@ -2,4 +2,5 @@
2
2
  export declare const STAGE_TO_STAGE_TYPE_TO_BOSS_SET_MAP: ReadonlyMap<int, ReadonlyMap<int, ReadonlySet<string>>>;
3
3
  export declare const STAGE_TO_COMBINED_BOSS_SET_MAP: ReadonlyMap<int, ReadonlySet<string>>;
4
4
  export declare const ALL_BOSSES_SET: ReadonlySet<string>;
5
+ export declare const ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET: ReadonlySet<string>;
5
6
  //# sourceMappingURL=bossSets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bossSets.d.ts","sourceRoot":"","sources":["../../src/sets/bossSets.ts"],"names":[],"mappings":";AA2aA,eAAO,MAAM,mCAAmC,EAAE,WAAW,CAC3D,GAAG,EACH,WAAW,CAAC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAarC,CAAC;AAEH,eAAO,MAAM,8BAA8B,EAAE,WAAW,CACtD,GAAG,EACH,WAAW,CAAC,MAAM,CAAC,CAanB,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,MAAM,CAQ7C,CAAC"}
1
+ {"version":3,"file":"bossSets.d.ts","sourceRoot":"","sources":["../../src/sets/bossSets.ts"],"names":[],"mappings":";AAibA,eAAO,MAAM,mCAAmC,EAAE,WAAW,CAC3D,GAAG,EACH,WAAW,CAAC,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAarC,CAAC;AAEH,eAAO,MAAM,8BAA8B,EAAE,WAAW,CACtD,GAAG,EACH,WAAW,CAAC,MAAM,CAAC,CAanB,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,MAAM,CAQ7C,CAAC;AAiBH,eAAO,MAAM,qCAAqC,EAAE,WAAW,CAAC,MAAM,CACpC,CAAC"}
@@ -37,6 +37,12 @@ local SatanVariant = ____isaac_2Dtypescript_2Ddefinitions.SatanVariant
37
37
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
38
38
  local WarVariant = ____isaac_2Dtypescript_2Ddefinitions.WarVariant
39
39
  local WidowVariant = ____isaac_2Dtypescript_2Ddefinitions.WidowVariant
40
+ local ____entities = require("functions.entities")
41
+ local parseEntityTypeVariantString = ____entities.parseEntityTypeVariantString
42
+ local ____set = require("functions.set")
43
+ local copySet = ____set.copySet
44
+ local ____storyBossesSet = require("sets.storyBossesSet")
45
+ local STORY_BOSSES_SET = ____storyBossesSet.STORY_BOSSES_SET
40
46
  --- Contains just the bosses in Basement (not e.g. Burning Basement).
41
47
  local BASEMENT_BOSSES_SET = __TS__New(
42
48
  Set,
@@ -551,4 +557,17 @@ ____exports.ALL_BOSSES_SET = __TS__New(
551
557
  ____Set_13,
552
558
  {__TS__SparseArraySpread(____array_12)}
553
559
  )
560
+ local allBossesExcludingStoryBossesSet = copySet(nil, ____exports.ALL_BOSSES_SET)
561
+ local allBosses = {__TS__Spread(____exports.ALL_BOSSES_SET:values())}
562
+ for ____, entityTypeVariantString in ipairs(allBosses) do
563
+ local tuple = parseEntityTypeVariantString(nil, entityTypeVariantString)
564
+ if tuple == nil then
565
+ error("Failed to parse a boss tuple when constructing the story boss set.")
566
+ end
567
+ local entityType, _variant = table.unpack(tuple)
568
+ if STORY_BOSSES_SET:has(entityType) then
569
+ allBossesExcludingStoryBossesSet:delete(entityTypeVariantString)
570
+ end
571
+ end
572
+ ____exports.ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET = allBossesExcludingStoryBossesSet
554
573
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "8.4.6",
3
+ "version": "8.5.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -10,8 +10,7 @@ import {
10
10
  PlayerType,
11
11
  } from "isaac-typescript-definitions";
12
12
  import { errorIfFeaturesNotInitialized } from "../featuresInitialized";
13
- import { addStat } from "../functions/players";
14
- import { getDefaultPlayerStat } from "../functions/stats";
13
+ import { addStat, getDefaultPlayerStat } from "../functions/stats";
15
14
 
16
15
  const FEATURE_NAME = "characterStats";
17
16
 
@@ -95,11 +95,11 @@ export function getLastCollectibleType(): CollectibleType {
95
95
  /**
96
96
  * Helper function to get an array that represents the all modded collectible types.
97
97
  *
98
- * This function is only useful when building collectible type objects. For most purposes, you
99
- * should use the `getModdedCollectibleSet` helper function instead.
100
- *
101
98
  * Returns an empty array if there are no modded collectible types.
102
99
  *
100
+ * This function is only useful when building collectible type objects. For most purposes, you
101
+ * should use the `getModdedCollectibleArray` or `getModdedCollectibleSet` helper function instead.
102
+ *
103
103
  * (This function is named differently from the `getVanillaCollectibleTypeRange` function because
104
104
  * all modded collectible types are contiguous. Thus, each value represents a real
105
105
  * `CollectibleType`.)
@@ -189,6 +189,9 @@ export function getLastTrinketType(): TrinketType {
189
189
  *
190
190
  * Returns an empty array if there are no modded trinket types.
191
191
  *
192
+ * This function is only useful when building collectible type objects. For most purposes, you
193
+ * should use the `getModdedCollectibleArray` or `getModdedCollectibleSet` helper function instead.
194
+ *
192
195
  * This function can only be called if at least one callback has been executed. This is because not
193
196
  * all trinkets will necessarily be present when a mod first loads (due to mod load order).
194
197
  */
@@ -5,6 +5,7 @@ import {
5
5
  } from "isaac-typescript-definitions";
6
6
  import { VectorZero } from "../core/constants";
7
7
  import {
8
+ ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET,
8
9
  ALL_BOSSES_SET,
9
10
  STAGE_TO_COMBINED_BOSS_SET_MAP,
10
11
  STAGE_TO_STAGE_TYPE_TO_BOSS_SET_MAP,
@@ -13,7 +14,6 @@ import { SIN_ENTITY_TYPES_SET } from "../sets/sinEntityTypesSet";
13
14
  import { getNPCs, spawnNPC } from "./entitiesSpecific";
14
15
  import { getAliveNPCs } from "./npcs";
15
16
  import { isRNG } from "./rng";
16
- import { copySet } from "./set";
17
17
  import { asNumber } from "./types";
18
18
  import { repeat } from "./utils";
19
19
 
@@ -57,9 +57,16 @@ export function getAliveBosses(
57
57
  * The set contains strings with the entity type and variant, separated by a period.
58
58
  *
59
59
  * Also see the `getBossSet` and `getCombinedBossSet` functions.
60
+ *
61
+ * @param includeStoryBosses Optional. Whether to include "story" bosses like Mom and It Lives!
62
+ * Default is true.
60
63
  */
61
- export function getAllBossesSet(): Set<string> {
62
- return copySet(ALL_BOSSES_SET);
64
+ export function getAllBossesSet(
65
+ includeStoryBosses = true,
66
+ ): ReadonlySet<string> {
67
+ return includeStoryBosses
68
+ ? ALL_BOSSES_SET
69
+ : ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET;
63
70
  }
64
71
 
65
72
  /**
@@ -84,7 +91,7 @@ export function getBossSet(
84
91
  return undefined;
85
92
  }
86
93
 
87
- return copySet(bossSet);
94
+ return bossSet;
88
95
  }
89
96
 
90
97
  /**
@@ -117,13 +124,15 @@ export function getBosses(
117
124
  *
118
125
  * Also see the `getAllBossesSet` and `getBossSet` functions.
119
126
  */
120
- export function getCombinedBossSet(stage: int): Set<string> | undefined {
127
+ export function getCombinedBossSet(
128
+ stage: int,
129
+ ): ReadonlySet<string> | undefined {
121
130
  const bossSet = STAGE_TO_COMBINED_BOSS_SET_MAP.get(stage);
122
131
  if (bossSet === undefined) {
123
132
  return undefined;
124
133
  }
125
134
 
126
- return copySet(bossSet);
135
+ return bossSet;
127
136
  }
128
137
 
129
138
  /** Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust. */
@@ -3,7 +3,7 @@ import { itemConfig } from "../core/cachedClasses";
3
3
  import { getCollectibleArray } from "./collectibleSet";
4
4
  import { getEnumValues } from "./enums";
5
5
  import { hasFlag } from "./flag";
6
- import { copySet, getSortedSetValues } from "./set";
6
+ import { getSortedSetValues } from "./set";
7
7
  import { repeat } from "./utils";
8
8
 
9
9
  const CACHE_FLAG_TO_COLLECTIBLES_MAP = new Map<
@@ -51,7 +51,7 @@ export function collectibleHasCacheFlag(
51
51
  */
52
52
  export function getCollectiblesForCacheFlag(
53
53
  cacheFlag: CacheFlag,
54
- ): Set<CollectibleType> {
54
+ ): ReadonlySet<CollectibleType> {
55
55
  lazyInitCacheFlagMap();
56
56
 
57
57
  const collectiblesSet = CACHE_FLAG_TO_COLLECTIBLES_MAP.get(cacheFlag);
@@ -59,7 +59,7 @@ export function getCollectiblesForCacheFlag(
59
59
  return new Set();
60
60
  }
61
61
 
62
- return copySet(collectiblesSet);
62
+ return collectiblesSet;
63
63
  }
64
64
 
65
65
  /**
@@ -3,17 +3,17 @@ import { itemConfig } from "../core/cachedClasses";
3
3
  import { getModdedCollectibleTypes } from "../features/firstLast";
4
4
  import { getVanillaCollectibleTypeRange } from "./collectibles";
5
5
 
6
- const ALL_COLLECTIBLES_ARRAY: CollectibleType[] = [];
7
- const ALL_COLLECTIBLES_SET = new Set<CollectibleType>();
6
+ const ALL_COLLECTIBLE_TYPES_ARRAY: CollectibleType[] = [];
7
+ const ALL_COLLECTIBLE_TYPES_SET = new Set<CollectibleType>();
8
8
 
9
- const VANILLA_COLLECTIBLES_ARRAY: CollectibleType[] = [];
10
- const VANILLA_COLLECTIBLES_SET = new Set<CollectibleType>();
9
+ const VANILLA_COLLECTIBLE_TYPES_ARRAY: CollectibleType[] = [];
10
+ const VANILLA_COLLECTIBLE_TYPES_SET = new Set<CollectibleType>();
11
11
 
12
- const MODDED_COLLECTIBLES_ARRAY: CollectibleType[] = [];
13
- const MODDED_COLLECTIBLES_SET = new Set<CollectibleType>();
12
+ const MODDED_COLLECTIBLE_TYPES_ARRAY: CollectibleType[] = [];
13
+ const MODDED_COLLECTIBLE_TYPES_SET = new Set<CollectibleType>();
14
14
 
15
- function lazyInitVanillaCollectibles() {
16
- if (VANILLA_COLLECTIBLES_ARRAY.length > 0) {
15
+ function lazyInitVanillaCollectibleTypes() {
16
+ if (VANILLA_COLLECTIBLE_TYPES_ARRAY.length > 0) {
17
17
  return;
18
18
  }
19
19
 
@@ -22,22 +22,22 @@ function lazyInitVanillaCollectibles() {
22
22
  // Vanilla collectible types are not contiguous, so we must check every value.
23
23
  const itemConfigItem = itemConfig.GetCollectible(collectibleType);
24
24
  if (itemConfigItem !== undefined) {
25
- VANILLA_COLLECTIBLES_ARRAY.push(collectibleType);
26
- VANILLA_COLLECTIBLES_SET.add(collectibleType);
25
+ VANILLA_COLLECTIBLE_TYPES_ARRAY.push(collectibleType);
26
+ VANILLA_COLLECTIBLE_TYPES_SET.add(collectibleType);
27
27
  }
28
28
  }
29
29
  }
30
30
 
31
- function lazyInitModdedCollectibles() {
32
- if (MODDED_COLLECTIBLES_ARRAY.length > 0) {
31
+ function lazyInitModdedCollectibleTypes() {
32
+ if (MODDED_COLLECTIBLE_TYPES_ARRAY.length > 0) {
33
33
  return;
34
34
  }
35
35
 
36
- lazyInitVanillaCollectibles();
36
+ lazyInitVanillaCollectibleTypes();
37
37
 
38
- for (const collectibleType of VANILLA_COLLECTIBLES_ARRAY) {
39
- ALL_COLLECTIBLES_ARRAY.push(collectibleType);
40
- ALL_COLLECTIBLES_SET.add(collectibleType);
38
+ for (const collectibleType of VANILLA_COLLECTIBLE_TYPES_ARRAY) {
39
+ ALL_COLLECTIBLE_TYPES_ARRAY.push(collectibleType);
40
+ ALL_COLLECTIBLE_TYPES_SET.add(collectibleType);
41
41
  }
42
42
 
43
43
  const moddedCollectibleTypes = getModdedCollectibleTypes();
@@ -45,11 +45,11 @@ function lazyInitModdedCollectibles() {
45
45
  // Modded collectible types are contiguous, but we check every value just in case.
46
46
  const itemConfigItem = itemConfig.GetCollectible(collectibleType);
47
47
  if (itemConfigItem !== undefined) {
48
- MODDED_COLLECTIBLES_ARRAY.push(collectibleType);
49
- MODDED_COLLECTIBLES_SET.add(collectibleType);
48
+ MODDED_COLLECTIBLE_TYPES_ARRAY.push(collectibleType);
49
+ MODDED_COLLECTIBLE_TYPES_SET.add(collectibleType);
50
50
 
51
- ALL_COLLECTIBLES_ARRAY.push(collectibleType);
52
- ALL_COLLECTIBLES_SET.add(collectibleType);
51
+ ALL_COLLECTIBLE_TYPES_ARRAY.push(collectibleType);
52
+ ALL_COLLECTIBLE_TYPES_SET.add(collectibleType);
53
53
  }
54
54
  }
55
55
  }
@@ -65,8 +65,8 @@ function lazyInitModdedCollectibles() {
65
65
  * all collectibles will necessarily be present when a mod first loads (due to mod load order).
66
66
  */
67
67
  export function getCollectibleArray(): readonly CollectibleType[] {
68
- lazyInitModdedCollectibles();
69
- return ALL_COLLECTIBLES_ARRAY;
68
+ lazyInitModdedCollectibleTypes();
69
+ return ALL_COLLECTIBLE_TYPES_ARRAY;
70
70
  }
71
71
 
72
72
  /**
@@ -79,8 +79,8 @@ export function getCollectibleArray(): readonly CollectibleType[] {
79
79
  * all collectibles will necessarily be present when a mod first loads (due to mod load order).
80
80
  */
81
81
  export function getCollectibleSet(): ReadonlySet<CollectibleType> {
82
- lazyInitModdedCollectibles();
83
- return ALL_COLLECTIBLES_SET;
82
+ lazyInitModdedCollectibleTypes();
83
+ return ALL_COLLECTIBLE_TYPES_SET;
84
84
  }
85
85
 
86
86
  /**
@@ -93,8 +93,8 @@ export function getCollectibleSet(): ReadonlySet<CollectibleType> {
93
93
  * all collectibles will necessarily be present when a mod first loads (due to mod load order).
94
94
  */
95
95
  export function getModdedCollectibleArray(): readonly CollectibleType[] {
96
- lazyInitModdedCollectibles();
97
- return MODDED_COLLECTIBLES_ARRAY;
96
+ lazyInitModdedCollectibleTypes();
97
+ return MODDED_COLLECTIBLE_TYPES_ARRAY;
98
98
  }
99
99
 
100
100
  /**
@@ -107,8 +107,8 @@ export function getModdedCollectibleArray(): readonly CollectibleType[] {
107
107
  * all collectibles will necessarily be present when a mod first loads (due to mod load order).
108
108
  */
109
109
  export function getModdedCollectibleSet(): ReadonlySet<CollectibleType> {
110
- lazyInitModdedCollectibles();
111
- return MODDED_COLLECTIBLES_SET;
110
+ lazyInitModdedCollectibleTypes();
111
+ return MODDED_COLLECTIBLE_TYPES_SET;
112
112
  }
113
113
 
114
114
  /**
@@ -118,8 +118,8 @@ export function getModdedCollectibleSet(): ReadonlySet<CollectibleType> {
118
118
  * then use the `getVanillaCollectibleSet` helper function instead.
119
119
  */
120
120
  export function getVanillaCollectibleArray(): readonly CollectibleType[] {
121
- lazyInitVanillaCollectibles();
122
- return VANILLA_COLLECTIBLES_ARRAY;
121
+ lazyInitVanillaCollectibleTypes();
122
+ return VANILLA_COLLECTIBLE_TYPES_ARRAY;
123
123
  }
124
124
 
125
125
  /**
@@ -129,6 +129,6 @@ export function getVanillaCollectibleArray(): readonly CollectibleType[] {
129
129
  * then use the `getVanillaCollectibleArray` helper function instead.
130
130
  */
131
131
  export function getVanillaCollectibleSet(): ReadonlySet<CollectibleType> {
132
- lazyInitVanillaCollectibles();
133
- return VANILLA_COLLECTIBLES_SET;
132
+ lazyInitVanillaCollectibleTypes();
133
+ return VANILLA_COLLECTIBLE_TYPES_SET;
134
134
  }
@@ -4,7 +4,6 @@ import { getCollectibleArray } from "./collectibleSet";
4
4
  import { getEnumValues } from "./enums";
5
5
  import { getFlagName } from "./flag";
6
6
  import { getPlayerCollectibleCount } from "./players";
7
- import { copySet } from "./set";
8
7
 
9
8
  const TAG_TO_COLLECTIBLE_TYPES_MAP = new Map<
10
9
  ItemConfigTag,
@@ -59,7 +58,7 @@ export function collectibleHasTag(
59
58
  */
60
59
  export function getCollectibleTypesWithTag(
61
60
  itemConfigTag: ItemConfigTag,
62
- ): Set<CollectibleType> {
61
+ ): ReadonlySet<CollectibleType> {
63
62
  // Lazy initialize the map.
64
63
  if (TAG_TO_COLLECTIBLE_TYPES_MAP.size === 0) {
65
64
  initTagMap();
@@ -72,7 +71,7 @@ export function getCollectibleTypesWithTag(
72
71
  );
73
72
  }
74
73
 
75
- return copySet(collectibleTypes);
74
+ return collectibleTypes;
76
75
  }
77
76
 
78
77
  /** Returns the number of items that a player has towards a particular transformation. */
@@ -3,7 +3,7 @@ import { isHiddenCollectible, isPassiveCollectible } from "./collectibles";
3
3
  import { getCollectibleArray } from "./collectibleSet";
4
4
  import { collectibleHasTag } from "./collectibleTag";
5
5
  import { getRandomSeed } from "./rng";
6
- import { copySet, getRandomSetElement } from "./set";
6
+ import { getRandomSetElement } from "./set";
7
7
 
8
8
  const EDEN_PASSIVE_COLLECTIBLES_SET = new Set<CollectibleType>();
9
9
 
@@ -19,13 +19,13 @@ function initCollectibleSet() {
19
19
  }
20
20
  }
21
21
 
22
- export function getEdenPassives(): Set<CollectibleType> {
22
+ export function getEdenPassives(): ReadonlySet<CollectibleType> {
23
23
  // Lazy initialize the set.
24
24
  if (EDEN_PASSIVE_COLLECTIBLES_SET.size === 0) {
25
25
  initCollectibleSet();
26
26
  }
27
27
 
28
- return copySet(EDEN_PASSIVE_COLLECTIBLES_SET);
28
+ return EDEN_PASSIVE_COLLECTIBLES_SET;
29
29
  }
30
30
 
31
31
  export function getRandomEdenPassive(
@@ -47,11 +47,11 @@ const CONDITIONAL_FLYING_COLLECTIBLE_TYPES: readonly CollectibleType[] = [
47
47
  */
48
48
  export function getFlyingCollectibles(
49
49
  pruneConditionalItems: boolean,
50
- ): Set<CollectibleType> {
50
+ ): ReadonlySet<CollectibleType> {
51
51
  // Instead of manually compiling a list of collectibles that grant flying, we can instead
52
52
  // dynamically look for collectibles that have `CacheFlag.FLYING`.
53
- const collectiblesWithFlyingCacheFlag = getCollectiblesForCacheFlag(
54
- CacheFlag.FLYING,
53
+ const collectiblesWithFlyingCacheFlag = copySet(
54
+ getCollectiblesForCacheFlag(CacheFlag.FLYING),
55
55
  );
56
56
 
57
57
  // None of the collectibles with a cache of "all" grant flying, so we can safely remove them from
@@ -80,7 +80,7 @@ export function getFlyingCollectibles(
80
80
  export function getFlyingTrinkets(): ReadonlySet<TrinketType> {
81
81
  // We use a different algorithm than the "getFlyingCollectibles" function because Azazel's Stump
82
82
  // has a cache of "all".
83
- return copySet(FLYING_TRINKETS);
83
+ return FLYING_TRINKETS;
84
84
  }
85
85
 
86
86
  export function hasFlyingTemporaryEffect(player: EntityPlayer): boolean {