isaacscript-common 51.2.1 → 51.2.2

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 (49) hide show
  1. package/dist/index.rollup.d.ts +15 -3
  2. package/dist/isaacscript-common.lua +123 -101
  3. package/dist/src/arrays/cachedEnumValues.d.ts +2 -1
  4. package/dist/src/arrays/cachedEnumValues.d.ts.map +1 -1
  5. package/dist/src/arrays/cachedEnumValues.lua +2 -0
  6. package/dist/src/functions/bosses.d.ts +6 -3
  7. package/dist/src/functions/bosses.d.ts.map +1 -1
  8. package/dist/src/functions/bosses.lua +16 -25
  9. package/dist/src/functions/input.lua +3 -3
  10. package/dist/src/functions/pills.lua +6 -6
  11. package/dist/src/functions/roomShapeWalls.d.ts +9 -1
  12. package/dist/src/functions/roomShapeWalls.d.ts.map +1 -1
  13. package/dist/src/functions/roomShapeWalls.lua +34 -25
  14. package/dist/src/maps/PHDPillConversionsMap.d.ts +3 -0
  15. package/dist/src/maps/PHDPillConversionsMap.d.ts.map +1 -0
  16. package/dist/src/maps/{PHDPillConversions.lua → PHDPillConversionsMap.lua} +1 -1
  17. package/dist/src/maps/collectibleNameToTypeMap.d.ts +1 -2
  18. package/dist/src/maps/collectibleNameToTypeMap.d.ts.map +1 -1
  19. package/dist/src/maps/collectibleNameToTypeMap.lua +20 -12
  20. package/dist/src/maps/entityTypeVariantToBossIDMap.d.ts +3 -0
  21. package/dist/src/maps/entityTypeVariantToBossIDMap.d.ts.map +1 -0
  22. package/dist/src/maps/entityTypeVariantToBossIDMap.lua +26 -0
  23. package/dist/src/maps/falsePHDPillConversionsMap.d.ts +3 -0
  24. package/dist/src/maps/falsePHDPillConversionsMap.d.ts.map +1 -0
  25. package/dist/src/maps/{falsePHDPillConversions.lua → falsePHDPillConversionsMap.lua} +1 -1
  26. package/dist/src/maps/keyboardToStringMap.d.ts +4 -0
  27. package/dist/src/maps/keyboardToStringMap.d.ts.map +1 -0
  28. package/dist/src/maps/{keyboardToString.lua → keyboardToStringMap.lua} +1 -1
  29. package/dist/src/sets/bossSets.d.ts.map +1 -1
  30. package/dist/src/sets/bossSets.lua +19 -27
  31. package/package.json +1 -1
  32. package/src/arrays/cachedEnumValues.ts +3 -0
  33. package/src/functions/bosses.ts +8 -19
  34. package/src/functions/input.ts +2 -2
  35. package/src/functions/pills.ts +4 -4
  36. package/src/functions/roomShapeWalls.ts +79 -75
  37. package/src/maps/PHDPillConversionsMap.ts +23 -0
  38. package/src/maps/collectibleNameToTypeMap.ts +9 -14
  39. package/src/maps/entityTypeVariantToBossIDMap.ts +14 -0
  40. package/src/maps/{falsePHDPillConversions.ts → falsePHDPillConversionsMap.ts} +1 -1
  41. package/src/maps/{keyboardToString.ts → keyboardToStringMap.ts} +1 -1
  42. package/src/sets/bossSets.ts +9 -28
  43. package/dist/src/maps/PHDPillConversions.d.ts +0 -3
  44. package/dist/src/maps/PHDPillConversions.d.ts.map +0 -1
  45. package/dist/src/maps/falsePHDPillConversions.d.ts +0 -3
  46. package/dist/src/maps/falsePHDPillConversions.d.ts.map +0 -1
  47. package/dist/src/maps/keyboardToString.d.ts +0 -4
  48. package/dist/src/maps/keyboardToString.d.ts.map +0 -1
  49. package/src/maps/PHDPillConversions.ts +0 -21
@@ -1,7 +1,5 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__New = ____lualib.__TS__New
3
- local Map = ____lualib.Map
4
- local __TS__ObjectEntries = ____lualib.__TS__ObjectEntries
5
3
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
6
4
  local ____exports = {}
7
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
@@ -9,6 +7,8 @@ local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
9
7
  local LokiVariant = ____isaac_2Dtypescript_2Ddefinitions.LokiVariant
10
8
  local ____constants = require("src.core.constants")
11
9
  local VectorZero = ____constants.VectorZero
10
+ local ____entityTypeVariantToBossIDMap = require("src.maps.entityTypeVariantToBossIDMap")
11
+ local ENTITY_TYPE_VARIANT_TO_BOSS_ID_MAP = ____entityTypeVariantToBossIDMap.ENTITY_TYPE_VARIANT_TO_BOSS_ID_MAP
12
12
  local ____bossIDToEntityTypeVariant = require("src.objects.bossIDToEntityTypeVariant")
13
13
  local BOSS_ID_TO_ENTITY_TYPE_VARIANT = ____bossIDToEntityTypeVariant.BOSS_ID_TO_ENTITY_TYPE_VARIANT
14
14
  local ____bossSets = require("src.sets.bossSets")
@@ -39,18 +39,6 @@ local BOSSES_THAT_REQUIRE_MULTIPLE_SPAWNS = __TS__New(ReadonlySet, {
39
39
  EntityType.TURDLET
40
40
  })
41
41
  local DEFAULT_BOSS_MULTI_SEGMENTS = 4
42
- local ENTITY_TYPE_VARIANT_TO_BOSS_ID = (function()
43
- local entityTypeVariantToBossID = __TS__New(Map)
44
- for ____, ____value in ipairs(__TS__ObjectEntries(BOSS_ID_TO_ENTITY_TYPE_VARIANT)) do
45
- local bossIDRaw = ____value[1]
46
- local entityTypeVariant = ____value[2]
47
- local bossID = bossIDRaw
48
- local entityType, variant = table.unpack(entityTypeVariant)
49
- local entityTypeVariantString = (tostring(entityType) .. ".") .. tostring(variant)
50
- entityTypeVariantToBossID:set(entityTypeVariantString, bossID)
51
- end
52
- return entityTypeVariantToBossID
53
- end)(nil)
54
42
  --- Helper function to get all of the non-dead bosses in the room.
55
43
  --
56
44
  -- This function will not include bosses on an internal blacklist, such as Death's scythes or Big
@@ -90,11 +78,14 @@ function ____exports.getAliveBosses(self, entityType, variant, subType, ignoreFr
90
78
  end
91
79
  --- Helper function to get the set of every boss in the game.
92
80
  --
93
- -- Note that this set does not include:
81
+ -- This includes:
82
+ -- - Ultra Greed
83
+ --
84
+ -- This does not include:
94
85
  -- - mini-bosses (e.g. Ultra Pride, Krampus)
95
86
  -- - bosses that do not appear in Boss Rooms (e.g. Uriel, Gabriel)
96
- -- - the second phase of multi-phase bosses (e.g. Mega Satan 2, Ultra Famine, Ultra Pestilence,
97
- -- Ultra War, Ultra Death)
87
+ -- - the second phase of multi-phase bosses (e.g. Mega Satan 2)
88
+ -- - sub-bosses of The Beast Fight (e.g. Ultra Famine, Ultra Pestilence, Ultra War, Ultra Death)
98
89
  -- - bosses that do not have any Boss Rooms defined due to being unfinished (e.g. Raglich)
99
90
  --
100
91
  -- Also see the `getBossSet` and `getCombinedBossSet` functions.
@@ -109,7 +100,7 @@ function ____exports.getAllBossesSet(self, includeStoryBosses)
109
100
  end
110
101
  function ____exports.getBossIDFromEntityTypeVariant(self, entityType, variant)
111
102
  local entityTypeVariant = (tostring(entityType) .. ".") .. tostring(variant)
112
- return ENTITY_TYPE_VARIANT_TO_BOSS_ID:get(entityTypeVariant)
103
+ return ENTITY_TYPE_VARIANT_TO_BOSS_ID_MAP:get(entityTypeVariant)
113
104
  end
114
105
  --- Helper function to get the set of vanilla bosses for a particular stage and stage type
115
106
  -- combination.
@@ -167,21 +158,21 @@ local function getNumBossSegments(self, entityType, variant, numSegments)
167
158
  return numSegments
168
159
  end
169
160
  repeat
170
- local ____switch18 = entityType
171
- local ____cond18 = ____switch18 == EntityType.CHUB
172
- if ____cond18 then
161
+ local ____switch15 = entityType
162
+ local ____cond15 = ____switch15 == EntityType.CHUB
163
+ if ____cond15 then
173
164
  do
174
165
  return 3
175
166
  end
176
167
  end
177
- ____cond18 = ____cond18 or ____switch18 == EntityType.LOKI
178
- if ____cond18 then
168
+ ____cond15 = ____cond15 or ____switch15 == EntityType.LOKI
169
+ if ____cond15 then
179
170
  do
180
171
  return variant == asNumber(nil, LokiVariant.LOKII) and 2 or 1
181
172
  end
182
173
  end
183
- ____cond18 = ____cond18 or ____switch18 == EntityType.GURGLING
184
- if ____cond18 then
174
+ ____cond15 = ____cond15 or ____switch15 == EntityType.GURGLING
175
+ if ____cond15 then
185
176
  do
186
177
  return 2
187
178
  end
@@ -10,8 +10,8 @@ local ControllerIndex = ____isaac_2Dtypescript_2Ddefinitions.ControllerIndex
10
10
  local Keyboard = ____isaac_2Dtypescript_2Ddefinitions.Keyboard
11
11
  local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
12
12
  local CONTROLLER_INDEX_VALUES = ____cachedEnumValues.CONTROLLER_INDEX_VALUES
13
- local ____keyboardToString = require("src.maps.keyboardToString")
14
- local KEYBOARD_TO_STRING = ____keyboardToString.KEYBOARD_TO_STRING
13
+ local ____keyboardToStringMap = require("src.maps.keyboardToStringMap")
14
+ local KEYBOARD_TO_STRING_MAP = ____keyboardToStringMap.KEYBOARD_TO_STRING_MAP
15
15
  local ____ReadonlySet = require("src.types.ReadonlySet")
16
16
  local ReadonlySet = ____ReadonlySet.ReadonlySet
17
17
  local ____string = require("src.functions.string")
@@ -200,7 +200,7 @@ end
200
200
  -- return undefined for e.g. `Keyboard.LEFT_SHIFT` (340). If all you want is the corresponding name
201
201
  -- of the key, then simply use the enum reverse mapping (e.g. `Keyboard[keyboard]`).
202
202
  function ____exports.keyboardToString(self, keyboard, uppercase)
203
- local tuple = KEYBOARD_TO_STRING:get(keyboard)
203
+ local tuple = KEYBOARD_TO_STRING_MAP:get(keyboard)
204
204
  if tuple == nil then
205
205
  return nil
206
206
  end
@@ -14,10 +14,10 @@ local FIRST_PILL_COLOR = ____constantsFirstLast.FIRST_PILL_COLOR
14
14
  local LAST_HORSE_PILL_COLOR = ____constantsFirstLast.LAST_HORSE_PILL_COLOR
15
15
  local LAST_NORMAL_PILL_COLOR = ____constantsFirstLast.LAST_NORMAL_PILL_COLOR
16
16
  local LAST_VANILLA_PILL_EFFECT = ____constantsFirstLast.LAST_VANILLA_PILL_EFFECT
17
- local ____PHDPillConversions = require("src.maps.PHDPillConversions")
18
- local PHD_PILL_CONVERSIONS = ____PHDPillConversions.PHD_PILL_CONVERSIONS
19
- local ____falsePHDPillConversions = require("src.maps.falsePHDPillConversions")
20
- local FALSE_PHD_PILL_CONVERSIONS = ____falsePHDPillConversions.FALSE_PHD_PILL_CONVERSIONS
17
+ local ____PHDPillConversionsMap = require("src.maps.PHDPillConversionsMap")
18
+ local PHD_PILL_CONVERSIONS_MAP = ____PHDPillConversionsMap.PHD_PILL_CONVERSIONS_MAP
19
+ local ____falsePHDPillConversionsMap = require("src.maps.falsePHDPillConversionsMap")
20
+ local FALSE_PHD_PILL_CONVERSIONS_MAP = ____falsePHDPillConversionsMap.FALSE_PHD_PILL_CONVERSIONS_MAP
21
21
  local ____pillEffectClasses = require("src.objects.pillEffectClasses")
22
22
  local DEFAULT_PILL_EFFECT_CLASS = ____pillEffectClasses.DEFAULT_PILL_EFFECT_CLASS
23
23
  local PILL_EFFECT_CLASSES = ____pillEffectClasses.PILL_EFFECT_CLASSES
@@ -49,7 +49,7 @@ end
49
49
  --- Helper function to get the associated pill effect after False PHD is acquired. If a pill effect
50
50
  -- is not altered by False PHD, then the same pill effect will be returned.
51
51
  function ____exports.getFalsePHDPillEffect(self, pillEffect)
52
- local convertedPillEffect = FALSE_PHD_PILL_CONVERSIONS:get(pillEffect)
52
+ local convertedPillEffect = FALSE_PHD_PILL_CONVERSIONS_MAP:get(pillEffect)
53
53
  return convertedPillEffect or pillEffect
54
54
  end
55
55
  --- Helper function to get the corresponding horse pill color from a normal pill color.
@@ -82,7 +82,7 @@ end
82
82
  --- Helper function to get the associated pill effect after PHD is acquired. If a pill effect is not
83
83
  -- altered by PHD, then the same pill effect will be returned.
84
84
  function ____exports.getPHDPillEffect(self, pillEffect)
85
- local convertedPillEffect = PHD_PILL_CONVERSIONS:get(pillEffect)
85
+ local convertedPillEffect = PHD_PILL_CONVERSIONS_MAP:get(pillEffect)
86
86
  return convertedPillEffect or pillEffect
87
87
  end
88
88
  --- Helper function to get the corresponding pill color from an effect by repeatedly using the
@@ -1,4 +1,12 @@
1
- /// <reference types="isaac-typescript-definitions" />
1
+ import { RoomShape } from "isaac-typescript-definitions";
2
+ /**
3
+ * Helper function to get the set of grid indexes that represent where the walls are supposed to be
4
+ * in a given room shape.
5
+ *
6
+ * This function only works reliably in vanilla rooms because in a modded room, it is possible to
7
+ * place walls in a non-standard location.
8
+ */
9
+ export declare function getVanillaWallGridIndexSetForRoomShape(roomShape: RoomShape): ReadonlySet<int>;
2
10
  /**
3
11
  * Helper function to determine if a given grid index should have a wall generated by the vanilla
4
12
  * game. This is useful as a mechanism to distinguish between real walls and custom walls spawned by
@@ -1 +1 @@
1
- {"version":3,"file":"roomShapeWalls.d.ts","sourceRoot":"","sources":["../../../src/functions/roomShapeWalls.ts"],"names":[],"mappings":";AAwTA;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAmB9D"}
1
+ {"version":3,"file":"roomShapeWalls.d.ts","sourceRoot":"","sources":["../../../src/functions/roomShapeWalls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,SAAS,EAAE,MAAM,8BAA8B,CAAC;AA+EjE;;;;;;GAMG;AACH,wBAAgB,sCAAsC,CACpD,SAAS,EAAE,SAAS,GACnB,WAAW,CAAC,GAAG,CAAC,CAsLlB;AA8CD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAmB9D"}
@@ -1,11 +1,11 @@
1
1
  local ____lualib = require("lualib_bundle")
2
- local Map = ____lualib.Map
2
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
3
3
  local __TS__New = ____lualib.__TS__New
4
4
  local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
5
5
  local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
6
6
  local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
7
7
  local ____exports = {}
8
- local getVanillaWallGridIndexSetForRoomShape, getWallGridIndexSetForRectangleRoomShape
8
+ local getVanillaWallGridIndexSetForRectangleRoomShape
9
9
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
10
10
  local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
11
11
  local RoomShape = ____isaac_2Dtypescript_2Ddefinitions.RoomShape
@@ -15,6 +15,8 @@ local ____cachedClasses = require("src.core.cachedClasses")
15
15
  local game = ____cachedClasses.game
16
16
  local ____CornerType = require("src.enums.CornerType")
17
17
  local CornerType = ____CornerType.CornerType
18
+ local ____ReadonlyMap = require("src.types.ReadonlyMap")
19
+ local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
18
20
  local ____ReadonlySet = require("src.types.ReadonlySet")
19
21
  local ReadonlySet = ____ReadonlySet.ReadonlySet
20
22
  local ____gridIndex = require("src.functions.gridIndex")
@@ -27,16 +29,21 @@ local inBossRoomOf = ____rooms.inBossRoomOf
27
29
  local inHomeCloset = ____rooms.inHomeCloset
28
30
  local ____utils = require("src.functions.utils")
29
31
  local assertDefined = ____utils.assertDefined
30
- function getVanillaWallGridIndexSetForRoomShape(self, roomShape)
32
+ --- Helper function to get the set of grid indexes that represent where the walls are supposed to be
33
+ -- in a given room shape.
34
+ --
35
+ -- This function only works reliably in vanilla rooms because in a modded room, it is possible to
36
+ -- place walls in a non-standard location.
37
+ function ____exports.getVanillaWallGridIndexSetForRoomShape(self, roomShape)
31
38
  local corners = getRoomShapeCorners(nil, roomShape)
32
39
  local lRoom = isLRoomShape(nil, roomShape)
33
40
  if lRoom and #corners ~= 6 then
34
41
  error(((("Failed to get the correct amount of corners for: RoomShape." .. RoomShape[roomShape]) .. " (") .. tostring(roomShape)) .. ")")
35
42
  end
36
43
  repeat
37
- local ____switch7 = roomShape
38
- local ____cond7 = ____switch7 == RoomShape.LTL
39
- if ____cond7 then
44
+ local ____switch5 = roomShape
45
+ local ____cond5 = ____switch5 == RoomShape.LTL
46
+ if ____cond5 then
40
47
  do
41
48
  local topMiddle, topRight, middleLeft, middle, bottomLeft, bottomRight = table.unpack(corners)
42
49
  local ____ReadonlySet_1 = ReadonlySet
@@ -67,8 +74,8 @@ function getVanillaWallGridIndexSetForRoomShape(self, roomShape)
67
74
  )
68
75
  end
69
76
  end
70
- ____cond7 = ____cond7 or ____switch7 == RoomShape.LTR
71
- if ____cond7 then
77
+ ____cond5 = ____cond5 or ____switch5 == RoomShape.LTR
78
+ if ____cond5 then
72
79
  do
73
80
  local topLeft, topMiddle, middle, middleRight, bottomLeft, bottomRight = table.unpack(corners)
74
81
  local ____ReadonlySet_3 = ReadonlySet
@@ -99,8 +106,8 @@ function getVanillaWallGridIndexSetForRoomShape(self, roomShape)
99
106
  )
100
107
  end
101
108
  end
102
- ____cond7 = ____cond7 or ____switch7 == RoomShape.LBL
103
- if ____cond7 then
109
+ ____cond5 = ____cond5 or ____switch5 == RoomShape.LBL
110
+ if ____cond5 then
104
111
  do
105
112
  local topLeft, topRight, middleLeft, middle, bottomMiddle, bottomRight = table.unpack(corners)
106
113
  local ____ReadonlySet_5 = ReadonlySet
@@ -131,8 +138,8 @@ function getVanillaWallGridIndexSetForRoomShape(self, roomShape)
131
138
  )
132
139
  end
133
140
  end
134
- ____cond7 = ____cond7 or ____switch7 == RoomShape.LBR
135
- if ____cond7 then
141
+ ____cond5 = ____cond5 or ____switch5 == RoomShape.LBR
142
+ if ____cond5 then
136
143
  do
137
144
  local topLeft, topRight, middle, middleRight, bottomLeft, bottomMiddle = table.unpack(corners)
138
145
  local ____ReadonlySet_7 = ReadonlySet
@@ -165,12 +172,12 @@ function getVanillaWallGridIndexSetForRoomShape(self, roomShape)
165
172
  end
166
173
  do
167
174
  do
168
- return getWallGridIndexSetForRectangleRoomShape(nil, roomShape, corners)
175
+ return getVanillaWallGridIndexSetForRectangleRoomShape(nil, roomShape, corners)
169
176
  end
170
177
  end
171
178
  until true
172
179
  end
173
- function getWallGridIndexSetForRectangleRoomShape(self, roomShape, corners)
180
+ function getVanillaWallGridIndexSetForRectangleRoomShape(self, roomShape, corners)
174
181
  if #corners ~= 4 then
175
182
  error("Failed to get the correct amount of corners for rectangular room shape.")
176
183
  end
@@ -194,14 +201,16 @@ function getWallGridIndexSetForRectangleRoomShape(self, roomShape, corners)
194
201
  {__TS__SparseArraySpread(____array_8)}
195
202
  )
196
203
  end
197
- local ROOM_SHAPE_TO_WALL_GRID_INDEX_SET = (function()
198
- local roomShapeToWallGridIndexSet = __TS__New(Map)
199
- for ____, roomShape in ipairs(ROOM_SHAPE_VALUES) do
200
- local gridIndexSet = getVanillaWallGridIndexSetForRoomShape(nil, roomShape)
201
- roomShapeToWallGridIndexSet:set(roomShape, gridIndexSet)
202
- end
203
- return roomShapeToWallGridIndexSet
204
- end)(nil)
204
+ local ROOM_SHAPE_TO_WALL_GRID_INDEX_MAP = __TS__New(
205
+ ReadonlyMap,
206
+ __TS__ArrayMap(
207
+ ROOM_SHAPE_VALUES,
208
+ function(____, roomShape) return {
209
+ roomShape,
210
+ ____exports.getVanillaWallGridIndexSetForRoomShape(nil, roomShape)
211
+ } end
212
+ )
213
+ )
205
214
  --- The Home closet is is 9x3, which is different from `RoomShape.IH` (which is 13x3).
206
215
  local HOME_CLOSET_CORNERS = {
207
216
  {
@@ -225,7 +234,7 @@ local HOME_CLOSET_CORNERS = {
225
234
  position = Vector(340, 340)
226
235
  }
227
236
  }
228
- local HOME_CLOSET_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(nil, RoomShape.IH, HOME_CLOSET_CORNERS)
237
+ local HOME_CLOSET_CORNERS_SET = getVanillaWallGridIndexSetForRectangleRoomShape(nil, RoomShape.IH, HOME_CLOSET_CORNERS)
229
238
  --- The Mother Boss Room is 15x11, which is different from `RoomShape.SHAPE_1x2` (which is 15x16).
230
239
  local MOTHER_ROOM_CORNERS = {
231
240
  {
@@ -249,7 +258,7 @@ local MOTHER_ROOM_CORNERS = {
249
258
  position = Vector(580, 500)
250
259
  }
251
260
  }
252
- local MOTHER_ROOM_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(nil, RoomShape.SHAPE_1x2, MOTHER_ROOM_CORNERS)
261
+ local MOTHER_ROOM_CORNERS_SET = getVanillaWallGridIndexSetForRectangleRoomShape(nil, RoomShape.SHAPE_1x2, MOTHER_ROOM_CORNERS)
253
262
  --- Helper function to determine if a given grid index should have a wall generated by the vanilla
254
263
  -- game. This is useful as a mechanism to distinguish between real walls and custom walls spawned by
255
264
  -- mods.
@@ -265,7 +274,7 @@ function ____exports.isVanillaWallGridIndex(self, gridIndex)
265
274
  elseif inBossRoomOf(nil, BossID.MOTHER) then
266
275
  wallGridIndexSet = MOTHER_ROOM_CORNERS_SET
267
276
  else
268
- wallGridIndexSet = ROOM_SHAPE_TO_WALL_GRID_INDEX_SET:get(roomShape)
277
+ wallGridIndexSet = ROOM_SHAPE_TO_WALL_GRID_INDEX_MAP:get(roomShape)
269
278
  assertDefined(
270
279
  nil,
271
280
  wallGridIndexSet,
@@ -0,0 +1,3 @@
1
+ import { PillEffect } from "isaac-typescript-definitions";
2
+ export declare const PHD_PILL_CONVERSIONS_MAP: ReadonlyMap<PillEffect, PillEffect>;
3
+ //# sourceMappingURL=PHDPillConversionsMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PHDPillConversionsMap.d.ts","sourceRoot":"","sources":["../../../src/maps/PHDPillConversionsMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,eAAO,MAAM,wBAAwB,qCAmBpC,CAAC"}
@@ -5,7 +5,7 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
5
5
  local PillEffect = ____isaac_2Dtypescript_2Ddefinitions.PillEffect
6
6
  local ____ReadonlyMap = require("src.types.ReadonlyMap")
7
7
  local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
8
- ____exports.PHD_PILL_CONVERSIONS = __TS__New(ReadonlyMap, {
8
+ ____exports.PHD_PILL_CONVERSIONS_MAP = __TS__New(ReadonlyMap, {
9
9
  {PillEffect.BAD_TRIP, PillEffect.BALLS_OF_STEEL},
10
10
  {PillEffect.HEALTH_DOWN, PillEffect.HEALTH_UP},
11
11
  {PillEffect.RANGE_DOWN, PillEffect.RANGE_UP},
@@ -1,8 +1,7 @@
1
- import type { CollectibleType } from "isaac-typescript-definitions";
2
1
  /**
3
2
  * Maps collectible names to the values of the `CollectibleType` enum.
4
3
  *
5
4
  * For a mapping of `CollectibleType` to name, see `COLLECTIBLE_TYPE_TO_NAME_MAP`.
6
5
  */
7
- export declare const COLLECTIBLE_NAME_TO_TYPE_MAP: ReadonlyMap<string, CollectibleType>;
6
+ export declare const COLLECTIBLE_NAME_TO_TYPE_MAP: ReadonlyMap<string, import("isaac-typescript-definitions").CollectibleType>;
8
7
  //# sourceMappingURL=collectibleNameToTypeMap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collectibleNameToTypeMap.d.ts","sourceRoot":"","sources":["../../../src/maps/collectibleNameToTypeMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAIpE;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,WAAW,CACpD,MAAM,EACN,eAAe,CAUb,CAAC"}
1
+ {"version":3,"file":"collectibleNameToTypeMap.d.ts","sourceRoot":"","sources":["../../../src/maps/collectibleNameToTypeMap.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,6EAOxC,CAAC"}
@@ -1,23 +1,31 @@
1
1
  local ____lualib = require("lualib_bundle")
2
- local Map = ____lualib.Map
2
+ local __TS__Spread = ____lualib.__TS__Spread
3
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
3
4
  local __TS__New = ____lualib.__TS__New
4
- local __TS__Iterator = ____lualib.__TS__Iterator
5
5
  local ____exports = {}
6
6
  local ____string = require("src.functions.string")
7
7
  local removeNonAlphanumericCharacters = ____string.removeNonAlphanumericCharacters
8
+ local ____ReadonlyMap = require("src.types.ReadonlyMap")
9
+ local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
8
10
  local ____collectibleTypeToNameMap = require("src.maps.collectibleTypeToNameMap")
9
11
  local COLLECTIBLE_TYPE_TO_NAME_MAP = ____collectibleTypeToNameMap.COLLECTIBLE_TYPE_TO_NAME_MAP
10
12
  --- Maps collectible names to the values of the `CollectibleType` enum.
11
13
  --
12
14
  -- For a mapping of `CollectibleType` to name, see `COLLECTIBLE_TYPE_TO_NAME_MAP`.
13
- ____exports.COLLECTIBLE_NAME_TO_TYPE_MAP = (function()
14
- local collectibleNameToTypeMap = __TS__New(Map)
15
- for ____, ____value in __TS__Iterator(COLLECTIBLE_TYPE_TO_NAME_MAP) do
16
- local collectibleType = ____value[1]
17
- local name = ____value[2]
18
- local simpleString = removeNonAlphanumericCharacters(nil, name)
19
- collectibleNameToTypeMap:set(simpleString, collectibleType)
20
- end
21
- return collectibleNameToTypeMap
22
- end)(nil)
15
+ ____exports.COLLECTIBLE_NAME_TO_TYPE_MAP = __TS__New(
16
+ ReadonlyMap,
17
+ __TS__ArrayMap(
18
+ {__TS__Spread(COLLECTIBLE_TYPE_TO_NAME_MAP:entries())},
19
+ function(____, ____bindingPattern0)
20
+ local collectibleName
21
+ local collectibleType
22
+ collectibleType = ____bindingPattern0[1]
23
+ collectibleName = ____bindingPattern0[2]
24
+ return {
25
+ removeNonAlphanumericCharacters(nil, collectibleName),
26
+ collectibleType
27
+ }
28
+ end
29
+ )
30
+ )
23
31
  return ____exports
@@ -0,0 +1,3 @@
1
+ import type { BossID } from "isaac-typescript-definitions";
2
+ export declare const ENTITY_TYPE_VARIANT_TO_BOSS_ID_MAP: ReadonlyMap<string, BossID>;
3
+ //# sourceMappingURL=entityTypeVariantToBossIDMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entityTypeVariantToBossIDMap.d.ts","sourceRoot":"","sources":["../../../src/maps/entityTypeVariantToBossIDMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAI3D,eAAO,MAAM,kCAAkC,6BAS9C,CAAC"}
@@ -0,0 +1,26 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__ObjectEntries = ____lualib.__TS__ObjectEntries
3
+ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
4
+ local __TS__New = ____lualib.__TS__New
5
+ local ____exports = {}
6
+ local ____bossIDToEntityTypeVariant = require("src.objects.bossIDToEntityTypeVariant")
7
+ local BOSS_ID_TO_ENTITY_TYPE_VARIANT = ____bossIDToEntityTypeVariant.BOSS_ID_TO_ENTITY_TYPE_VARIANT
8
+ local ____ReadonlyMap = require("src.types.ReadonlyMap")
9
+ local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
10
+ ____exports.ENTITY_TYPE_VARIANT_TO_BOSS_ID_MAP = __TS__New(
11
+ ReadonlyMap,
12
+ __TS__ArrayMap(
13
+ {table.unpack(__TS__ObjectEntries(BOSS_ID_TO_ENTITY_TYPE_VARIANT))},
14
+ function(____, ____bindingPattern0)
15
+ local entityTypeVariant
16
+ local bossIDRaw
17
+ bossIDRaw = ____bindingPattern0[1]
18
+ entityTypeVariant = ____bindingPattern0[2]
19
+ local bossID = bossIDRaw
20
+ local entityType, variant = table.unpack(entityTypeVariant)
21
+ local entityTypeVariantString = (tostring(entityType) .. ".") .. tostring(variant)
22
+ return {entityTypeVariantString, bossID}
23
+ end
24
+ )
25
+ )
26
+ return ____exports
@@ -0,0 +1,3 @@
1
+ import { PillEffect } from "isaac-typescript-definitions";
2
+ export declare const FALSE_PHD_PILL_CONVERSIONS_MAP: ReadonlyMap<PillEffect, PillEffect>;
3
+ //# sourceMappingURL=falsePHDPillConversionsMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"falsePHDPillConversionsMap.d.ts","sourceRoot":"","sources":["../../../src/maps/falsePHDPillConversionsMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,eAAO,MAAM,8BAA8B,qCAkCzC,CAAC"}
@@ -5,7 +5,7 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
5
5
  local PillEffect = ____isaac_2Dtypescript_2Ddefinitions.PillEffect
6
6
  local ____ReadonlyMap = require("src.types.ReadonlyMap")
7
7
  local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
8
- ____exports.FALSE_PHD_PILL_CONVERSIONS = __TS__New(ReadonlyMap, {
8
+ ____exports.FALSE_PHD_PILL_CONVERSIONS_MAP = __TS__New(ReadonlyMap, {
9
9
  {PillEffect.BAD_GAS, PillEffect.HEALTH_DOWN},
10
10
  {PillEffect.BALLS_OF_STEEL, PillEffect.BAD_TRIP},
11
11
  {PillEffect.BOMBS_ARE_KEYS, PillEffect.TEARS_DOWN},
@@ -0,0 +1,4 @@
1
+ import { Keyboard } from "isaac-typescript-definitions";
2
+ /** Maps each keyboard enum member to its corresponding lowercase and uppercase characters. */
3
+ export declare const KEYBOARD_TO_STRING_MAP: ReadonlyMap<Keyboard, readonly [lowercaseCharacter: string, uppercaseCharacter: string]>;
4
+ //# sourceMappingURL=keyboardToStringMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboardToStringMap.d.ts","sourceRoot":"","sources":["../../../src/maps/keyboardToStringMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGxD,8FAA8F;AAC9F,eAAO,MAAM,sBAAsB,0FAyEjC,CAAC"}
@@ -6,7 +6,7 @@ local Keyboard = ____isaac_2Dtypescript_2Ddefinitions.Keyboard
6
6
  local ____ReadonlyMap = require("src.types.ReadonlyMap")
7
7
  local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
8
8
  --- Maps each keyboard enum member to its corresponding lowercase and uppercase characters.
9
- ____exports.KEYBOARD_TO_STRING = __TS__New(ReadonlyMap, {
9
+ ____exports.KEYBOARD_TO_STRING_MAP = __TS__New(ReadonlyMap, {
10
10
  {Keyboard.SPACE, {" ", " "}},
11
11
  {Keyboard.APOSTROPHE, {"'", "\""}},
12
12
  {Keyboard.COMMA, {",", "<"}},
@@ -1 +1 @@
1
- {"version":3,"file":"bossSets.d.ts","sourceRoot":"","sources":["../../../src/sets/bossSets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAa,MAAM,8BAA8B,CAAC;AA8e7E,eAAO,MAAM,mCAAmC,gEAiB9C,CAAC;AAEH,eAAO,MAAM,8BAA8B,8CAiBzC,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,MAAM,CAU9C,CAAC;AAyBF,eAAO,MAAM,qCAAqC,EAAE,WAAW,CAAC,MAAM,CAMhE,CAAC"}
1
+ {"version":3,"file":"bossSets.d.ts","sourceRoot":"","sources":["../../../src/sets/bossSets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAa,MAAM,8BAA8B,CAAC;AA6e7E,eAAO,MAAM,mCAAmC,gEAiB9C,CAAC;AAEH,eAAO,MAAM,8BAA8B,8CAiBzC,CAAC;AAEH,eAAO,MAAM,cAAc,qBAE1B,CAAC;AAmBF,eAAO,MAAM,qCAAqC,qBAEjD,CAAC"}
@@ -1,21 +1,20 @@
1
1
  local ____lualib = require("lualib_bundle")
2
2
  local __TS__New = ____lualib.__TS__New
3
- local Set = ____lualib.Set
3
+ local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
4
+ local __TS__Spread = ____lualib.__TS__Spread
4
5
  local ____exports = {}
5
6
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
7
  local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
7
8
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
8
9
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
10
+ local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
11
+ local BOSS_IDS = ____cachedEnumValues.BOSS_IDS
9
12
  local ____set = require("src.functions.set")
10
13
  local combineSets = ____set.combineSets
11
- local copySet = ____set.copySet
12
- local deleteSetsFromSet = ____set.deleteSetsFromSet
13
14
  local ____ReadonlyMap = require("src.types.ReadonlyMap")
14
15
  local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
15
16
  local ____ReadonlySet = require("src.types.ReadonlySet")
16
17
  local ReadonlySet = ____ReadonlySet.ReadonlySet
17
- local ____storyBossesSet = require("src.sets.storyBossesSet")
18
- local STORY_BOSSES_SET = ____storyBossesSet.STORY_BOSSES_SET
19
18
  --- Contains just the bosses in Basement (not e.g. Burning Basement).
20
19
  local BASEMENT_BOSSES_SET = __TS__New(ReadonlySet, {
21
20
  BossID.MONSTRO,
@@ -306,14 +305,13 @@ local SCARRED_WOMB_BOSSES_SET = __TS__New(ReadonlySet, {
306
305
  --
307
306
  -- Note that this set includes Mother, even though they are not technically in the boss pool.
308
307
  local CORPSE_BOSSES_SET = __TS__New(ReadonlySet, {BossID.SCOURGE, BossID.CHIMERA, BossID.ROTGUT, BossID.MOTHER})
309
- --- The set of unique bosses for Depths, Necropolis, and so on.
308
+ --- The set of unique bosses for Womb, Utero, and so on.
310
309
  local ALL_WOMB_BOSSES_SET = combineSets(
311
310
  nil,
312
311
  WOMB_BOSSES_SET,
313
312
  UTERO_BOSSES_SET,
314
313
  SCARRED_WOMB_BOSSES_SET,
315
- MAUSOLEUM_BOSSES_SET,
316
- GEHENNA_BOSSES_SET
314
+ CORPSE_BOSSES_SET
317
315
  )
318
316
  local WOMB_STAGE_TYPE_TO_BOSS_SET_MAP = __TS__New(ReadonlyMap, {{StageType.ORIGINAL, WOMB_BOSSES_SET}, {StageType.WRATH_OF_THE_LAMB, UTERO_BOSSES_SET}, {StageType.AFTERBIRTH, SCARRED_WOMB_BOSSES_SET}, {StageType.REPENTANCE, CORPSE_BOSSES_SET}})
319
317
  local BLUE_WOMB_BOSSES_SET = __TS__New(ReadonlySet, {BossID.HUSH})
@@ -363,17 +361,12 @@ ____exports.STAGE_TO_COMBINED_BOSS_SET_MAP = __TS__New(ReadonlyMap, {
363
361
  {LevelStage.VOID, VOID_BOSSES_SET},
364
362
  {LevelStage.HOME, HOME_BOSSES_SET}
365
363
  })
366
- ____exports.ALL_BOSSES_SET = combineSets(
367
- nil,
368
- ALL_BASEMENT_BOSSES_SET,
369
- ALL_CAVES_BOSSES_SET,
370
- ALL_DEPTHS_BOSSES_SET,
371
- ALL_WOMB_BOSSES_SET,
372
- BLUE_WOMB_BOSSES_SET,
373
- ALL_STAGE_10_BOSSES_SET,
374
- ALL_STAGE_11_BOSSES_SET,
375
- VOID_BOSSES_SET,
376
- HOME_BOSSES_SET
364
+ ____exports.ALL_BOSSES_SET = __TS__New(
365
+ ReadonlySet,
366
+ __TS__ArrayFilter(
367
+ BOSS_IDS,
368
+ function(____, bossID) return bossID == BossID.RAGLICH end
369
+ )
377
370
  )
378
371
  local STORY_BOSS_IDS_SET = __TS__New(ReadonlySet, {
379
372
  BossID.MOM,
@@ -391,12 +384,11 @@ local STORY_BOSS_IDS_SET = __TS__New(ReadonlySet, {
391
384
  BossID.DOGMA,
392
385
  BossID.BEAST
393
386
  })
394
- if STORY_BOSS_IDS_SET.size + 1 - 2 ~= STORY_BOSSES_SET.size then
395
- error("The \"STORY_BOSS_IDS_SET\" and the \"STORY_BOSSES_SET\" do not match.")
396
- end
397
- ____exports.ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET = (function()
398
- local allBossesSet = copySet(nil, ____exports.ALL_BOSSES_SET)
399
- deleteSetsFromSet(nil, allBossesSet, STORY_BOSS_IDS_SET)
400
- return allBossesSet
401
- end)(nil)
387
+ ____exports.ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET = __TS__New(
388
+ ReadonlySet,
389
+ __TS__ArrayFilter(
390
+ {__TS__Spread(____exports.ALL_BOSSES_SET)},
391
+ function(____, bossID) return not STORY_BOSS_IDS_SET:has(bossID) end
392
+ )
393
+ )
402
394
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "51.2.1",
3
+ "version": "51.2.2",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -2,6 +2,7 @@
2
2
 
3
3
  import {
4
4
  ActiveSlot,
5
+ BossID,
5
6
  CacheFlag,
6
7
  ControllerIndex,
7
8
  DoorSlot,
@@ -28,6 +29,8 @@ import { getEnumValues } from "../functions/enums";
28
29
  export const ACTIVE_SLOT_VALUES: readonly ActiveSlot[] =
29
30
  getEnumValues(ActiveSlot);
30
31
 
32
+ export const BOSS_IDS: readonly BossID[] = getEnumValues(BossID);
33
+
31
34
  export const CACHE_FLAG_VALUES: readonly CacheFlag[] = getEnumValues(CacheFlag);
32
35
 
33
36
  export const CONTROLLER_INDEX_VALUES: readonly ControllerIndex[] =
@@ -5,6 +5,7 @@ import type {
5
5
  } from "isaac-typescript-definitions";
6
6
  import { EntityType, LokiVariant } from "isaac-typescript-definitions";
7
7
  import { VectorZero } from "../core/constants";
8
+ import { ENTITY_TYPE_VARIANT_TO_BOSS_ID_MAP } from "../maps/entityTypeVariantToBossIDMap";
8
9
  import { BOSS_ID_TO_ENTITY_TYPE_VARIANT } from "../objects/bossIDToEntityTypeVariant";
9
10
  import {
10
11
  ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET,
@@ -30,21 +31,6 @@ const BOSSES_THAT_REQUIRE_MULTIPLE_SPAWNS = new ReadonlySet<EntityType>([
30
31
 
31
32
  const DEFAULT_BOSS_MULTI_SEGMENTS = 4;
32
33
 
33
- const ENTITY_TYPE_VARIANT_TO_BOSS_ID: ReadonlyMap<string, BossID> = (() => {
34
- const entityTypeVariantToBossID = new Map<string, BossID>();
35
-
36
- for (const [bossIDRaw, entityTypeVariant] of Object.entries(
37
- BOSS_ID_TO_ENTITY_TYPE_VARIANT,
38
- )) {
39
- const bossID = bossIDRaw as unknown as BossID;
40
- const [entityType, variant] = entityTypeVariant;
41
- const entityTypeVariantString = `${entityType}.${variant}`;
42
- entityTypeVariantToBossID.set(entityTypeVariantString, bossID);
43
- }
44
-
45
- return entityTypeVariantToBossID;
46
- })();
47
-
48
34
  /**
49
35
  * Helper function to get all of the non-dead bosses in the room.
50
36
  *
@@ -72,11 +58,14 @@ export function getAliveBosses(
72
58
  /**
73
59
  * Helper function to get the set of every boss in the game.
74
60
  *
75
- * Note that this set does not include:
61
+ * This includes:
62
+ * - Ultra Greed
63
+ *
64
+ * This does not include:
76
65
  * - mini-bosses (e.g. Ultra Pride, Krampus)
77
66
  * - bosses that do not appear in Boss Rooms (e.g. Uriel, Gabriel)
78
- * - the second phase of multi-phase bosses (e.g. Mega Satan 2, Ultra Famine, Ultra Pestilence,
79
- * Ultra War, Ultra Death)
67
+ * - the second phase of multi-phase bosses (e.g. Mega Satan 2)
68
+ * - sub-bosses of The Beast Fight (e.g. Ultra Famine, Ultra Pestilence, Ultra War, Ultra Death)
80
69
  * - bosses that do not have any Boss Rooms defined due to being unfinished (e.g. Raglich)
81
70
  *
82
71
  * Also see the `getBossSet` and `getCombinedBossSet` functions.
@@ -97,7 +86,7 @@ export function getBossIDFromEntityTypeVariant(
97
86
  variant: int,
98
87
  ): BossID | undefined {
99
88
  const entityTypeVariant = `${entityType}.${variant}`;
100
- return ENTITY_TYPE_VARIANT_TO_BOSS_ID.get(entityTypeVariant);
89
+ return ENTITY_TYPE_VARIANT_TO_BOSS_ID_MAP.get(entityTypeVariant);
101
90
  }
102
91
 
103
92
  /**