isaacscript-common 77.1.0 → 77.2.1

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.
@@ -1,8 +1,6 @@
1
- import { BossID, EntityType, LevelStage } from "isaac-typescript-definitions";
1
+ import { BossID, LevelStage } from "isaac-typescript-definitions";
2
2
  export declare const STAGE_TO_STAGE_TYPE_TO_BOSS_SET_MAP: ReadonlyMap<LevelStage, ReadonlyMap<int, ReadonlySet<BossID>>>;
3
3
  export declare const STAGE_TO_COMBINED_BOSS_SET_MAP: ReadonlyMap<LevelStage, ReadonlySet<BossID>>;
4
4
  export declare const ALL_BOSSES_SET: ReadonlySet<BossID>;
5
- export declare const STORY_BOSS_IDS_SET: ReadonlySet<BossID>;
6
- export declare const STORY_BOSS_ENTITY_TYPES_SET: ReadonlySet<EntityType>;
7
5
  export declare const ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET: ReadonlySet<BossID>;
8
6
  //# sourceMappingURL=bossSets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bossSets.d.ts","sourceRoot":"","sources":["../../src/sets/bossSets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,UAAU,EAEX,MAAM,8BAA8B,CAAC;AA6etC,eAAO,MAAM,mCAAmC,gEAiB9C,CAAC;AAEH,eAAO,MAAM,8BAA8B,8CAiBzC,CAAC;AAEH,eAAO,MAAM,cAAc,qBAE1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,qBAkB7B,CAAC;AAEH,eAAO,MAAM,2BAA2B,yBActC,CAAC;AAEH,eAAO,MAAM,qCAAqC,qBAEjD,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;AA8e7E,eAAO,MAAM,mCAAmC,gEAiB9C,CAAC;AAEH,eAAO,MAAM,8BAA8B,8CAiBzC,CAAC;AAEH,eAAO,MAAM,cAAc,qBAE1B,CAAC;AAEF,eAAO,MAAM,qCAAqC,qBAEjD,CAAC"}
@@ -5,13 +5,14 @@ local __TS__Spread = ____lualib.__TS__Spread
5
5
  local ____exports = {}
6
6
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
7
  local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
8
- local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
9
8
  local LevelStage = ____isaac_2Dtypescript_2Ddefinitions.LevelStage
10
9
  local StageType = ____isaac_2Dtypescript_2Ddefinitions.StageType
11
10
  local ____cachedEnumValues = require("arrays.cachedEnumValues")
12
11
  local BOSS_IDS = ____cachedEnumValues.BOSS_IDS
13
12
  local ____set = require("functions.set")
14
13
  local combineSets = ____set.combineSets
14
+ local ____storyBosses = require("functions.storyBosses")
15
+ local isStoryBossID = ____storyBosses.isStoryBossID
15
16
  local ____ReadonlyMap = require("types.ReadonlyMap")
16
17
  local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
17
18
  local ____ReadonlySet = require("types.ReadonlySet")
@@ -369,45 +370,11 @@ ____exports.ALL_BOSSES_SET = __TS__New(
369
370
  function(____, bossID) return bossID ~= BossID.RAGLICH end
370
371
  )
371
372
  )
372
- ____exports.STORY_BOSS_IDS_SET = __TS__New(ReadonlySet, {
373
- BossID.MOM,
374
- BossID.MOMS_HEART,
375
- BossID.SATAN,
376
- BossID.IT_LIVES,
377
- BossID.ISAAC,
378
- BossID.BLUE_BABY,
379
- BossID.LAMB,
380
- BossID.MEGA_SATAN,
381
- BossID.ULTRA_GREED,
382
- BossID.HUSH,
383
- BossID.DELIRIUM,
384
- BossID.ULTRA_GREEDIER,
385
- BossID.MOTHER,
386
- BossID.MAUSOLEUM_MOM,
387
- BossID.MAUSOLEUM_MOMS_HEART,
388
- BossID.DOGMA,
389
- BossID.BEAST
390
- })
391
- ____exports.STORY_BOSS_ENTITY_TYPES_SET = __TS__New(ReadonlySet, {
392
- EntityType.MOM,
393
- EntityType.MOMS_HEART,
394
- EntityType.SATAN,
395
- EntityType.ISAAC,
396
- EntityType.LAMB,
397
- EntityType.MEGA_SATAN,
398
- EntityType.MEGA_SATAN_2,
399
- EntityType.ULTRA_GREED,
400
- EntityType.HUSH,
401
- EntityType.DELIRIUM,
402
- EntityType.MOTHER,
403
- EntityType.DOGMA,
404
- EntityType.BEAST
405
- })
406
373
  ____exports.ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET = __TS__New(
407
374
  ReadonlySet,
408
375
  __TS__ArrayFilter(
409
376
  {__TS__Spread(____exports.ALL_BOSSES_SET)},
410
- function(____, bossID) return not ____exports.STORY_BOSS_IDS_SET:has(bossID) end
377
+ function(____, bossID) return not isStoryBossID(nil, bossID) end
411
378
  )
412
379
  )
413
380
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "77.1.0",
3
+ "version": "77.2.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -37,6 +37,6 @@
37
37
  "lint": "tsx --tsconfig ./scripts/tsconfig.json ./scripts/lint.mts"
38
38
  },
39
39
  "dependencies": {
40
- "isaac-typescript-definitions": "^38.1.0"
40
+ "isaac-typescript-definitions": "^38.2.0"
41
41
  }
42
42
  }
@@ -15,8 +15,6 @@ import {
15
15
  ALL_BOSSES_SET,
16
16
  STAGE_TO_COMBINED_BOSS_SET_MAP,
17
17
  STAGE_TO_STAGE_TYPE_TO_BOSS_SET_MAP,
18
- STORY_BOSS_ENTITY_TYPES_SET,
19
- STORY_BOSS_IDS_SET,
20
18
  } from "../sets/bossSets";
21
19
  import { REPENTANCE_ONLY_BOSS_IDS_SET } from "../sets/repentanceBossIDsSet";
22
20
  import { SIN_ENTITY_TYPES_SET } from "../sets/sinEntityTypesSet";
@@ -251,24 +249,6 @@ function getNumBossSegments(
251
249
  }
252
250
  }
253
251
 
254
- /**
255
- * Helper function to determine if the specified entity type is an end-game story boss, like Isaac,
256
- * Blue Baby, Mega Satan, The Beast, and so on. This is useful because certain effects should only
257
- * apply to non-story bosses, like Vanishing Twin.
258
- */
259
- export function isStoryBoss(entityType: EntityType): boolean {
260
- return STORY_BOSS_ENTITY_TYPES_SET.has(entityType);
261
- }
262
-
263
- /**
264
- * Helper function to determine if the specified boss ID is an end-game story boss, like Isaac, Blue
265
- * Baby, Mega Satan, The Beast, and so on. This is useful because certain effects should only apply
266
- * to non-story bosses, like Vanishing Twin.
267
- */
268
- export function isStoryBossID(bossID: BossID): boolean {
269
- return STORY_BOSS_IDS_SET.has(bossID);
270
- }
271
-
272
252
  /**
273
253
  * Helper function to spawn a boss.
274
254
  *
@@ -0,0 +1,69 @@
1
+ import { BossID, EntityType } from "isaac-typescript-definitions";
2
+ import { ReadonlySet } from "../types/ReadonlySet";
3
+
4
+ const STORY_BOSS_IDS = [
5
+ BossID.MOM, // 6
6
+ BossID.MOMS_HEART, // 8
7
+ BossID.SATAN, // 24
8
+ BossID.IT_LIVES, // 25
9
+ BossID.ISAAC, // 39
10
+ BossID.BLUE_BABY, // 40
11
+ BossID.LAMB, // 54
12
+ BossID.MEGA_SATAN, // 55 (Mega Satan 2 is in the same room.)
13
+ BossID.ULTRA_GREED, // 62
14
+ BossID.HUSH, // 63
15
+ BossID.DELIRIUM, // 70
16
+ BossID.ULTRA_GREEDIER, // 71
17
+ BossID.MOTHER, // 88
18
+ BossID.MAUSOLEUM_MOM, // 89
19
+ BossID.MAUSOLEUM_MOMS_HEART, // 90
20
+ BossID.DOGMA, // 99
21
+ BossID.BEAST, // 100
22
+ ] as const;
23
+
24
+ const STORY_BOSS_ENTITY_TYPES_SET = new ReadonlySet([
25
+ EntityType.MOM, // 45
26
+ EntityType.MOMS_HEART, // 78
27
+ EntityType.SATAN, // 84
28
+ // - It Lives is a variant of Mom's Heart.
29
+ EntityType.ISAAC, // 102
30
+ // - Blue Baby is a variant of Isaac.
31
+ EntityType.LAMB, // 273
32
+ EntityType.MEGA_SATAN, // 274
33
+ EntityType.MEGA_SATAN_2, // 275
34
+ EntityType.ULTRA_GREED, // 406
35
+ EntityType.HUSH, // 407
36
+ EntityType.DELIRIUM, // 412
37
+ // - Ultra Greedier is a variant of Ultra Greed.
38
+ EntityType.MOTHER, // 912
39
+ // - Mausoleum Mom is a sub-type of Mom.
40
+ // - Mausoleum Mom's Heart is a sub-type of Mom's Heart.
41
+ EntityType.DOGMA, // 950
42
+ EntityType.BEAST, // 951
43
+ ]);
44
+
45
+ const STORY_BOSS_IDS_SET = new ReadonlySet<BossID>(STORY_BOSS_IDS);
46
+
47
+ /**
48
+ * A helper type that is a union of every story boss. Useful for data structures that must contain
49
+ * one entry for each story boss.
50
+ */
51
+ export type StoryBossID = (typeof STORY_BOSS_IDS)[number];
52
+
53
+ /**
54
+ * Helper function to determine if the specified entity type is an end-game story boss, like Isaac,
55
+ * Blue Baby, Mega Satan, The Beast, and so on. This is useful because certain effects should only
56
+ * apply to non-story bosses, like Vanishing Twin.
57
+ */
58
+ export function isStoryBoss(entityType: EntityType): boolean {
59
+ return STORY_BOSS_ENTITY_TYPES_SET.has(entityType);
60
+ }
61
+
62
+ /**
63
+ * Helper function to determine if the specified boss ID is an end-game story boss, like Isaac, Blue
64
+ * Baby, Mega Satan, The Beast, and so on. This is useful because certain effects should only apply
65
+ * to non-story bosses, like Vanishing Twin.
66
+ */
67
+ export function isStoryBossID(bossID: BossID): bossID is StoryBossID {
68
+ return STORY_BOSS_IDS_SET.has(bossID);
69
+ }
package/src/index.ts CHANGED
@@ -122,6 +122,7 @@ export * from "./functions/spawnCollectible";
122
122
  export * from "./functions/sprites";
123
123
  export * from "./functions/stage";
124
124
  export * from "./functions/stats";
125
+ export * from "./functions/storyBosses";
125
126
  export * from "./functions/string";
126
127
  export * from "./functions/table";
127
128
  export * from "./functions/tears";
@@ -1,11 +1,7 @@
1
- import {
2
- BossID,
3
- EntityType,
4
- LevelStage,
5
- StageType,
6
- } from "isaac-typescript-definitions";
1
+ import { BossID, LevelStage, StageType } from "isaac-typescript-definitions";
7
2
  import { BOSS_IDS } from "../arrays/cachedEnumValues";
8
3
  import { combineSets } from "../functions/set";
4
+ import { isStoryBossID } from "../functions/storyBosses";
9
5
  import { ReadonlyMap } from "../types/ReadonlyMap";
10
6
  import { ReadonlySet } from "../types/ReadonlySet";
11
7
 
@@ -538,42 +534,6 @@ export const ALL_BOSSES_SET = new ReadonlySet<BossID>(
538
534
  BOSS_IDS.filter((bossID) => bossID !== BossID.RAGLICH),
539
535
  );
540
536
 
541
- export const STORY_BOSS_IDS_SET = new ReadonlySet([
542
- BossID.MOM, // 6
543
- BossID.MOMS_HEART, // 8
544
- BossID.SATAN, // 24
545
- BossID.IT_LIVES, // 25
546
- BossID.ISAAC, // 39
547
- BossID.BLUE_BABY, // 40
548
- BossID.LAMB, // 54
549
- BossID.MEGA_SATAN, // 55
550
- BossID.ULTRA_GREED, // 62
551
- BossID.HUSH, // 63
552
- BossID.DELIRIUM, // 70
553
- BossID.ULTRA_GREEDIER, // 71
554
- BossID.MOTHER, // 88
555
- BossID.MAUSOLEUM_MOM, // 89
556
- BossID.MAUSOLEUM_MOMS_HEART, // 90
557
- BossID.DOGMA, // 99
558
- BossID.BEAST, // 100
559
- ]);
560
-
561
- export const STORY_BOSS_ENTITY_TYPES_SET = new ReadonlySet<EntityType>([
562
- EntityType.MOM, // 45
563
- EntityType.MOMS_HEART, // 78
564
- EntityType.SATAN, // 84
565
- EntityType.ISAAC, // 102
566
- EntityType.LAMB, // 273
567
- EntityType.MEGA_SATAN, // 274
568
- EntityType.MEGA_SATAN_2, // 275
569
- EntityType.ULTRA_GREED, // 406 (includes Ultra Greedier)
570
- EntityType.HUSH, // 407
571
- EntityType.DELIRIUM, // 412
572
- EntityType.MOTHER, // 912
573
- EntityType.DOGMA, // 950
574
- EntityType.BEAST, // 951
575
- ]);
576
-
577
537
  export const ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET = new ReadonlySet(
578
- [...ALL_BOSSES_SET].filter((bossID) => !STORY_BOSS_IDS_SET.has(bossID)),
538
+ [...ALL_BOSSES_SET].filter((bossID) => !isStoryBossID(bossID)),
579
539
  );