isaacscript-common 8.4.4 → 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 (85) 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/functions/bosses.d.ts +5 -2
  18. package/dist/functions/bosses.d.ts.map +1 -1
  19. package/dist/functions/bosses.lua +11 -6
  20. package/dist/functions/collectibleCacheFlag.d.ts +1 -1
  21. package/dist/functions/collectibleCacheFlag.d.ts.map +1 -1
  22. package/dist/functions/collectibleCacheFlag.lua +1 -2
  23. package/dist/functions/collectibleSet.lua +32 -32
  24. package/dist/functions/collectibleTag.d.ts +1 -1
  25. package/dist/functions/collectibleTag.d.ts.map +1 -1
  26. package/dist/functions/collectibleTag.lua +1 -3
  27. package/dist/functions/eden.d.ts +1 -1
  28. package/dist/functions/eden.d.ts.map +1 -1
  29. package/dist/functions/eden.lua +1 -2
  30. package/dist/functions/flag.d.ts +1 -1
  31. package/dist/functions/flag.lua +1 -1
  32. package/dist/functions/flying.d.ts +1 -1
  33. package/dist/functions/flying.d.ts.map +1 -1
  34. package/dist/functions/flying.lua +5 -2
  35. package/dist/functions/input.d.ts +2 -2
  36. package/dist/functions/input.d.ts.map +1 -1
  37. package/dist/functions/input.lua +2 -4
  38. package/dist/functions/playerHealth.d.ts +93 -0
  39. package/dist/functions/playerHealth.d.ts.map +1 -1
  40. package/dist/functions/playerHealth.lua +216 -33
  41. package/dist/functions/players.d.ts +1 -111
  42. package/dist/functions/players.d.ts.map +1 -1
  43. package/dist/functions/players.lua +20 -279
  44. package/dist/functions/revive.d.ts +1 -1
  45. package/dist/functions/revive.d.ts.map +1 -1
  46. package/dist/functions/revive.lua +5 -4
  47. package/dist/functions/stats.d.ts +16 -0
  48. package/dist/functions/stats.d.ts.map +1 -1
  49. package/dist/functions/stats.lua +78 -0
  50. package/dist/functions/transformations.d.ts +1 -1
  51. package/dist/functions/transformations.d.ts.map +1 -1
  52. package/dist/functions/trinketCacheFlag.d.ts +1 -1
  53. package/dist/functions/trinketCacheFlag.d.ts.map +1 -1
  54. package/dist/functions/trinketCacheFlag.lua +1 -3
  55. package/dist/functions/trinketSet.lua +32 -32
  56. package/dist/index.d.ts +22 -33
  57. package/dist/sets/bossSets.d.ts +1 -0
  58. package/dist/sets/bossSets.d.ts.map +1 -1
  59. package/dist/sets/bossSets.lua +19 -0
  60. package/package.json +2 -2
  61. package/src/callbacks/postCursedTeleport.ts +7 -7
  62. package/src/callbacks/postPlayerFatalDamage.ts +9 -16
  63. package/src/callbacks/postSacrifice.ts +5 -5
  64. package/src/callbacks/postTrinketBreak.ts +5 -5
  65. package/src/callbacks/subscriptions/postPlayerFatalDamage.ts +9 -9
  66. package/src/features/characterStats.ts +1 -2
  67. package/src/features/customGridEntity.ts +0 -55
  68. package/src/features/extraConsoleCommands/init.ts +8 -1
  69. package/src/features/firstLast.ts +6 -3
  70. package/src/functions/bosses.ts +15 -6
  71. package/src/functions/collectibleCacheFlag.ts +3 -3
  72. package/src/functions/collectibleSet.ts +32 -32
  73. package/src/functions/collectibleTag.ts +2 -3
  74. package/src/functions/eden.ts +3 -3
  75. package/src/functions/flag.ts +1 -1
  76. package/src/functions/flying.ts +4 -4
  77. package/src/functions/input.ts +4 -5
  78. package/src/functions/playerHealth.ts +269 -7
  79. package/src/functions/players.ts +1 -348
  80. package/src/functions/revive.ts +6 -10
  81. package/src/functions/stats.ts +75 -0
  82. package/src/functions/transformations.ts +1 -1
  83. package/src/functions/trinketCacheFlag.ts +2 -3
  84. package/src/functions/trinketSet.ts +32 -32
  85. package/src/sets/bossSets.ts +24 -0
@@ -1,4 +1,20 @@
1
1
  import { CacheFlag } from "isaac-typescript-definitions";
2
+ /**
3
+ * Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
4
+ * from the `EVALUATE_CACHE` callback.
5
+ *
6
+ * Note that for `CacheFlag.FIRE_DELAY`, the "amount" argument will be interpreted as the tear stat
7
+ * to add (and not the amount to mutate `EntityPlayer.MaxFireDelay` by).
8
+ *
9
+ * This function supports the following cache flags:
10
+ * - CacheFlag.DAMAGE (1 << 0)
11
+ * - CacheFlag.FIRE_DELAY (1 << 1)
12
+ * - CacheFlag.SHOT_SPEED (1 << 2)
13
+ * - CacheFlag.RANGE (1 << 3)
14
+ * - CacheFlag.SPEED (1 << 4)
15
+ * - CacheFlag.LUCK (1 << 10)
16
+ */
17
+ export declare function addStat(player: EntityPlayer, cacheFlag: CacheFlag, amount: number): void;
2
18
  /**
3
19
  * Returns the starting stat that Isaac (the default character) starts with. For example, if you
4
20
  * pass this function `CacheFlag.DAMAGE`, it will return 3.5.
@@ -1 +1 @@
1
- {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/functions/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAE7E"}
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/functions/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAazD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GACb,IAAI,CA4CN;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAE7E"}
@@ -1,6 +1,84 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
1
4
  local ____exports = {}
5
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
+ local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
2
7
  local ____defaultPlayerStatMap = require("maps.defaultPlayerStatMap")
3
8
  local DEFAULT_PLAYER_STAT_MAP = ____defaultPlayerStatMap.DEFAULT_PLAYER_STAT_MAP
9
+ local ____tears = require("functions.tears")
10
+ local addTearsStat = ____tears.addTearsStat
11
+ local STAT_CACHE_FLAGS_SET = __TS__New(Set, {
12
+ CacheFlag.DAMAGE,
13
+ CacheFlag.FIRE_DELAY,
14
+ CacheFlag.SHOT_SPEED,
15
+ CacheFlag.RANGE,
16
+ CacheFlag.SPEED,
17
+ CacheFlag.LUCK
18
+ })
19
+ --- Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
20
+ -- from the `EVALUATE_CACHE` callback.
21
+ --
22
+ -- Note that for `CacheFlag.FIRE_DELAY`, the "amount" argument will be interpreted as the tear stat
23
+ -- to add (and not the amount to mutate `EntityPlayer.MaxFireDelay` by).
24
+ --
25
+ -- This function supports the following cache flags:
26
+ -- - CacheFlag.DAMAGE (1 << 0)
27
+ -- - CacheFlag.FIRE_DELAY (1 << 1)
28
+ -- - CacheFlag.SHOT_SPEED (1 << 2)
29
+ -- - CacheFlag.RANGE (1 << 3)
30
+ -- - CacheFlag.SPEED (1 << 4)
31
+ -- - CacheFlag.LUCK (1 << 10)
32
+ function ____exports.addStat(self, player, cacheFlag, amount)
33
+ if not STAT_CACHE_FLAGS_SET:has(cacheFlag) then
34
+ error("You cannot add a stat to a player with the cache flag of: " .. tostring(cacheFlag))
35
+ end
36
+ repeat
37
+ local ____switch4 = cacheFlag
38
+ local ____cond4 = ____switch4 == CacheFlag.DAMAGE
39
+ if ____cond4 then
40
+ do
41
+ player.Damage = player.Damage + amount
42
+ break
43
+ end
44
+ end
45
+ ____cond4 = ____cond4 or ____switch4 == CacheFlag.FIRE_DELAY
46
+ if ____cond4 then
47
+ do
48
+ addTearsStat(nil, player, amount)
49
+ break
50
+ end
51
+ end
52
+ ____cond4 = ____cond4 or ____switch4 == CacheFlag.SHOT_SPEED
53
+ if ____cond4 then
54
+ do
55
+ player.ShotSpeed = player.ShotSpeed + amount
56
+ break
57
+ end
58
+ end
59
+ ____cond4 = ____cond4 or ____switch4 == CacheFlag.RANGE
60
+ if ____cond4 then
61
+ do
62
+ player.TearHeight = player.TearHeight + amount
63
+ break
64
+ end
65
+ end
66
+ ____cond4 = ____cond4 or ____switch4 == CacheFlag.SPEED
67
+ if ____cond4 then
68
+ do
69
+ player.MoveSpeed = player.MoveSpeed + amount
70
+ break
71
+ end
72
+ end
73
+ ____cond4 = ____cond4 or ____switch4 == CacheFlag.LUCK
74
+ if ____cond4 then
75
+ do
76
+ player.Luck = player.Luck + amount
77
+ break
78
+ end
79
+ end
80
+ until true
81
+ end
4
82
  --- Returns the starting stat that Isaac (the default character) starts with. For example, if you
5
83
  -- pass this function `CacheFlag.DAMAGE`, it will return 3.5.
6
84
  --
@@ -9,7 +9,7 @@ import { CollectibleType, PlayerForm } from "isaac-typescript-definitions";
9
9
  * const guppyCollectibleTypes = getCollectibleTypesForTransformation(PlayerForm.GUPPY);
10
10
  * ```
11
11
  */
12
- export declare function getCollectibleTypesForTransformation(playerForm: PlayerForm): Set<CollectibleType>;
12
+ export declare function getCollectibleTypesForTransformation(playerForm: PlayerForm): ReadonlySet<CollectibleType>;
13
13
  /** Returns the number of items that a player has towards a particular transformation. */
14
14
  export declare function getPlayerNumCollectiblesForTransformation(player: EntityPlayer, playerForm: PlayerForm): int;
15
15
  /** Returns a set of the player's current transformations. */
@@ -1 +1 @@
1
- {"version":3,"file":"transformations.d.ts","sourceRoot":"","sources":["../../src/functions/transformations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,UAAU,EACX,MAAM,8BAA8B,CAAC;AAiCtC;;;;;;;;;GASG;AACH,wBAAgB,oCAAoC,CAClD,UAAU,EAAE,UAAU,GACrB,GAAG,CAAC,eAAe,CAAC,CAStB;AAED,yFAAyF;AACzF,wBAAgB,yCAAyC,CACvD,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAGL;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,GACnB,GAAG,CAAC,UAAU,CAAC,CASjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEpE;AAED,wBAAgB,oCAAoC,CAClD,eAAe,EAAE,eAAe,GAC/B,GAAG,CAAC,UAAU,CAAC,CAiBjB;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAQrE;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAEtE"}
1
+ {"version":3,"file":"transformations.d.ts","sourceRoot":"","sources":["../../src/functions/transformations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,UAAU,EACX,MAAM,8BAA8B,CAAC;AAiCtC;;;;;;;;;GASG;AACH,wBAAgB,oCAAoC,CAClD,UAAU,EAAE,UAAU,GACrB,WAAW,CAAC,eAAe,CAAC,CAS9B;AAED,yFAAyF;AACzF,wBAAgB,yCAAyC,CACvD,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAGL;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,GACnB,GAAG,CAAC,UAAU,CAAC,CASjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEpE;AAED,wBAAgB,oCAAoC,CAClD,eAAe,EAAE,eAAe,GAC/B,GAAG,CAAC,UAAU,CAAC,CAiBjB;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAQrE;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAEtE"}
@@ -13,7 +13,7 @@ export declare function getPlayerTrinketsForCacheFlag(player: EntityPlayer, cach
13
13
  * This function can only be called if at least one callback has been executed. This is because not
14
14
  * all trinkets will necessarily be present when a mod first loads (due to mod load order).
15
15
  */
16
- export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): Set<TrinketType>;
16
+ export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): ReadonlySet<TrinketType>;
17
17
  /** Helper function to check in the item config if a given trinket has a given cache flag. */
18
18
  export declare function trinketHasCacheFlag(trinketType: TrinketType, cacheFlag: CacheFlag): boolean;
19
19
  //# sourceMappingURL=trinketCacheFlag.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trinketCacheFlag.d.ts","sourceRoot":"","sources":["../../src/functions/trinketCacheFlag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AA2BtE;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,SAAS,GACnB,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAYvB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,GACnB,GAAG,CAAC,WAAW,CAAC,CASlB;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT"}
1
+ {"version":3,"file":"trinketCacheFlag.d.ts","sourceRoot":"","sources":["../../src/functions/trinketCacheFlag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AA0BtE;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,SAAS,GACnB,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAYvB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,GACnB,WAAW,CAAC,WAAW,CAAC,CAS1B;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT"}
@@ -15,8 +15,6 @@ local ____enums = require("functions.enums")
15
15
  local getEnumValues = ____enums.getEnumValues
16
16
  local ____flag = require("functions.flag")
17
17
  local hasFlag = ____flag.hasFlag
18
- local ____set = require("functions.set")
19
- local copySet = ____set.copySet
20
18
  function lazyInitCacheFlagMap(self)
21
19
  if CACHE_FLAG_TO_TRINKETS_MAP.size > 0 then
22
20
  return
@@ -41,7 +39,7 @@ function ____exports.getTrinketsForCacheFlag(self, cacheFlag)
41
39
  if trinketsSet == nil then
42
40
  return __TS__New(Set)
43
41
  end
44
- return copySet(nil, trinketsSet)
42
+ return trinketsSet
45
43
  end
46
44
  --- Helper function to check in the item config if a given trinket has a given cache flag.
47
45
  function ____exports.trinketHasCacheFlag(self, trinketType, cacheFlag)
@@ -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.
@@ -5662,7 +5651,7 @@ export declare function isDamageFromPlayer(damageSource: Entity): boolean;
5662
5651
  * Uses the player's current health and other miscellaneous things to determine if incoming damage
5663
5652
  * will be fatal.
5664
5653
  */
5665
- export declare function isDamageToPlayerFatal(player: EntityPlayer, damageAmount: int, damageSource: EntityRef, lastDamageGameFrame: int | undefined): boolean;
5654
+ export declare function isDamageToPlayerFatal(player: EntityPlayer, amount: int, source: EntityRef, lastDamageGameFrame: int | undefined): boolean;
5666
5655
 
5667
5656
  /**
5668
5657
  * Helper function to check if the given room grid index is a dead end. Specifically, this is
@@ -6069,7 +6058,7 @@ export declare function isSack(pickup: EntityPickup): pickup is EntityPickupSack
6069
6058
  export declare function isSecretRoomDoor(door: GridEntityDoor): boolean;
6070
6059
 
6071
6060
  /**
6072
- * Helper function to determine whether damage to a player in the EntityTakeDmg callback was
6061
+ * Helper function to determine whether damage to a player in the `ENTITY_TAKE_DMG` callback was
6073
6062
  * self-inflicted. For example, damage from a Curse Room door, a Razor, or a Blood Donation Machine
6074
6063
  * would count as self-inflicted damage.
6075
6064
  */
@@ -8705,7 +8694,7 @@ collectibleType?: CollectibleType
8705
8694
  ];
8706
8695
 
8707
8696
  declare type PostPlayerFatalDamageRegisterParameters = [
8708
- callback: (player: EntityPlayer, damageAmount: float, damageFlags: BitFlags<DamageFlag>, damageSource: EntityRef, damageCountdownFrames: int) => boolean | undefined,
8697
+ callback: (player: EntityPlayer, amount: float, damageFlags: BitFlags<DamageFlag>, source: EntityRef, countdownFrames: int) => boolean | undefined,
8709
8698
  playerVariant?: PlayerVariant,
8710
8699
  character?: PlayerType
8711
8700
  ];
@@ -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.4",
3
+ "version": "8.5.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.0"
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
  }