isaacscript-common 8.4.5 → 8.6.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 (89) hide show
  1. package/dist/callbacks/postCursedTeleport.lua +4 -4
  2. package/dist/callbacks/postPlayerFatalDamage.lua +7 -7
  3. package/dist/callbacks/postSacrifice.lua +2 -2
  4. package/dist/callbacks/postTrinketBreak.lua +2 -2
  5. package/dist/callbacks/subscriptions/postPlayerFatalDamage.d.ts +2 -2
  6. package/dist/callbacks/subscriptions/postPlayerFatalDamage.d.ts.map +1 -1
  7. package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +4 -4
  8. package/dist/features/characterStats.d.ts.map +1 -1
  9. package/dist/features/characterStats.lua +1 -2
  10. package/dist/features/customGridEntity.d.ts.map +1 -1
  11. package/dist/features/customGridEntity.lua +3 -36
  12. package/dist/features/extraConsoleCommands/init.d.ts.map +1 -1
  13. package/dist/features/extraConsoleCommands/init.lua +1 -1
  14. package/dist/features/firstLast.d.ts +6 -3
  15. package/dist/features/firstLast.d.ts.map +1 -1
  16. package/dist/features/firstLast.lua +6 -3
  17. package/dist/features/playerInventory.d.ts +11 -3
  18. package/dist/features/playerInventory.d.ts.map +1 -1
  19. package/dist/features/playerInventory.lua +14 -3
  20. package/dist/functions/bosses.d.ts +8 -2
  21. package/dist/functions/bosses.d.ts.map +1 -1
  22. package/dist/functions/bosses.lua +14 -6
  23. package/dist/functions/collectibleCacheFlag.d.ts +1 -1
  24. package/dist/functions/collectibleCacheFlag.d.ts.map +1 -1
  25. package/dist/functions/collectibleCacheFlag.lua +1 -2
  26. package/dist/functions/collectibleSet.lua +32 -32
  27. package/dist/functions/collectibleTag.d.ts +1 -1
  28. package/dist/functions/collectibleTag.d.ts.map +1 -1
  29. package/dist/functions/collectibleTag.lua +1 -3
  30. package/dist/functions/eden.d.ts +1 -1
  31. package/dist/functions/eden.d.ts.map +1 -1
  32. package/dist/functions/eden.lua +1 -2
  33. package/dist/functions/flag.d.ts +1 -1
  34. package/dist/functions/flag.lua +1 -1
  35. package/dist/functions/flying.d.ts +1 -1
  36. package/dist/functions/flying.d.ts.map +1 -1
  37. package/dist/functions/flying.lua +5 -2
  38. package/dist/functions/input.d.ts +2 -2
  39. package/dist/functions/input.d.ts.map +1 -1
  40. package/dist/functions/input.lua +2 -4
  41. package/dist/functions/playerHealth.d.ts +93 -0
  42. package/dist/functions/playerHealth.d.ts.map +1 -1
  43. package/dist/functions/playerHealth.lua +216 -33
  44. package/dist/functions/players.d.ts +1 -111
  45. package/dist/functions/players.d.ts.map +1 -1
  46. package/dist/functions/players.lua +20 -279
  47. package/dist/functions/revive.d.ts +1 -1
  48. package/dist/functions/revive.d.ts.map +1 -1
  49. package/dist/functions/revive.lua +5 -4
  50. package/dist/functions/stats.d.ts +16 -0
  51. package/dist/functions/stats.d.ts.map +1 -1
  52. package/dist/functions/stats.lua +78 -0
  53. package/dist/functions/transformations.d.ts +1 -1
  54. package/dist/functions/transformations.d.ts.map +1 -1
  55. package/dist/functions/trinketCacheFlag.d.ts +1 -1
  56. package/dist/functions/trinketCacheFlag.d.ts.map +1 -1
  57. package/dist/functions/trinketCacheFlag.lua +1 -3
  58. package/dist/functions/trinketSet.lua +32 -32
  59. package/dist/index.d.ts +37 -36
  60. package/dist/sets/bossSets.d.ts +1 -0
  61. package/dist/sets/bossSets.d.ts.map +1 -1
  62. package/dist/sets/bossSets.lua +23 -0
  63. package/package.json +2 -2
  64. package/src/callbacks/postCursedTeleport.ts +7 -7
  65. package/src/callbacks/postPlayerFatalDamage.ts +9 -16
  66. package/src/callbacks/postSacrifice.ts +5 -5
  67. package/src/callbacks/postTrinketBreak.ts +5 -5
  68. package/src/callbacks/subscriptions/postPlayerFatalDamage.ts +9 -9
  69. package/src/features/characterStats.ts +1 -2
  70. package/src/features/customGridEntity.ts +0 -55
  71. package/src/features/extraConsoleCommands/init.ts +8 -1
  72. package/src/features/firstLast.ts +6 -3
  73. package/src/features/playerInventory.ts +24 -4
  74. package/src/functions/bosses.ts +18 -6
  75. package/src/functions/collectibleCacheFlag.ts +3 -3
  76. package/src/functions/collectibleSet.ts +32 -32
  77. package/src/functions/collectibleTag.ts +2 -3
  78. package/src/functions/eden.ts +3 -3
  79. package/src/functions/flag.ts +1 -1
  80. package/src/functions/flying.ts +4 -4
  81. package/src/functions/input.ts +4 -5
  82. package/src/functions/playerHealth.ts +269 -7
  83. package/src/functions/players.ts +1 -348
  84. package/src/functions/revive.ts +6 -10
  85. package/src/functions/stats.ts +75 -0
  86. package/src/functions/transformations.ts +1 -1
  87. package/src/functions/trinketCacheFlag.ts +2 -3
  88. package/src/functions/trinketSet.ts +32 -32
  89. package/src/sets/bossSets.ts +33 -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.
@@ -2297,9 +2280,15 @@ export declare function getAliveNPCs(entityType?: EntityType, variant?: number,
2297
2280
  *
2298
2281
  * The set contains strings with the entity type and variant, separated by a period.
2299
2282
  *
2283
+ * Note that this set does not include bosses that do not appear in Boss Rooms (e.g. Krampus, Uriel,
2284
+ * and Gabriel.).
2285
+ *
2300
2286
  * Also see the `getBossSet` and `getCombinedBossSet` functions.
2287
+ *
2288
+ * @param includeStoryBosses Optional. Whether to include "story" bosses like Mom and It Lives!
2289
+ * Default is true.
2301
2290
  */
2302
- export declare function getAllBossesSet(): Set<string>;
2291
+ export declare function getAllBossesSet(includeStoryBosses?: boolean): ReadonlySet<string>;
2303
2292
 
2304
2293
  /**
2305
2294
  * Helper function to get an array with every valid card sub-type. This includes modded cards.
@@ -2739,7 +2728,7 @@ export declare function getCollectibleSet(): ReadonlySet<CollectibleType>;
2739
2728
  * This function can only be called if at least one callback has been executed. This is because not
2740
2729
  * all collectibles will necessarily be present when a mod first loads (due to mod load order).
2741
2730
  */
2742
- export declare function getCollectiblesForCacheFlag(cacheFlag: CacheFlag): Set<CollectibleType>;
2731
+ export declare function getCollectiblesForCacheFlag(cacheFlag: CacheFlag): ReadonlySet<CollectibleType>;
2743
2732
 
2744
2733
  /**
2745
2734
  * Helper function to get the remaining collectibles in a given item pool. This function is
@@ -2770,7 +2759,7 @@ export declare function getCollectibleTags(collectibleType: CollectibleType): Bi
2770
2759
  * const guppyCollectibleTypes = getCollectibleTypesForTransformation(PlayerForm.GUPPY);
2771
2760
  * ```
2772
2761
  */
2773
- export declare function getCollectibleTypesForTransformation(playerForm: PlayerForm): Set<CollectibleType>;
2762
+ export declare function getCollectibleTypesForTransformation(playerForm: PlayerForm): ReadonlySet<CollectibleType>;
2774
2763
 
2775
2764
  /**
2776
2765
  * Helper function to get all of the collectible types in the game that have a certain tag.
@@ -2782,7 +2771,7 @@ export declare function getCollectibleTypesForTransformation(playerForm: PlayerF
2782
2771
  * const offensiveCollectibleTypes = getCollectibleTypesWithTag(ItemConfigTag.OFFENSIVE);
2783
2772
  * ```
2784
2773
  */
2785
- export declare function getCollectibleTypesWithTag(itemConfigTag: ItemConfigTag): Set<CollectibleType>;
2774
+ export declare function getCollectibleTypesWithTag(itemConfigTag: ItemConfigTag): ReadonlySet<CollectibleType>;
2786
2775
 
2787
2776
  /**
2788
2777
  * Gets the entities that have a hitbox that overlaps with any part of the square that the grid
@@ -2802,7 +2791,7 @@ export declare function getCollidingEntitiesWithGridEntity(gridEntity: GridEntit
2802
2791
  *
2803
2792
  * Also see the `getAllBossesSet` and `getBossSet` functions.
2804
2793
  */
2805
- export declare function getCombinedBossSet(stage: int): Set<string> | undefined;
2794
+ export declare function getCombinedBossSet(stage: int): ReadonlySet<string> | undefined;
2806
2795
 
2807
2796
  /**
2808
2797
  * Helper function to get all of the crawl spaces in the room.
@@ -2903,7 +2892,7 @@ export declare function getDoorSlotsForRoomShape(roomShape: RoomShape): Readonly
2903
2892
  */
2904
2893
  export declare function getDoorsToRoomIndex(...roomGridIndex: int[]): GridEntityDoor[];
2905
2894
 
2906
- export declare function getEdenPassives(): Set<CollectibleType>;
2895
+ export declare function getEdenPassives(): ReadonlySet<CollectibleType>;
2907
2896
 
2908
2897
  /**
2909
2898
  * Helper function to account for Repentance floors being offset by 1. For example, Downpour 2 is
@@ -3169,7 +3158,7 @@ export declare function getFloorDisplayFlags(): Map<int, BitFlags<DisplayFlag>>;
3169
3158
  * @param pruneConditionalItems Whether or not collectibles that only grant flight conditionally
3170
3159
  * should be included in the set (like Empty Vessel).
3171
3160
  */
3172
- export declare function getFlyingCollectibles(pruneConditionalItems: boolean): Set<CollectibleType>;
3161
+ export declare function getFlyingCollectibles(pruneConditionalItems: boolean): ReadonlySet<CollectibleType>;
3173
3162
 
3174
3163
  /**
3175
3164
  * Returns a set of all of the trinkets that grant flight. (All trinkets that grant flight do so
@@ -3535,11 +3524,11 @@ export declare function getModdedCollectibleSet(): ReadonlySet<CollectibleType>;
3535
3524
  /**
3536
3525
  * Helper function to get an array that represents the all modded collectible types.
3537
3526
  *
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
3527
  * Returns an empty array if there are no modded collectible types.
3542
3528
  *
3529
+ * This function is only useful when building collectible type objects. For most purposes, you
3530
+ * should use the `getModdedCollectibleArray` or `getModdedCollectibleSet` helper function instead.
3531
+ *
3543
3532
  * (This function is named differently from the `getVanillaCollectibleTypeRange` function because
3544
3533
  * all modded collectible types are contiguous. Thus, each value represents a real
3545
3534
  * `CollectibleType`.)
@@ -3586,12 +3575,15 @@ export declare function getModdedTrinketSet(): ReadonlySet<TrinketType>;
3586
3575
  *
3587
3576
  * Returns an empty array if there are no modded trinket types.
3588
3577
  *
3578
+ * This function is only useful when building collectible type objects. For most purposes, you
3579
+ * should use the `getModdedCollectibleArray` or `getModdedCollectibleSet` helper function instead.
3580
+ *
3589
3581
  * This function can only be called if at least one callback has been executed. This is because not
3590
3582
  * all trinkets will necessarily be present when a mod first loads (due to mod load order).
3591
3583
  */
3592
3584
  export declare function getModdedTrinketTypes(): TrinketType[];
3593
3585
 
3594
- export declare function getMoveActions(): Set<ButtonAction>;
3586
+ export declare function getMoveActions(): ReadonlySet<ButtonAction>;
3595
3587
 
3596
3588
  /**
3597
3589
  * Helper function to get the first player with the lowest frame count. Useful to find a freshly
@@ -4033,9 +4025,6 @@ export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int |
4033
4025
  * Helper function to get all of the collectibles that the player has gotten so far on this run, in
4034
4026
  * order.
4035
4027
  *
4036
- * Note that this does not include active collectibles that have since been dropped for other
4037
- * collectibles.
4038
- *
4039
4028
  * In the case of inventory initialization or the case where the player rerolls their build in the
4040
4029
  * middle of the run (e.g. with D4), the order of the inventory will not correspond to the order
4041
4030
  * that the items were actually given to the player. In this case, the inventory will be in the
@@ -4047,6 +4036,10 @@ export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int |
4047
4036
  * would not be updated. In vanilla, this situation would never happen, but another mod might do
4048
4037
  * this for some reason. (With that said, the next time that a collectible is normally added or
4049
4038
  * removed, it would trigger a re-scan, and the previous changes would be picked up.)
4039
+ *
4040
+ * @param player The player to get the inventory for.
4041
+ * @param includeActiveCollectibles Optional. If true, will include all active collectibles. Default
4042
+ * is true.
4050
4043
  */
4051
4044
  export declare function getPlayerInventory(player: EntityPlayer, includeActiveCollectibles?: boolean): CollectibleType[];
4052
4045
 
@@ -4056,6 +4049,14 @@ export declare function getPlayerInventory(player: EntityPlayer, includeActiveCo
4056
4049
  */
4057
4050
  export declare function getPlayerLastHeart(player: EntityPlayer): HealthType;
4058
4051
 
4052
+ /**
4053
+ * Helper function to get the last passive collectible that the player picked up. In most cases,
4054
+ * this will be the passive that is removed when the player would use Clicker.
4055
+ *
4056
+ * Returns undefined if the player does not have any passive collectibles.
4057
+ */
4058
+ export declare function getPlayerLastPassiveCollectible(player: EntityPlayer): CollectibleType | undefined;
4059
+
4059
4060
  /**
4060
4061
  * Returns the maximum heart containers that the provided player can have. Normally, this is 12, but
4061
4062
  * it can change depending on the character (e.g. Keeper) and other things (e.g. Mother's Kiss).
@@ -4836,7 +4837,7 @@ export declare function getScreenTopRightPos(): Vector;
4836
4837
  */
4837
4838
  export declare function getSetCombinations<T>(set: Set<T> | ReadonlySet<T>, includeEmptyArray: boolean): ReadonlyArray<ReadonlySet<T>>;
4838
4839
 
4839
- export declare function getShootActions(): Set<ButtonAction>;
4840
+ export declare function getShootActions(): ReadonlySet<ButtonAction>;
4840
4841
 
4841
4842
  /**
4842
4843
  * Helper function to get all of the slots in the room.
@@ -5065,7 +5066,7 @@ export declare function getTrinketSet(): ReadonlySet<TrinketType>;
5065
5066
  * This function can only be called if at least one callback has been executed. This is because not
5066
5067
  * all trinkets will necessarily be present when a mod first loads (due to mod load order).
5067
5068
  */
5068
- export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): Set<TrinketType>;
5069
+ export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): ReadonlySet<TrinketType>;
5069
5070
 
5070
5071
  /**
5071
5072
  * Helper function to get an array that contains every trinket type.
@@ -5662,7 +5663,7 @@ export declare function isDamageFromPlayer(damageSource: Entity): boolean;
5662
5663
  * Uses the player's current health and other miscellaneous things to determine if incoming damage
5663
5664
  * will be fatal.
5664
5665
  */
5665
- export declare function isDamageToPlayerFatal(player: EntityPlayer, damageAmount: int, damageSource: EntityRef, lastDamageGameFrame: int | undefined): boolean;
5666
+ export declare function isDamageToPlayerFatal(player: EntityPlayer, amount: int, source: EntityRef, lastDamageGameFrame: int | undefined): boolean;
5666
5667
 
5667
5668
  /**
5668
5669
  * Helper function to check if the given room grid index is a dead end. Specifically, this is
@@ -6069,7 +6070,7 @@ export declare function isSack(pickup: EntityPickup): pickup is EntityPickupSack
6069
6070
  export declare function isSecretRoomDoor(door: GridEntityDoor): boolean;
6070
6071
 
6071
6072
  /**
6072
- * Helper function to determine whether damage to a player in the EntityTakeDmg callback was
6073
+ * Helper function to determine whether damage to a player in the `ENTITY_TAKE_DMG` callback was
6073
6074
  * self-inflicted. For example, damage from a Curse Room door, a Razor, or a Blood Donation Machine
6074
6075
  * would count as self-inflicted damage.
6075
6076
  */
@@ -8705,7 +8706,7 @@ collectibleType?: CollectibleType
8705
8706
  ];
8706
8707
 
8707
8708
  declare type PostPlayerFatalDamageRegisterParameters = [
8708
- callback: (player: EntityPlayer, damageAmount: float, damageFlags: BitFlags<DamageFlag>, damageSource: EntityRef, damageCountdownFrames: int) => boolean | undefined,
8709
+ callback: (player: EntityPlayer, amount: float, damageFlags: BitFlags<DamageFlag>, source: EntityRef, countdownFrames: int) => boolean | undefined,
8709
8710
  playerVariant?: PlayerVariant,
8710
8711
  character?: PlayerType
8711
8712
  ];
@@ -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;AAEH,eAAO,MAAM,qCAAqC,qBACX,CAAC"}
@@ -7,6 +7,7 @@ local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
7
7
  local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
8
8
  local Map = ____lualib.Map
9
9
  local ____exports = {}
10
+ local getAllBossesExcludingStoryBossesSet
10
11
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
11
12
  local BigHornVariant = ____isaac_2Dtypescript_2Ddefinitions.BigHornVariant
12
13
  local ChubVariant = ____isaac_2Dtypescript_2Ddefinitions.ChubVariant
@@ -37,6 +38,27 @@ local SatanVariant = ____isaac_2Dtypescript_2Ddefinitions.SatanVariant
37
38
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
38
39
  local WarVariant = ____isaac_2Dtypescript_2Ddefinitions.WarVariant
39
40
  local WidowVariant = ____isaac_2Dtypescript_2Ddefinitions.WidowVariant
41
+ local ____entities = require("functions.entities")
42
+ local parseEntityTypeVariantString = ____entities.parseEntityTypeVariantString
43
+ local ____set = require("functions.set")
44
+ local copySet = ____set.copySet
45
+ local ____storyBossesSet = require("sets.storyBossesSet")
46
+ local STORY_BOSSES_SET = ____storyBossesSet.STORY_BOSSES_SET
47
+ function getAllBossesExcludingStoryBossesSet(self)
48
+ local allBossesExcludingStoryBossesSet = copySet(nil, ____exports.ALL_BOSSES_SET)
49
+ local allBosses = {__TS__Spread(____exports.ALL_BOSSES_SET:values())}
50
+ for ____, entityTypeVariantString in ipairs(allBosses) do
51
+ local tuple = parseEntityTypeVariantString(nil, entityTypeVariantString)
52
+ if tuple == nil then
53
+ error("Failed to parse a boss tuple when constructing the story boss set.")
54
+ end
55
+ local entityType, _variant = table.unpack(tuple)
56
+ if STORY_BOSSES_SET:has(entityType) then
57
+ allBossesExcludingStoryBossesSet:delete(entityTypeVariantString)
58
+ end
59
+ end
60
+ return allBossesExcludingStoryBossesSet
61
+ end
40
62
  --- Contains just the bosses in Basement (not e.g. Burning Basement).
41
63
  local BASEMENT_BOSSES_SET = __TS__New(
42
64
  Set,
@@ -551,4 +573,5 @@ ____exports.ALL_BOSSES_SET = __TS__New(
551
573
  ____Set_13,
552
574
  {__TS__SparseArraySpread(____array_12)}
553
575
  )
576
+ ____exports.ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET = getAllBossesExcludingStoryBossesSet(nil)
554
577
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "8.4.5",
3
+ "version": "8.6.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,6 @@
22
22
  "main": "dist/index",
23
23
  "types": "dist/index.d.ts",
24
24
  "dependencies": {
25
- "isaac-typescript-definitions": "^3.5.1"
25
+ "isaac-typescript-definitions": "^3.5.2"
26
26
  }
27
27
  }
@@ -54,26 +54,26 @@ function hasSubscriptions() {
54
54
  // ModCallback.ENTITY_TAKE_DMG (11)
55
55
  // EntityType.PLAYER (1)
56
56
  function entityTakeDmgPlayer(
57
- tookDamage: Entity,
58
- _damageAmount: float,
57
+ entity: Entity,
58
+ _amount: float,
59
59
  damageFlags: BitFlags<DamageFlag>,
60
- _damageSource: EntityRef,
61
- _damageCountdownFrames: int,
60
+ _source: EntityRef,
61
+ _countdownFrames: int,
62
62
  ): boolean | undefined {
63
63
  if (!hasSubscriptions()) {
64
64
  return undefined;
65
65
  }
66
66
 
67
67
  incrementNumSacrifices(damageFlags); // Has to be before setting the damage frame
68
- setDamageFrame(tookDamage, damageFlags);
68
+ setDamageFrame(entity, damageFlags);
69
69
 
70
70
  return undefined;
71
71
  }
72
72
 
73
- function setDamageFrame(tookDamage: Entity, damageFlags: BitFlags<DamageFlag>) {
73
+ function setDamageFrame(entity: Entity, damageFlags: BitFlags<DamageFlag>) {
74
74
  const gameFrameCount = game.GetFrameCount();
75
75
 
76
- const player = tookDamage.ToPlayer();
76
+ const player = entity.ToPlayer();
77
77
  if (player === undefined) {
78
78
  return;
79
79
  }
@@ -50,17 +50,17 @@ function hasSubscriptions() {
50
50
  // ModCallback.ENTITY_TAKE_DMG (11)
51
51
  // EntityType.PLAYER (1)
52
52
  function entityTakeDmgPlayer(
53
- tookDamage: Entity,
54
- damageAmount: float,
53
+ entity: Entity,
54
+ amount: float,
55
55
  damageFlags: BitFlags<DamageFlag>,
56
- damageSource: EntityRef,
57
- damageCountdownFrames: int,
56
+ source: EntityRef,
57
+ countdownFrames: int,
58
58
  ): boolean | undefined {
59
59
  if (!hasSubscriptions()) {
60
60
  return undefined;
61
61
  }
62
62
 
63
- const player = tookDamage.ToPlayer();
63
+ const player = entity.ToPlayer();
64
64
  if (player === undefined) {
65
65
  return undefined;
66
66
  }
@@ -83,23 +83,16 @@ function entityTakeDmgPlayer(
83
83
  return undefined;
84
84
  }
85
85
 
86
- if (
87
- !isDamageToPlayerFatal(
88
- player,
89
- damageAmount,
90
- damageSource,
91
- lastDamageGameFrame,
92
- )
93
- ) {
86
+ if (!isDamageToPlayerFatal(player, amount, source, lastDamageGameFrame)) {
94
87
  return undefined;
95
88
  }
96
89
 
97
90
  const shouldSustainDeath = postPlayerFatalDamageFire(
98
91
  player,
99
- damageAmount,
92
+ amount,
100
93
  damageFlags,
101
- damageSource,
102
- damageCountdownFrames,
94
+ source,
95
+ countdownFrames,
103
96
  );
104
97
  if (shouldSustainDeath !== undefined) {
105
98
  return shouldSustainDeath;
@@ -35,17 +35,17 @@ function hasSubscriptions() {
35
35
  // ModCallback.ENTITY_TAKE_DMG (11)
36
36
  // EntityType.PLAYER (1)
37
37
  function entityTakeDmgPlayer(
38
- tookDamage: Entity,
39
- _damageAmount: float,
38
+ entity: Entity,
39
+ _amount: float,
40
40
  damageFlags: BitFlags<DamageFlag>,
41
- _damageSource: EntityRef,
42
- _damageCountdownFrames: int,
41
+ _source: EntityRef,
42
+ _countdownFrames: int,
43
43
  ): boolean | undefined {
44
44
  if (!hasSubscriptions()) {
45
45
  return undefined;
46
46
  }
47
47
 
48
- const player = tookDamage.ToPlayer();
48
+ const player = entity.ToPlayer();
49
49
  if (player === undefined) {
50
50
  return undefined;
51
51
  }
@@ -52,17 +52,17 @@ function hasSubscriptions() {
52
52
  // ModCallback.ENTITY_TAKE_DMG (11)
53
53
  // EntityType.PLAYER (1)
54
54
  function entityTakeDmgPlayer(
55
- tookDamage: Entity,
56
- _damageAmount: float,
55
+ entity: Entity,
56
+ _amount: float,
57
57
  _damageFlags: BitFlags<DamageFlag>,
58
- _damageSource: EntityRef,
59
- _damageCountdownFrames: int,
58
+ _source: EntityRef,
59
+ _countdownFrames: int,
60
60
  ): boolean | undefined {
61
61
  if (!hasSubscriptions()) {
62
62
  return undefined;
63
63
  }
64
64
 
65
- const player = tookDamage.ToPlayer();
65
+ const player = entity.ToPlayer();
66
66
  if (player === undefined) {
67
67
  return undefined;
68
68
  }
@@ -7,10 +7,10 @@ import {
7
7
  export type PostPlayerFatalDamageRegisterParameters = [
8
8
  callback: (
9
9
  player: EntityPlayer,
10
- damageAmount: float,
10
+ amount: float,
11
11
  damageFlags: BitFlags<DamageFlag>,
12
- damageSource: EntityRef,
13
- damageCountdownFrames: int,
12
+ source: EntityRef,
13
+ countdownFrames: int,
14
14
  ) => boolean | undefined,
15
15
  playerVariant?: PlayerVariant,
16
16
  character?: PlayerType,
@@ -30,10 +30,10 @@ export function postPlayerFatalDamageRegister(
30
30
 
31
31
  export function postPlayerFatalDamageFire(
32
32
  player: EntityPlayer,
33
- damageAmount: float,
33
+ amount: float,
34
34
  damageFlags: BitFlags<DamageFlag>,
35
- damageSource: EntityRef,
36
- damageCountdownFrames: int,
35
+ source: EntityRef,
36
+ countdownFrames: int,
37
37
  ): boolean | undefined {
38
38
  const character = player.GetPlayerType();
39
39
 
@@ -50,10 +50,10 @@ export function postPlayerFatalDamageFire(
50
50
 
51
51
  const shouldSustainDeath = callback(
52
52
  player,
53
- damageAmount,
53
+ amount,
54
54
  damageFlags,
55
- damageSource,
56
- damageCountdownFrames,
55
+ source,
56
+ countdownFrames,
57
57
  );
58
58
 
59
59
  if (shouldSustainDeath !== undefined) {
@@ -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