isaacscript-common 51.2.1 → 51.2.3

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 (58) hide show
  1. package/dist/index.rollup.d.ts +18 -5
  2. package/dist/isaacscript-common.lua +128 -106
  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 +8 -4
  7. package/dist/src/functions/bosses.d.ts.map +1 -1
  8. package/dist/src/functions/bosses.lua +18 -26
  9. package/dist/src/functions/entities.d.ts +1 -1
  10. package/dist/src/functions/entities.lua +4 -4
  11. package/dist/src/functions/input.lua +3 -3
  12. package/dist/src/functions/pills.lua +6 -6
  13. package/dist/src/functions/roomShapeWalls.d.ts +9 -1
  14. package/dist/src/functions/roomShapeWalls.d.ts.map +1 -1
  15. package/dist/src/functions/roomShapeWalls.lua +34 -25
  16. package/dist/src/maps/PHDPillConversionsMap.d.ts +3 -0
  17. package/dist/src/maps/PHDPillConversionsMap.d.ts.map +1 -0
  18. package/dist/src/maps/{PHDPillConversions.lua → PHDPillConversionsMap.lua} +1 -1
  19. package/dist/src/maps/collectibleNameToTypeMap.d.ts +1 -2
  20. package/dist/src/maps/collectibleNameToTypeMap.d.ts.map +1 -1
  21. package/dist/src/maps/collectibleNameToTypeMap.lua +20 -12
  22. package/dist/src/maps/entityTypeVariantToBossIDMap.d.ts +3 -0
  23. package/dist/src/maps/entityTypeVariantToBossIDMap.d.ts.map +1 -0
  24. package/dist/src/maps/entityTypeVariantToBossIDMap.lua +26 -0
  25. package/dist/src/maps/falsePHDPillConversionsMap.d.ts +3 -0
  26. package/dist/src/maps/falsePHDPillConversionsMap.d.ts.map +1 -0
  27. package/dist/src/maps/{falsePHDPillConversions.lua → falsePHDPillConversionsMap.lua} +1 -1
  28. package/dist/src/maps/keyboardToStringMap.d.ts +4 -0
  29. package/dist/src/maps/keyboardToStringMap.d.ts.map +1 -0
  30. package/dist/src/maps/{keyboardToString.lua → keyboardToStringMap.lua} +1 -1
  31. package/dist/src/sets/bossSets.d.ts.map +1 -1
  32. package/dist/src/sets/bossSets.lua +19 -27
  33. package/dist/src/sets/storyBossEntityTypesSet.d.ts +3 -0
  34. package/dist/src/sets/storyBossEntityTypesSet.d.ts.map +1 -0
  35. package/dist/src/sets/{storyBossesSet.lua → storyBossEntityTypesSet.lua} +1 -1
  36. package/package.json +1 -1
  37. package/src/arrays/cachedEnumValues.ts +3 -0
  38. package/src/functions/bosses.ts +10 -20
  39. package/src/functions/entities.ts +3 -3
  40. package/src/functions/input.ts +2 -2
  41. package/src/functions/pills.ts +4 -4
  42. package/src/functions/roomShapeWalls.ts +79 -75
  43. package/src/maps/PHDPillConversionsMap.ts +23 -0
  44. package/src/maps/collectibleNameToTypeMap.ts +9 -14
  45. package/src/maps/entityTypeVariantToBossIDMap.ts +14 -0
  46. package/src/maps/{falsePHDPillConversions.ts → falsePHDPillConversionsMap.ts} +1 -1
  47. package/src/maps/{keyboardToString.ts → keyboardToStringMap.ts} +1 -1
  48. package/src/sets/bossSets.ts +9 -28
  49. package/src/sets/{storyBossesSet.ts → storyBossEntityTypesSet.ts} +1 -1
  50. package/dist/src/maps/PHDPillConversions.d.ts +0 -3
  51. package/dist/src/maps/PHDPillConversions.d.ts.map +0 -1
  52. package/dist/src/maps/falsePHDPillConversions.d.ts +0 -3
  53. package/dist/src/maps/falsePHDPillConversions.d.ts.map +0 -1
  54. package/dist/src/maps/keyboardToString.d.ts +0 -4
  55. package/dist/src/maps/keyboardToString.d.ts.map +0 -1
  56. package/dist/src/sets/storyBossesSet.d.ts +0 -3
  57. package/dist/src/sets/storyBossesSet.d.ts.map +0 -1
  58. package/src/maps/PHDPillConversions.ts +0 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "51.2.1",
3
+ "version": "51.2.3",
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
  *
@@ -70,13 +56,17 @@ export function getAliveBosses(
70
56
  }
71
57
 
72
58
  /**
73
- * Helper function to get the set of every boss in the game.
59
+ * Helper function to get the set of every boss in the game (which is derived from the `BossID`
60
+ * enum).
61
+ *
62
+ * This includes:
63
+ * - Ultra Greed
74
64
  *
75
- * Note that this set does not include:
65
+ * This does not include:
76
66
  * - mini-bosses (e.g. Ultra Pride, Krampus)
77
67
  * - 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)
68
+ * - the second phase of multi-phase bosses (e.g. Mega Satan 2)
69
+ * - sub-bosses of The Beast fight (e.g. Ultra Famine, Ultra Pestilence, Ultra War, Ultra Death)
80
70
  * - bosses that do not have any Boss Rooms defined due to being unfinished (e.g. Raglich)
81
71
  *
82
72
  * Also see the `getBossSet` and `getCombinedBossSet` functions.
@@ -97,7 +87,7 @@ export function getBossIDFromEntityTypeVariant(
97
87
  variant: int,
98
88
  ): BossID | undefined {
99
89
  const entityTypeVariant = `${entityType}.${variant}`;
100
- return ENTITY_TYPE_VARIANT_TO_BOSS_ID.get(entityTypeVariant);
90
+ return ENTITY_TYPE_VARIANT_TO_BOSS_ID_MAP.get(entityTypeVariant);
101
91
  }
102
92
 
103
93
  /**
@@ -3,7 +3,7 @@ import { EntityFlag } from "isaac-typescript-definitions";
3
3
  import { game } from "../core/cachedClasses";
4
4
  import { VectorZero } from "../core/constants";
5
5
  import { ENTITIES_WITH_ARMOR_SET } from "../sets/entitiesWithArmorSet";
6
- import { STORY_BOSSES_SET } from "../sets/storyBossesSet";
6
+ import { STORY_BOSS_ENTITY_TYPES_SET } from "../sets/storyBossEntityTypesSet";
7
7
  import type { AnyEntity } from "../types/AnyEntity";
8
8
  import type { EntityID } from "../types/EntityID";
9
9
  import { getIsaacAPIClassName } from "./isaacAPIClass";
@@ -367,10 +367,10 @@ export function isEntityMoving(entity: Entity, threshold = 0.01): boolean {
367
367
  /**
368
368
  * Helper function to determine if the specified entity type is an end-game story boss, like Isaac,
369
369
  * Blue Baby, Mega Satan, The Beast, and so on. This is useful because certain effects should only
370
- * apply to non-story bosses, like Vanishing Twin. Also see the `STORY_BOSSES` constant.
370
+ * apply to non-story bosses, like Vanishing Twin.
371
371
  */
372
372
  export function isStoryBoss(entityType: EntityType): boolean {
373
- return STORY_BOSSES_SET.has(entityType);
373
+ return STORY_BOSS_ENTITY_TYPES_SET.has(entityType);
374
374
  }
375
375
 
376
376
  /**
@@ -5,7 +5,7 @@ import {
5
5
  Keyboard,
6
6
  } from "isaac-typescript-definitions";
7
7
  import { CONTROLLER_INDEX_VALUES } from "../arrays/cachedEnumValues";
8
- import { KEYBOARD_TO_STRING } from "../maps/keyboardToString";
8
+ import { KEYBOARD_TO_STRING_MAP } from "../maps/keyboardToStringMap";
9
9
  import { ReadonlySet } from "../types/ReadonlySet";
10
10
  import { trimPrefix } from "./string";
11
11
 
@@ -233,7 +233,7 @@ export function keyboardToString(
233
233
  keyboard: Keyboard,
234
234
  uppercase: boolean,
235
235
  ): string | undefined {
236
- const tuple = KEYBOARD_TO_STRING.get(keyboard);
236
+ const tuple = KEYBOARD_TO_STRING_MAP.get(keyboard);
237
237
  if (tuple === undefined) {
238
238
  return undefined;
239
239
  }
@@ -13,8 +13,8 @@ import {
13
13
  LAST_NORMAL_PILL_COLOR,
14
14
  LAST_VANILLA_PILL_EFFECT,
15
15
  } from "../core/constantsFirstLast";
16
- import { PHD_PILL_CONVERSIONS } from "../maps/PHDPillConversions";
17
- import { FALSE_PHD_PILL_CONVERSIONS } from "../maps/falsePHDPillConversions";
16
+ import { PHD_PILL_CONVERSIONS_MAP } from "../maps/PHDPillConversionsMap";
17
+ import { FALSE_PHD_PILL_CONVERSIONS_MAP } from "../maps/falsePHDPillConversionsMap";
18
18
  import {
19
19
  DEFAULT_PILL_EFFECT_CLASS,
20
20
  PILL_EFFECT_CLASSES,
@@ -52,7 +52,7 @@ export function getAllPillColors(): PillColor[] {
52
52
  * is not altered by False PHD, then the same pill effect will be returned.
53
53
  */
54
54
  export function getFalsePHDPillEffect(pillEffect: PillEffect): PillEffect {
55
- const convertedPillEffect = FALSE_PHD_PILL_CONVERSIONS.get(pillEffect);
55
+ const convertedPillEffect = FALSE_PHD_PILL_CONVERSIONS_MAP.get(pillEffect);
56
56
  return convertedPillEffect ?? pillEffect;
57
57
  }
58
58
 
@@ -96,7 +96,7 @@ export function getNormalPillColors(): PillColor[] {
96
96
  * altered by PHD, then the same pill effect will be returned.
97
97
  */
98
98
  export function getPHDPillEffect(pillEffect: PillEffect): PillEffect {
99
- const convertedPillEffect = PHD_PILL_CONVERSIONS.get(pillEffect);
99
+ const convertedPillEffect = PHD_PILL_CONVERSIONS_MAP.get(pillEffect);
100
100
  return convertedPillEffect ?? pillEffect;
101
101
  }
102
102
 
@@ -3,27 +3,88 @@ import { ROOM_SHAPE_VALUES } from "../arrays/cachedEnumValues";
3
3
  import { game } from "../core/cachedClasses";
4
4
  import { CornerType } from "../enums/CornerType";
5
5
  import type { Corner } from "../interfaces/Corner";
6
+ import { ReadonlyMap } from "../types/ReadonlyMap";
6
7
  import { ReadonlySet } from "../types/ReadonlySet";
7
8
  import { getGridIndexesBetween } from "./gridIndex";
8
9
  import { getRoomShapeCorners, isLRoomShape } from "./roomShape";
9
10
  import { inBossRoomOf, inHomeCloset } from "./rooms";
10
11
  import { assertDefined } from "./utils";
11
12
 
12
- const ROOM_SHAPE_TO_WALL_GRID_INDEX_SET: ReadonlyMap<
13
- RoomShape,
14
- ReadonlySet<int>
15
- > = (() => {
16
- const roomShapeToWallGridIndexSet = new Map<RoomShape, ReadonlySet<int>>();
13
+ const ROOM_SHAPE_TO_WALL_GRID_INDEX_MAP = new ReadonlyMap(
14
+ ROOM_SHAPE_VALUES.map((roomShape) => [
15
+ roomShape,
16
+ getVanillaWallGridIndexSetForRoomShape(roomShape),
17
+ ]),
18
+ );
17
19
 
18
- for (const roomShape of ROOM_SHAPE_VALUES) {
19
- const gridIndexSet = getVanillaWallGridIndexSetForRoomShape(roomShape);
20
- roomShapeToWallGridIndexSet.set(roomShape, gridIndexSet);
21
- }
20
+ /** The Home closet is is 9x3, which is different from `RoomShape.IH` (which is 13x3). */
21
+ const HOME_CLOSET_CORNERS = [
22
+ {
23
+ type: CornerType.TOP_LEFT,
24
+ gridIndex: 30,
25
+ position: Vector(60, 220),
26
+ },
27
+ {
28
+ type: CornerType.TOP_RIGHT,
29
+ gridIndex: 38,
30
+ position: Vector(340, 220),
31
+ },
32
+ {
33
+ type: CornerType.BOTTOM_LEFT,
34
+ gridIndex: 90,
35
+ position: Vector(60, 340),
36
+ },
37
+ {
38
+ type: CornerType.BOTTOM_RIGHT,
39
+ gridIndex: 98,
40
+ position: Vector(340, 340),
41
+ },
42
+ ] as const;
43
+
44
+ const HOME_CLOSET_CORNERS_SET = getVanillaWallGridIndexSetForRectangleRoomShape(
45
+ RoomShape.IH,
46
+ HOME_CLOSET_CORNERS,
47
+ );
48
+
49
+ /**
50
+ * The Mother Boss Room is 15x11, which is different from `RoomShape.SHAPE_1x2` (which is 15x16).
51
+ */
52
+ const MOTHER_ROOM_CORNERS = [
53
+ {
54
+ type: CornerType.TOP_LEFT,
55
+ gridIndex: 0,
56
+ position: Vector(60, 140),
57
+ },
58
+ {
59
+ type: CornerType.TOP_RIGHT,
60
+ gridIndex: 14,
61
+ position: Vector(580, 140),
62
+ },
63
+ {
64
+ type: CornerType.BOTTOM_LEFT,
65
+ gridIndex: 150,
66
+ position: Vector(60, 500),
67
+ },
68
+ {
69
+ type: CornerType.BOTTOM_RIGHT,
70
+ gridIndex: 164,
71
+ position: Vector(580, 500),
72
+ },
73
+ ] as const;
22
74
 
23
- return roomShapeToWallGridIndexSet;
24
- })();
75
+ const MOTHER_ROOM_CORNERS_SET = getVanillaWallGridIndexSetForRectangleRoomShape(
76
+ RoomShape.SHAPE_1x2,
77
+ MOTHER_ROOM_CORNERS,
78
+ );
25
79
 
26
- function getVanillaWallGridIndexSetForRoomShape(
80
+ /**
81
+ * Helper function to get the set of grid indexes that represent where the walls are supposed to be
82
+ * in a given room shape.
83
+ *
84
+ * This function only works reliably in vanilla rooms because in a modded room, it is possible to
85
+ * place walls in a non-standard location.
86
+ */
87
+ export function getVanillaWallGridIndexSetForRoomShape(
27
88
  roomShape: RoomShape,
28
89
  ): ReadonlySet<int> {
29
90
  const corners = getRoomShapeCorners(roomShape);
@@ -201,7 +262,10 @@ function getVanillaWallGridIndexSetForRoomShape(
201
262
  }
202
263
 
203
264
  default: {
204
- return getWallGridIndexSetForRectangleRoomShape(roomShape, corners);
265
+ return getVanillaWallGridIndexSetForRectangleRoomShape(
266
+ roomShape,
267
+ corners,
268
+ );
205
269
  }
206
270
  }
207
271
  }
@@ -210,7 +274,7 @@ function getVanillaWallGridIndexSetForRoomShape(
210
274
  * Providing the room shape is necessary so that the `getGridIndexesBetween` function can use the
211
275
  * corresponding grid width.
212
276
  */
213
- function getWallGridIndexSetForRectangleRoomShape(
277
+ function getVanillaWallGridIndexSetForRectangleRoomShape(
214
278
  roomShape: RoomShape,
215
279
  corners: readonly Corner[],
216
280
  ): ReadonlySet<int> {
@@ -250,66 +314,6 @@ function getWallGridIndexSetForRectangleRoomShape(
250
314
  ]);
251
315
  }
252
316
 
253
- /** The Home closet is is 9x3, which is different from `RoomShape.IH` (which is 13x3). */
254
- const HOME_CLOSET_CORNERS = [
255
- {
256
- type: CornerType.TOP_LEFT,
257
- gridIndex: 30,
258
- position: Vector(60, 220),
259
- },
260
- {
261
- type: CornerType.TOP_RIGHT,
262
- gridIndex: 38,
263
- position: Vector(340, 220),
264
- },
265
- {
266
- type: CornerType.BOTTOM_LEFT,
267
- gridIndex: 90,
268
- position: Vector(60, 340),
269
- },
270
- {
271
- type: CornerType.BOTTOM_RIGHT,
272
- gridIndex: 98,
273
- position: Vector(340, 340),
274
- },
275
- ] as const;
276
-
277
- const HOME_CLOSET_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(
278
- RoomShape.IH,
279
- HOME_CLOSET_CORNERS,
280
- );
281
-
282
- /**
283
- * The Mother Boss Room is 15x11, which is different from `RoomShape.SHAPE_1x2` (which is 15x16).
284
- */
285
- const MOTHER_ROOM_CORNERS = [
286
- {
287
- type: CornerType.TOP_LEFT,
288
- gridIndex: 0,
289
- position: Vector(60, 140),
290
- },
291
- {
292
- type: CornerType.TOP_RIGHT,
293
- gridIndex: 14,
294
- position: Vector(580, 140),
295
- },
296
- {
297
- type: CornerType.BOTTOM_LEFT,
298
- gridIndex: 150,
299
- position: Vector(60, 500),
300
- },
301
- {
302
- type: CornerType.BOTTOM_RIGHT,
303
- gridIndex: 164,
304
- position: Vector(580, 500),
305
- },
306
- ] as const;
307
-
308
- const MOTHER_ROOM_CORNERS_SET = getWallGridIndexSetForRectangleRoomShape(
309
- RoomShape.SHAPE_1x2,
310
- MOTHER_ROOM_CORNERS,
311
- );
312
-
313
317
  /**
314
318
  * Helper function to determine if a given grid index should have a wall generated by the vanilla
315
319
  * game. This is useful as a mechanism to distinguish between real walls and custom walls spawned by
@@ -329,7 +333,7 @@ export function isVanillaWallGridIndex(gridIndex: int): boolean {
329
333
  } else if (inBossRoomOf(BossID.MOTHER)) {
330
334
  wallGridIndexSet = MOTHER_ROOM_CORNERS_SET;
331
335
  } else {
332
- wallGridIndexSet = ROOM_SHAPE_TO_WALL_GRID_INDEX_SET.get(roomShape);
336
+ wallGridIndexSet = ROOM_SHAPE_TO_WALL_GRID_INDEX_MAP.get(roomShape);
333
337
  assertDefined(
334
338
  wallGridIndexSet,
335
339
  `Failed to find the wall grid index set for: RoomShape.${RoomShape[roomShape]} (${roomShape})`,
@@ -0,0 +1,23 @@
1
+ import { PillEffect } from "isaac-typescript-definitions";
2
+ import { ReadonlyMap } from "../types/ReadonlyMap";
3
+
4
+ export const PHD_PILL_CONVERSIONS_MAP = new ReadonlyMap<PillEffect, PillEffect>(
5
+ [
6
+ [PillEffect.BAD_TRIP, PillEffect.BALLS_OF_STEEL], // 1
7
+ [PillEffect.HEALTH_DOWN, PillEffect.HEALTH_UP], // 6
8
+ [PillEffect.RANGE_DOWN, PillEffect.RANGE_UP], // 11
9
+ [PillEffect.SPEED_DOWN, PillEffect.SPEED_UP], // 13
10
+ [PillEffect.TEARS_DOWN, PillEffect.TEARS_UP], // 15
11
+ [PillEffect.LUCK_DOWN, PillEffect.LUCK_UP], // 17
12
+ [PillEffect.PARALYSIS, PillEffect.PHEROMONES], // 22
13
+ [PillEffect.AMNESIA, PillEffect.I_CAN_SEE_FOREVER], // 25
14
+ [PillEffect.R_U_A_WIZARD, PillEffect.POWER], // 27
15
+ [PillEffect.ADDICTED, PillEffect.PERCS], // 29
16
+ [PillEffect.QUESTION_MARKS, PillEffect.TELEPILLS], // 31
17
+ [PillEffect.RETRO_VISION, PillEffect.I_CAN_SEE_FOREVER], // 37
18
+ [PillEffect.X_LAX, PillEffect.SOMETHINGS_WRONG], // 39
19
+ [PillEffect.IM_EXCITED, PillEffect.IM_DROWSY], // 42
20
+ [PillEffect.HORF, PillEffect.GULP], // 44
21
+ [PillEffect.SHOT_SPEED_DOWN, PillEffect.SHOT_SPEED_UP], // 47
22
+ ],
23
+ );
@@ -1,5 +1,5 @@
1
- import type { CollectibleType } from "isaac-typescript-definitions";
2
1
  import { removeNonAlphanumericCharacters } from "../functions/string";
2
+ import { ReadonlyMap } from "../types/ReadonlyMap";
3
3
  import { COLLECTIBLE_TYPE_TO_NAME_MAP } from "./collectibleTypeToNameMap";
4
4
 
5
5
  /**
@@ -7,16 +7,11 @@ import { COLLECTIBLE_TYPE_TO_NAME_MAP } from "./collectibleTypeToNameMap";
7
7
  *
8
8
  * For a mapping of `CollectibleType` to name, see `COLLECTIBLE_TYPE_TO_NAME_MAP`.
9
9
  */
10
- export const COLLECTIBLE_NAME_TO_TYPE_MAP: ReadonlyMap<
11
- string,
12
- CollectibleType
13
- > = (() => {
14
- const collectibleNameToTypeMap = new Map<string, CollectibleType>();
15
-
16
- for (const [collectibleType, name] of COLLECTIBLE_TYPE_TO_NAME_MAP) {
17
- const simpleString = removeNonAlphanumericCharacters(name);
18
- collectibleNameToTypeMap.set(simpleString, collectibleType);
19
- }
20
-
21
- return collectibleNameToTypeMap;
22
- })();
10
+ export const COLLECTIBLE_NAME_TO_TYPE_MAP = new ReadonlyMap(
11
+ [...COLLECTIBLE_TYPE_TO_NAME_MAP.entries()].map(
12
+ ([collectibleType, collectibleName]) => [
13
+ removeNonAlphanumericCharacters(collectibleName),
14
+ collectibleType,
15
+ ],
16
+ ),
17
+ );
@@ -0,0 +1,14 @@
1
+ import type { BossID } from "isaac-typescript-definitions";
2
+ import { BOSS_ID_TO_ENTITY_TYPE_VARIANT } from "../objects/bossIDToEntityTypeVariant";
3
+ import { ReadonlyMap } from "../types/ReadonlyMap";
4
+
5
+ export const ENTITY_TYPE_VARIANT_TO_BOSS_ID_MAP = new ReadonlyMap(
6
+ [...Object.entries(BOSS_ID_TO_ENTITY_TYPE_VARIANT)].map(
7
+ ([bossIDRaw, entityTypeVariant]) => {
8
+ const bossID = bossIDRaw as unknown as BossID;
9
+ const [entityType, variant] = entityTypeVariant;
10
+ const entityTypeVariantString = `${entityType}.${variant}`;
11
+ return [entityTypeVariantString, bossID];
12
+ },
13
+ ),
14
+ );
@@ -1,7 +1,7 @@
1
1
  import { PillEffect } from "isaac-typescript-definitions";
2
2
  import { ReadonlyMap } from "../types/ReadonlyMap";
3
3
 
4
- export const FALSE_PHD_PILL_CONVERSIONS = new ReadonlyMap<
4
+ export const FALSE_PHD_PILL_CONVERSIONS_MAP = new ReadonlyMap<
5
5
  PillEffect,
6
6
  PillEffect
7
7
  >([
@@ -2,7 +2,7 @@ import { Keyboard } from "isaac-typescript-definitions";
2
2
  import { ReadonlyMap } from "../types/ReadonlyMap";
3
3
 
4
4
  /** Maps each keyboard enum member to its corresponding lowercase and uppercase characters. */
5
- export const KEYBOARD_TO_STRING = new ReadonlyMap<
5
+ export const KEYBOARD_TO_STRING_MAP = new ReadonlyMap<
6
6
  Keyboard,
7
7
  readonly [lowercaseCharacter: string, uppercaseCharacter: string]
8
8
  >([
@@ -1,8 +1,8 @@
1
1
  import { BossID, LevelStage, StageType } from "isaac-typescript-definitions";
2
- import { combineSets, copySet, deleteSetsFromSet } from "../functions/set";
2
+ import { BOSS_IDS } from "../arrays/cachedEnumValues";
3
+ import { combineSets } from "../functions/set";
3
4
  import { ReadonlyMap } from "../types/ReadonlyMap";
4
5
  import { ReadonlySet } from "../types/ReadonlySet";
5
- import { STORY_BOSSES_SET } from "./storyBossesSet";
6
6
 
7
7
  // The "bosspools.xml" file does not actually correspond to the real boss pools, so these sets were
8
8
  // determined through experimentation on v1.7.8a.
@@ -398,13 +398,12 @@ const CORPSE_BOSSES_SET = new ReadonlySet<BossID>([
398
398
  BossID.MOTHER, // 88
399
399
  ]);
400
400
 
401
- /** The set of unique bosses for Depths, Necropolis, and so on. */
401
+ /** The set of unique bosses for Womb, Utero, and so on. */
402
402
  const ALL_WOMB_BOSSES_SET: ReadonlySet<BossID> = combineSets(
403
403
  WOMB_BOSSES_SET,
404
404
  UTERO_BOSSES_SET,
405
405
  SCARRED_WOMB_BOSSES_SET,
406
- MAUSOLEUM_BOSSES_SET,
407
- GEHENNA_BOSSES_SET,
406
+ CORPSE_BOSSES_SET,
408
407
  );
409
408
 
410
409
  const WOMB_STAGE_TYPE_TO_BOSS_SET_MAP = new ReadonlyMap<
@@ -530,16 +529,8 @@ export const STAGE_TO_COMBINED_BOSS_SET_MAP = new ReadonlyMap<
530
529
  [LevelStage.HOME, HOME_BOSSES_SET], // 13
531
530
  ]);
532
531
 
533
- export const ALL_BOSSES_SET: ReadonlySet<BossID> = combineSets(
534
- ALL_BASEMENT_BOSSES_SET,
535
- ALL_CAVES_BOSSES_SET,
536
- ALL_DEPTHS_BOSSES_SET,
537
- ALL_WOMB_BOSSES_SET,
538
- BLUE_WOMB_BOSSES_SET,
539
- ALL_STAGE_10_BOSSES_SET,
540
- ALL_STAGE_11_BOSSES_SET,
541
- VOID_BOSSES_SET,
542
- HOME_BOSSES_SET,
532
+ export const ALL_BOSSES_SET = new ReadonlySet<BossID>(
533
+ BOSS_IDS.filter((bossID) => bossID !== BossID.RAGLICH),
543
534
  );
544
535
 
545
536
  const STORY_BOSS_IDS_SET = new ReadonlySet([
@@ -549,7 +540,6 @@ const STORY_BOSS_IDS_SET = new ReadonlySet([
549
540
  BossID.ISAAC, // 39
550
541
  BossID.LAMB, // 54
551
542
  BossID.MEGA_SATAN, // 55
552
- // Mega Satan 2 does not have a dedicated boss room.
553
543
  BossID.ULTRA_GREED, // 62
554
544
  BossID.HUSH, // 63
555
545
  BossID.DELIRIUM, // 70
@@ -560,15 +550,6 @@ const STORY_BOSS_IDS_SET = new ReadonlySet([
560
550
  BossID.BEAST, // 100
561
551
  ]);
562
552
 
563
- // We add one for Mega Satan 2 and minus 2 for the two Mausoleum bosses.
564
- if (STORY_BOSS_IDS_SET.size + 1 - 2 !== STORY_BOSSES_SET.size) {
565
- error('The "STORY_BOSS_IDS_SET" and the "STORY_BOSSES_SET" do not match.');
566
- }
567
-
568
- export const ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET: ReadonlySet<BossID> =
569
- (() => {
570
- const allBossesSet = copySet(ALL_BOSSES_SET);
571
- deleteSetsFromSet(allBossesSet, STORY_BOSS_IDS_SET);
572
-
573
- return allBossesSet;
574
- })();
553
+ export const ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET = new ReadonlySet(
554
+ [...ALL_BOSSES_SET].filter((bossID) => !STORY_BOSS_IDS_SET.has(bossID)),
555
+ );
@@ -1,7 +1,7 @@
1
1
  import { EntityType } from "isaac-typescript-definitions";
2
2
  import { ReadonlySet } from "../types/ReadonlySet";
3
3
 
4
- export const STORY_BOSSES_SET = new ReadonlySet<EntityType>([
4
+ export const STORY_BOSS_ENTITY_TYPES_SET = new ReadonlySet<EntityType>([
5
5
  EntityType.MOM, // 45
6
6
  EntityType.MOMS_HEART, // 78
7
7
  EntityType.SATAN, // 84
@@ -1,3 +0,0 @@
1
- import { PillEffect } from "isaac-typescript-definitions";
2
- export declare const PHD_PILL_CONVERSIONS: ReadonlyMap<PillEffect, PillEffect>;
3
- //# sourceMappingURL=PHDPillConversions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PHDPillConversions.d.ts","sourceRoot":"","sources":["../../../src/maps/PHDPillConversions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,eAAO,MAAM,oBAAoB,qCAiB/B,CAAC"}
@@ -1,3 +0,0 @@
1
- import { PillEffect } from "isaac-typescript-definitions";
2
- export declare const FALSE_PHD_PILL_CONVERSIONS: ReadonlyMap<PillEffect, PillEffect>;
3
- //# sourceMappingURL=falsePHDPillConversions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"falsePHDPillConversions.d.ts","sourceRoot":"","sources":["../../../src/maps/falsePHDPillConversions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,eAAO,MAAM,0BAA0B,qCAkCrC,CAAC"}
@@ -1,4 +0,0 @@
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: ReadonlyMap<Keyboard, readonly [lowercaseCharacter: string, uppercaseCharacter: string]>;
4
- //# sourceMappingURL=keyboardToString.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keyboardToString.d.ts","sourceRoot":"","sources":["../../../src/maps/keyboardToString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGxD,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB,0FAyE7B,CAAC"}
@@ -1,3 +0,0 @@
1
- import { EntityType } from "isaac-typescript-definitions";
2
- export declare const STORY_BOSSES_SET: ReadonlySet<EntityType>;
3
- //# sourceMappingURL=storyBossesSet.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storyBossesSet.d.ts","sourceRoot":"","sources":["../../../src/sets/storyBossesSet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,eAAO,MAAM,gBAAgB,yBAc3B,CAAC"}
@@ -1,21 +0,0 @@
1
- import { PillEffect } from "isaac-typescript-definitions";
2
- import { ReadonlyMap } from "../types/ReadonlyMap";
3
-
4
- export const PHD_PILL_CONVERSIONS = new ReadonlyMap<PillEffect, PillEffect>([
5
- [PillEffect.BAD_TRIP, PillEffect.BALLS_OF_STEEL], // 1
6
- [PillEffect.HEALTH_DOWN, PillEffect.HEALTH_UP], // 6
7
- [PillEffect.RANGE_DOWN, PillEffect.RANGE_UP], // 11
8
- [PillEffect.SPEED_DOWN, PillEffect.SPEED_UP], // 13
9
- [PillEffect.TEARS_DOWN, PillEffect.TEARS_UP], // 15
10
- [PillEffect.LUCK_DOWN, PillEffect.LUCK_UP], // 17
11
- [PillEffect.PARALYSIS, PillEffect.PHEROMONES], // 22
12
- [PillEffect.AMNESIA, PillEffect.I_CAN_SEE_FOREVER], // 25
13
- [PillEffect.R_U_A_WIZARD, PillEffect.POWER], // 27
14
- [PillEffect.ADDICTED, PillEffect.PERCS], // 29
15
- [PillEffect.QUESTION_MARKS, PillEffect.TELEPILLS], // 31
16
- [PillEffect.RETRO_VISION, PillEffect.I_CAN_SEE_FOREVER], // 37
17
- [PillEffect.X_LAX, PillEffect.SOMETHINGS_WRONG], // 39
18
- [PillEffect.IM_EXCITED, PillEffect.IM_DROWSY], // 42
19
- [PillEffect.HORF, PillEffect.GULP], // 44
20
- [PillEffect.SHOT_SPEED_DOWN, PillEffect.SHOT_SPEED_UP], // 47
21
- ]);