isaacscript-common 51.6.0 → 51.8.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.
@@ -7,7 +7,7 @@ import type { BackdropType } from 'isaac-typescript-definitions';
7
7
  import type { BatterySubType } from 'isaac-typescript-definitions';
8
8
  import type { BombSubType } from 'isaac-typescript-definitions';
9
9
  import type { BombVariant } from 'isaac-typescript-definitions';
10
- import type { BossID } from 'isaac-typescript-definitions';
10
+ import { BossID } from 'isaac-typescript-definitions';
11
11
  import { ButtonAction } from 'isaac-typescript-definitions';
12
12
  import { CacheFlag } from 'isaac-typescript-definitions';
13
13
  import { CallbackPriority } from 'isaac-typescript-definitions/dist/src/enums/CallbackPriority';
@@ -1687,6 +1687,40 @@ export declare function combineArrays<T>(...arrays: Array<T[] | readonly T[]>):
1687
1687
  */
1688
1688
  export declare function combineSets<T>(...sets: Array<Set<T> | ReadonlySet<T>>): Set<T>;
1689
1689
 
1690
+ /**
1691
+ * Helper type to validate that a union of interfaces with a field of `type` that is based on an
1692
+ * enum is complete.
1693
+ *
1694
+ * For example:
1695
+ *
1696
+ * ```ts
1697
+ * enum ObjectiveType {
1698
+ * FOO,
1699
+ * BAR,
1700
+ * BAZ,
1701
+ * }
1702
+ *
1703
+ * interface FooObjective {
1704
+ * type: ObjectiveType.FOO;
1705
+ * fooThing: number;
1706
+ * }
1707
+ *
1708
+ * interface BarObjective {
1709
+ * type: ObjectiveType.BAR;
1710
+ * barThing: string;
1711
+ * }
1712
+ *
1713
+ * type Objective = FooObjective | BarObjective;
1714
+ * type _Test = CompositionTypeSatisfiesEnum<Objective, ObjectiveType>;
1715
+ * ```
1716
+ *
1717
+ * In this example, `Test` would be flagged by TypeScript because `Objective` does not contain an
1718
+ * entry for `BazObjective`.
1719
+ */
1720
+ export declare type CompositionTypeSatisfiesEnum<T extends {
1721
+ type: unknown;
1722
+ }, _Enum extends T["type"]> = unknown;
1723
+
1690
1724
  /**
1691
1725
  * Helper function to get the enum name for the specified `Controller` value. Note that this will
1692
1726
  * trim off the "BUTTON_" prefix.
@@ -4909,6 +4943,15 @@ export declare function getBooleansFromTable(luaMap: LuaMap<string, unknown>, ob
4909
4943
  */
4910
4944
  export declare function getBosses(entityType?: EntityType, variant?: int, subType?: int, ignoreFriendly?: boolean): EntityNPC[];
4911
4945
 
4946
+ /**
4947
+ * Helper function to get the boss ID corresponding to the current room. Returns 0 if the current
4948
+ * room is not a Boss Room.
4949
+ *
4950
+ * Use this instead of the vanilla `Room.GetBossID` method since it correctly handles Dogma and The
4951
+ * Beast.
4952
+ */
4953
+ export declare function getBossID(): BossID | 0;
4954
+
4912
4955
  export declare function getBossIDFromEntityTypeVariant(entityType: EntityType, variant: int): BossID | undefined;
4913
4956
 
4914
4957
  /**
@@ -8088,18 +8131,27 @@ declare type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
8088
8131
  */
8089
8132
  export declare function in2x1Room(): boolean;
8090
8133
 
8134
+ /**
8135
+ * Helper function to check to see if the current room is an angel shop.
8136
+ *
8137
+ * Under the hood, this checks the room type being equal to `RoomType.ANGEL` (15) and the sub-type
8138
+ * being equal to `AngelRoomSubType.SHOP` (1).
8139
+ */
8091
8140
  export declare function inAngelShop(): boolean;
8092
8141
 
8093
8142
  /**
8094
- * Helper function to check to see if the current room is a boss room for The Beast.
8143
+ * Helper function to check to see if the current room is the Boss Room for The Beast.
8144
+ *
8145
+ * This function is useful because the `Room.GetBossID` method returns 0 for The Beast room.
8095
8146
  *
8096
- * Under the hood, this checks the room type and sub-type.
8147
+ * Under the hood, this checks the room type being equal to `RoomType.DUNGEON` (16) and the sub-type
8148
+ * being equal to `DungeonSubType.BEAST_ROOM` (4).
8097
8149
  */
8098
8150
  export declare function inBeastRoom(): boolean;
8099
8151
 
8100
8152
  /**
8101
- * Helper function to check if the current room is a boss room for a particular boss. This will only
8102
- * work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
8153
+ * Helper function to check if the current room is the Boss Room for a particular boss. This will
8154
+ * only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
8103
8155
  */
8104
8156
  export declare function inBossRoomOf(bossID: BossID): boolean;
8105
8157
 
@@ -8148,6 +8200,21 @@ export declare function inDevilsCrownTreasureRoom(): boolean;
8148
8200
 
8149
8201
  export declare function inDimension(dimension: Dimension): boolean;
8150
8202
 
8203
+ /**
8204
+ * Helper function to check to see if the current room is the Boss Room for Dogma.
8205
+ *
8206
+ * This function is useful because the `Room.GetBossID` method returns 0 for the Dogma room.
8207
+ *
8208
+ * Note that the "living room" on the Home floor with the TV at the top of the room is not the Dogma
8209
+ * Boss Room, as the player is teleported to a different room after watching the TV cutscene.
8210
+ *
8211
+ * Under the hood, this checks the stage ID being equal to `StageID.HOME` (35) and the room type
8212
+ * being equal to `RoomType.DEFAULT` (1) and the variant being equal to 1000 (which is the only
8213
+ * Dogma Boss Room that exists in vanilla) and the sub-type being equal to
8214
+ * `HomeRoomSubType.LIVING_ROOM` (3).
8215
+ */
8216
+ export declare function inDogmaRoom(): boolean;
8217
+
8151
8218
  /**
8152
8219
  * Helper function to detect if the current room is a Double Trouble Boss Room.
8153
8220
  *
@@ -8437,6 +8504,12 @@ export declare function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[] | readon
8437
8504
 
8438
8505
  export declare function isAngelRoomDoor(door: GridEntityDoor): boolean;
8439
8506
 
8507
+ /**
8508
+ * Helper function to check to see if the current room is an angel shop.
8509
+ *
8510
+ * Under the hood, this checks the room type being equal to `RoomType.ANGEL` (15) and the sub-type
8511
+ * being equal to `AngelRoomSubType.SHOP` (1).
8512
+ */
8440
8513
  export declare function isAngelShop(roomData: RoomConfig): boolean;
8441
8514
 
8442
8515
  /**
@@ -8466,9 +8539,12 @@ export declare function isArrayInArray<T>(arrayToMatch: T[] | readonly T[], pare
8466
8539
  export declare function isBattery(pickup: EntityPickup): pickup is EntityPickupBattery;
8467
8540
 
8468
8541
  /**
8469
- * Helper function to check to see if the provided room is a boss room for The Beast.
8542
+ * Helper function to check to see if the provided room is the Boss Room for The Beast.
8470
8543
  *
8471
- * Under the hood, this checks the room type and sub-type.
8544
+ * This function is useful because the `Room.GetBossID` method returns 0 for The Beast room.
8545
+ *
8546
+ * Under the hood, this checks the room type being equal to `RoomType.DUNGEON` (16) and the sub-type
8547
+ * being equal to `DungeonSubType.BEAST_ROOM` (4).
8472
8548
  */
8473
8549
  export declare function isBeastRoom(roomData: RoomConfig): boolean;
8474
8550
 
@@ -8506,7 +8582,7 @@ export declare function isBombPickup(pickup: EntityPickup): pickup is EntityPick
8506
8582
  export declare function isBoolean(variable: unknown): variable is boolean;
8507
8583
 
8508
8584
  /**
8509
- * Helper function to check if the provided room is a boss room for a particular boss. This will
8585
+ * Helper function to check if the provided room is the Boss Room for a particular boss. This will
8510
8586
  * only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
8511
8587
  */
8512
8588
  export declare function isBossRoomOf(roomData: RoomConfig, bossID: BossID): boolean;
@@ -8785,6 +8861,21 @@ export declare function isDevilRoomDoor(door: GridEntityDoor): boolean;
8785
8861
  */
8786
8862
  export declare function isDevilsCrownTreasureRoom(roomDescriptor: RoomDescriptor): boolean;
8787
8863
 
8864
+ /**
8865
+ * Helper function to check to see if the provided room is the Boss Room for Dogma.
8866
+ *
8867
+ * This function is useful because the `Room.GetBossID` method returns 0 for the Dogma room.
8868
+ *
8869
+ * Note that the "living room" on the Home floor with the TV at the top of the room is not the Dogma
8870
+ * Boss Room, as the player is teleported to a different room after watching the TV cutscene.
8871
+ *
8872
+ * Under the hood, this checks the stage ID being equal to `StageID.HOME` (35) and the room type
8873
+ * being equal to `RoomType.DEFAULT` (1) and the variant being equal to 1000 (which is the only
8874
+ * Dogma Boss Room that exists in vanilla) and the sub-type being equal to
8875
+ * `HomeRoomSubType.LIVING_ROOM` (3).
8876
+ */
8877
+ export declare function isDogmaRoom(roomData: RoomConfig): boolean;
8878
+
8788
8879
  /** Helper function to detect if a variable is of type `GridEntityDoor`. */
8789
8880
  export declare function isDoor(variable: unknown): variable is GridEntityDoor;
8790
8881
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 51.6.0
3
+ isaacscript-common 51.8.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -28010,6 +28010,9 @@ end
28010
28010
  function ____exports.isDevilsCrownTreasureRoom(self, roomDescriptor)
28011
28011
  return hasFlag(nil, roomDescriptor.Flags, RoomDescriptorFlag.DEVIL_TREASURE)
28012
28012
  end
28013
+ function ____exports.isDogmaRoom(self, roomData)
28014
+ return roomData.StageID == StageID.HOME and roomData.Type == RoomType.DEFAULT and roomData.Variant == 1000 and roomData.Subtype == asNumber(nil, HomeRoomSubType.LIVING_ROOM)
28015
+ end
28013
28016
  function ____exports.isDoubleTrouble(self, roomData)
28014
28017
  return roomData.Type == RoomType.BOSS and __TS__StringIncludes(roomData.Name, "Double Trouble")
28015
28018
  end
@@ -28146,6 +28149,10 @@ function ____exports.inDevilsCrownTreasureRoom(self)
28146
28149
  local roomDescriptor = getRoomDescriptorReadOnly(nil)
28147
28150
  return ____exports.isDevilsCrownTreasureRoom(nil, roomDescriptor)
28148
28151
  end
28152
+ function ____exports.inDogmaRoom(self)
28153
+ local roomData = getRoomData(nil)
28154
+ return ____exports.isDogmaRoom(nil, roomData)
28155
+ end
28149
28156
  function ____exports.inDoubleTrouble(self)
28150
28157
  local roomData = getRoomData(nil)
28151
28158
  return ____exports.isDoubleTrouble(nil, roomData)
@@ -28261,12 +28268,12 @@ function ____exports.setRoomCleared(self)
28261
28268
  for ____, door in ipairs(getDoors(nil)) do
28262
28269
  do
28263
28270
  if isHiddenSecretRoomDoor(nil, door) then
28264
- goto __continue80
28271
+ goto __continue82
28265
28272
  end
28266
28273
  openDoorFast(nil, door)
28267
28274
  door.ExtraVisible = false
28268
28275
  end
28269
- ::__continue80::
28276
+ ::__continue82::
28270
28277
  end
28271
28278
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
28272
28279
  game:ShakeScreen(0)
@@ -44558,8 +44565,11 @@ local __TS__New = ____lualib.__TS__New
44558
44565
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
44559
44566
  local ____exports = {}
44560
44567
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
44568
+ local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
44561
44569
  local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
44562
44570
  local LokiVariant = ____isaac_2Dtypescript_2Ddefinitions.LokiVariant
44571
+ local ____cachedClasses = require("src.core.cachedClasses")
44572
+ local game = ____cachedClasses.game
44563
44573
  local ____constants = require("src.core.constants")
44564
44574
  local VectorZero = ____constants.VectorZero
44565
44575
  local ____entityTypeVariantToBossIDMap = require("src.maps.entityTypeVariantToBossIDMap")
@@ -44584,6 +44594,9 @@ local ____npcs = require("src.functions.npcs")
44584
44594
  local getAliveNPCs = ____npcs.getAliveNPCs
44585
44595
  local ____rng = require("src.functions.rng")
44586
44596
  local isRNG = ____rng.isRNG
44597
+ local ____rooms = require("src.functions.rooms")
44598
+ local inBeastRoom = ____rooms.inBeastRoom
44599
+ local inDogmaRoom = ____rooms.inDogmaRoom
44587
44600
  local ____types = require("src.functions.types")
44588
44601
  local asNumber = ____types.asNumber
44589
44602
  local ____utils = require("src.functions.utils")
@@ -44627,6 +44640,16 @@ function ____exports.getAllBossesSet(self, includeStoryBosses)
44627
44640
  end
44628
44641
  return includeStoryBosses and ALL_BOSSES_SET or ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET
44629
44642
  end
44643
+ function ____exports.getBossID(self)
44644
+ if inDogmaRoom(nil) then
44645
+ return BossID.DOGMA
44646
+ end
44647
+ if inBeastRoom(nil) then
44648
+ return BossID.BEAST
44649
+ end
44650
+ local room = game:GetRoom()
44651
+ return room:GetBossID()
44652
+ end
44630
44653
  function ____exports.getBossIDFromEntityTypeVariant(self, entityType, variant)
44631
44654
  local entityTypeVariant = (tostring(entityType) .. ".") .. tostring(variant)
44632
44655
  return ENTITY_TYPE_VARIANT_TO_BOSS_ID_MAP:get(entityTypeVariant)
@@ -44663,29 +44686,26 @@ end
44663
44686
  function ____exports.isRepentanceBoss(self, bossID)
44664
44687
  return REPENTANCE_ONLY_BOSS_IDS_SET:has(bossID)
44665
44688
  end
44666
- function ____exports.isSin(self, npc)
44667
- return SIN_ENTITY_TYPES_SET:has(npc.Type)
44668
- end
44669
44689
  local function getNumBossSegments(self, entityType, variant, numSegments)
44670
44690
  if numSegments ~= nil then
44671
44691
  return numSegments
44672
44692
  end
44673
44693
  repeat
44674
- local ____switch16 = entityType
44675
- local ____cond16 = ____switch16 == EntityType.CHUB
44676
- if ____cond16 then
44694
+ local ____switch18 = entityType
44695
+ local ____cond18 = ____switch18 == EntityType.CHUB
44696
+ if ____cond18 then
44677
44697
  do
44678
44698
  return 3
44679
44699
  end
44680
44700
  end
44681
- ____cond16 = ____cond16 or ____switch16 == EntityType.LOKI
44682
- if ____cond16 then
44701
+ ____cond18 = ____cond18 or ____switch18 == EntityType.LOKI
44702
+ if ____cond18 then
44683
44703
  do
44684
44704
  return variant == asNumber(nil, LokiVariant.LOKII) and 2 or 1
44685
44705
  end
44686
44706
  end
44687
- ____cond16 = ____cond16 or ____switch16 == EntityType.GURGLING
44688
- if ____cond16 then
44707
+ ____cond18 = ____cond18 or ____switch18 == EntityType.GURGLING
44708
+ if ____cond18 then
44689
44709
  do
44690
44710
  return 2
44691
44711
  end
@@ -44697,6 +44717,9 @@ local function getNumBossSegments(self, entityType, variant, numSegments)
44697
44717
  end
44698
44718
  until true
44699
44719
  end
44720
+ function ____exports.isSin(self, npc)
44721
+ return SIN_ENTITY_TYPES_SET:has(npc.Type)
44722
+ end
44700
44723
  function ____exports.spawnBoss(self, entityType, variant, subType, positionOrGridIndex, velocity, spawner, seedOrRNG, numSegments)
44701
44724
  if velocity == nil then
44702
44725
  velocity = VectorZero
@@ -54947,6 +54970,17 @@ return ____exports
54947
54970
  end,
54948
54971
  ["src.types.AllButLast"] = function(...)
54949
54972
  local ____exports = {}
54973
+ return ____exports
54974
+ end,
54975
+ ["src.types.CompositionTypeSatisfiesEnum"] = function(...)
54976
+ local ____exports = {}
54977
+ local ObjectiveType = {}
54978
+ ObjectiveType.FOO = 0
54979
+ ObjectiveType[ObjectiveType.FOO] = "FOO"
54980
+ ObjectiveType.BAR = 1
54981
+ ObjectiveType[ObjectiveType.BAR] = "BAR"
54982
+ ObjectiveType.BAZ = 2
54983
+ ObjectiveType[ObjectiveType.BAZ] = "BAZ"
54950
54984
  return ____exports
54951
54985
  end,
54952
54986
  ["src.types.Decrement"] = function(...)
@@ -1,5 +1,5 @@
1
- import type { BossID, LevelStage, StageType } from "isaac-typescript-definitions";
2
- import { EntityType } from "isaac-typescript-definitions";
1
+ import type { LevelStage, StageType } from "isaac-typescript-definitions";
2
+ import { BossID, EntityType } from "isaac-typescript-definitions";
3
3
  /**
4
4
  * Helper function to get all of the non-dead bosses in the room.
5
5
  *
@@ -35,6 +35,14 @@ export declare function getAliveBosses(entityType?: EntityType | -1, variant?: n
35
35
  * Default is true.
36
36
  */
37
37
  export declare function getAllBossesSet(includeStoryBosses?: boolean): ReadonlySet<BossID>;
38
+ /**
39
+ * Helper function to get the boss ID corresponding to the current room. Returns 0 if the current
40
+ * room is not a Boss Room.
41
+ *
42
+ * Use this instead of the vanilla `Room.GetBossID` method since it correctly handles Dogma and The
43
+ * Beast.
44
+ */
45
+ export declare function getBossID(): BossID | 0;
38
46
  export declare function getBossIDFromEntityTypeVariant(entityType: EntityType, variant: int): BossID | undefined;
39
47
  /**
40
48
  * Helper function to get the set of vanilla bosses for a particular stage and stage type
@@ -1 +1 @@
1
- {"version":3,"file":"bosses.d.ts","sourceRoot":"","sources":["../../../src/functions/bosses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,SAAS,EACV,MAAM,8BAA8B,CAAC;AACtC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S__New
3
3
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
4
4
  local ____exports = {}
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
+ local BossID = ____isaac_2Dtypescript_2Ddefinitions.BossID
6
7
  local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
7
8
  local LokiVariant = ____isaac_2Dtypescript_2Ddefinitions.LokiVariant
9
+ local ____cachedClasses = require("src.core.cachedClasses")
10
+ local game = ____cachedClasses.game
8
11
  local ____constants = require("src.core.constants")
9
12
  local VectorZero = ____constants.VectorZero
10
13
  local ____entityTypeVariantToBossIDMap = require("src.maps.entityTypeVariantToBossIDMap")
@@ -29,6 +32,9 @@ local ____npcs = require("src.functions.npcs")
29
32
  local getAliveNPCs = ____npcs.getAliveNPCs
30
33
  local ____rng = require("src.functions.rng")
31
34
  local isRNG = ____rng.isRNG
35
+ local ____rooms = require("src.functions.rooms")
36
+ local inBeastRoom = ____rooms.inBeastRoom
37
+ local inDogmaRoom = ____rooms.inDogmaRoom
32
38
  local ____types = require("src.functions.types")
33
39
  local asNumber = ____types.asNumber
34
40
  local ____utils = require("src.functions.utils")
@@ -101,6 +107,21 @@ function ____exports.getAllBossesSet(self, includeStoryBosses)
101
107
  end
102
108
  return includeStoryBosses and ALL_BOSSES_SET or ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET
103
109
  end
110
+ --- Helper function to get the boss ID corresponding to the current room. Returns 0 if the current
111
+ -- room is not a Boss Room.
112
+ --
113
+ -- Use this instead of the vanilla `Room.GetBossID` method since it correctly handles Dogma and The
114
+ -- Beast.
115
+ function ____exports.getBossID(self)
116
+ if inDogmaRoom(nil) then
117
+ return BossID.DOGMA
118
+ end
119
+ if inBeastRoom(nil) then
120
+ return BossID.BEAST
121
+ end
122
+ local room = game:GetRoom()
123
+ return room:GetBossID()
124
+ end
104
125
  function ____exports.getBossIDFromEntityTypeVariant(self, entityType, variant)
105
126
  local entityTypeVariant = (tostring(entityType) .. ".") .. tostring(variant)
106
127
  return ENTITY_TYPE_VARIANT_TO_BOSS_ID_MAP:get(entityTypeVariant)
@@ -160,30 +181,26 @@ end
160
181
  function ____exports.isRepentanceBoss(self, bossID)
161
182
  return REPENTANCE_ONLY_BOSS_IDS_SET:has(bossID)
162
183
  end
163
- --- Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust.
164
- function ____exports.isSin(self, npc)
165
- return SIN_ENTITY_TYPES_SET:has(npc.Type)
166
- end
167
184
  local function getNumBossSegments(self, entityType, variant, numSegments)
168
185
  if numSegments ~= nil then
169
186
  return numSegments
170
187
  end
171
188
  repeat
172
- local ____switch16 = entityType
173
- local ____cond16 = ____switch16 == EntityType.CHUB
174
- if ____cond16 then
189
+ local ____switch18 = entityType
190
+ local ____cond18 = ____switch18 == EntityType.CHUB
191
+ if ____cond18 then
175
192
  do
176
193
  return 3
177
194
  end
178
195
  end
179
- ____cond16 = ____cond16 or ____switch16 == EntityType.LOKI
180
- if ____cond16 then
196
+ ____cond18 = ____cond18 or ____switch18 == EntityType.LOKI
197
+ if ____cond18 then
181
198
  do
182
199
  return variant == asNumber(nil, LokiVariant.LOKII) and 2 or 1
183
200
  end
184
201
  end
185
- ____cond16 = ____cond16 or ____switch16 == EntityType.GURGLING
186
- if ____cond16 then
202
+ ____cond18 = ____cond18 or ____switch18 == EntityType.GURGLING
203
+ if ____cond18 then
187
204
  do
188
205
  return 2
189
206
  end
@@ -195,6 +212,10 @@ local function getNumBossSegments(self, entityType, variant, numSegments)
195
212
  end
196
213
  until true
197
214
  end
215
+ --- Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust.
216
+ function ____exports.isSin(self, npc)
217
+ return SIN_ENTITY_TYPES_SET:has(npc.Type)
218
+ end
198
219
  --- Helper function to spawn a boss.
199
220
  --
200
221
  -- Use this function instead of `spawnNPC` since it handles automatically spawning multiple segments
@@ -103,16 +103,25 @@ export declare function getRoomsOutsideGrid(): RoomDescriptor[];
103
103
  * `RoomShape.2x1`.
104
104
  */
105
105
  export declare function in2x1Room(): boolean;
106
+ /**
107
+ * Helper function to check to see if the current room is an angel shop.
108
+ *
109
+ * Under the hood, this checks the room type being equal to `RoomType.ANGEL` (15) and the sub-type
110
+ * being equal to `AngelRoomSubType.SHOP` (1).
111
+ */
106
112
  export declare function inAngelShop(): boolean;
107
113
  /**
108
- * Helper function to check to see if the current room is a boss room for The Beast.
114
+ * Helper function to check to see if the current room is the Boss Room for The Beast.
109
115
  *
110
- * Under the hood, this checks the room type and sub-type.
116
+ * This function is useful because the `Room.GetBossID` method returns 0 for The Beast room.
117
+ *
118
+ * Under the hood, this checks the room type being equal to `RoomType.DUNGEON` (16) and the sub-type
119
+ * being equal to `DungeonSubType.BEAST_ROOM` (4).
111
120
  */
112
121
  export declare function inBeastRoom(): boolean;
113
122
  /**
114
- * Helper function to check if the current room is a boss room for a particular boss. This will only
115
- * work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
123
+ * Helper function to check if the current room is the Boss Room for a particular boss. This will
124
+ * only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
116
125
  */
117
126
  export declare function inBossRoomOf(bossID: BossID): boolean;
118
127
  /**
@@ -137,6 +146,20 @@ export declare function inDeathCertificateArea(): boolean;
137
146
  * Under the hood, this checks for `RoomDescriptorFlag.DEVIL_TREASURE`.
138
147
  */
139
148
  export declare function inDevilsCrownTreasureRoom(): boolean;
149
+ /**
150
+ * Helper function to check to see if the current room is the Boss Room for Dogma.
151
+ *
152
+ * This function is useful because the `Room.GetBossID` method returns 0 for the Dogma room.
153
+ *
154
+ * Note that the "living room" on the Home floor with the TV at the top of the room is not the Dogma
155
+ * Boss Room, as the player is teleported to a different room after watching the TV cutscene.
156
+ *
157
+ * Under the hood, this checks the stage ID being equal to `StageID.HOME` (35) and the room type
158
+ * being equal to `RoomType.DEFAULT` (1) and the variant being equal to 1000 (which is the only
159
+ * Dogma Boss Room that exists in vanilla) and the sub-type being equal to
160
+ * `HomeRoomSubType.LIVING_ROOM` (3).
161
+ */
162
+ export declare function inDogmaRoom(): boolean;
140
163
  /**
141
164
  * Helper function to detect if the current room is a Double Trouble Boss Room.
142
165
  *
@@ -228,15 +251,24 @@ export declare function is2x1Room(roomData: RoomConfig): boolean;
228
251
  * @allowEmptyVariadic
229
252
  */
230
253
  export declare function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[] | readonly RoomType[], includeSecretAndSuperSecretRoom?: boolean, includeUltraSecretRoom?: boolean): boolean;
254
+ /**
255
+ * Helper function to check to see if the current room is an angel shop.
256
+ *
257
+ * Under the hood, this checks the room type being equal to `RoomType.ANGEL` (15) and the sub-type
258
+ * being equal to `AngelRoomSubType.SHOP` (1).
259
+ */
231
260
  export declare function isAngelShop(roomData: RoomConfig): boolean;
232
261
  /**
233
- * Helper function to check to see if the provided room is a boss room for The Beast.
262
+ * Helper function to check to see if the provided room is the Boss Room for The Beast.
234
263
  *
235
- * Under the hood, this checks the room type and sub-type.
264
+ * This function is useful because the `Room.GetBossID` method returns 0 for The Beast room.
265
+ *
266
+ * Under the hood, this checks the room type being equal to `RoomType.DUNGEON` (16) and the sub-type
267
+ * being equal to `DungeonSubType.BEAST_ROOM` (4).
236
268
  */
237
269
  export declare function isBeastRoom(roomData: RoomConfig): boolean;
238
270
  /**
239
- * Helper function to check if the provided room is a boss room for a particular boss. This will
271
+ * Helper function to check if the provided room is the Boss Room for a particular boss. This will
240
272
  * only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
241
273
  */
242
274
  export declare function isBossRoomOf(roomData: RoomConfig, bossID: BossID): boolean;
@@ -262,6 +294,20 @@ export declare function isDeathCertificateArea(roomData: RoomConfig): boolean;
262
294
  * Under the hood, this checks for `RoomDescriptorFlag.DEVIL_TREASURE`.
263
295
  */
264
296
  export declare function isDevilsCrownTreasureRoom(roomDescriptor: RoomDescriptor): boolean;
297
+ /**
298
+ * Helper function to check to see if the provided room is the Boss Room for Dogma.
299
+ *
300
+ * This function is useful because the `Room.GetBossID` method returns 0 for the Dogma room.
301
+ *
302
+ * Note that the "living room" on the Home floor with the TV at the top of the room is not the Dogma
303
+ * Boss Room, as the player is teleported to a different room after watching the TV cutscene.
304
+ *
305
+ * Under the hood, this checks the stage ID being equal to `StageID.HOME` (35) and the room type
306
+ * being equal to `RoomType.DEFAULT` (1) and the variant being equal to 1000 (which is the only
307
+ * Dogma Boss Room that exists in vanilla) and the sub-type being equal to
308
+ * `HomeRoomSubType.LIVING_ROOM` (3).
309
+ */
310
+ export declare function isDogmaRoom(roomData: RoomConfig): boolean;
265
311
  /**
266
312
  * Helper function to detect if the provided room is a Double Trouble Boss Room.
267
313
  *
@@ -1 +1 @@
1
- {"version":3,"file":"rooms.d.ts","sourceRoot":"","sources":["../../../src/functions/rooms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,UAAU,EACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,SAAS,EAQT,SAAS,EACT,QAAQ,EAGT,MAAM,8BAA8B,CAAC;AAuCtC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAcnD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,GAAG,CAGjC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAiBlE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,GAAG,EAChB,oBAAoB,UAAO,EAC3B,iCAAiC,UAAQ,GACxC,QAAQ,CAAC,UAAU,CAAC,GAAG,SAAS,CAclC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CAOlD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAE1D;AAED;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AAO,CAErD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAEvE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO,CAOzD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,UAAU,EACpB,UAAU,EAAE,UAAU,GACrB,OAAO,CAMT;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO,CAO1D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,UAAU,EACpB,GAAG,UAAU,EAAE,SAAS,EAAE,GACzB,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,UAAU,EACpB,GAAG,SAAS,EAAE,QAAQ,EAAE,GACvB,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAEpE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE5D;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAWrC;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAG5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,IAAI,CA8BrC;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC"}
@@ -140,16 +140,23 @@ end
140
140
  function ____exports.is2x1Room(self, roomData)
141
141
  return roomData.Shape == RoomShape.SHAPE_1x2 or roomData.Shape == RoomShape.SHAPE_2x1
142
142
  end
143
+ --- Helper function to check to see if the current room is an angel shop.
144
+ --
145
+ -- Under the hood, this checks the room type being equal to `RoomType.ANGEL` (15) and the sub-type
146
+ -- being equal to `AngelRoomSubType.SHOP` (1).
143
147
  function ____exports.isAngelShop(self, roomData)
144
148
  return roomData.Type == RoomType.ANGEL and roomData.Subtype == asNumber(nil, AngelRoomSubType.SHOP)
145
149
  end
146
- --- Helper function to check to see if the provided room is a boss room for The Beast.
150
+ --- Helper function to check to see if the provided room is the Boss Room for The Beast.
151
+ --
152
+ -- This function is useful because the `Room.GetBossID` method returns 0 for The Beast room.
147
153
  --
148
- -- Under the hood, this checks the room type and sub-type.
154
+ -- Under the hood, this checks the room type being equal to `RoomType.DUNGEON` (16) and the sub-type
155
+ -- being equal to `DungeonSubType.BEAST_ROOM` (4).
149
156
  function ____exports.isBeastRoom(self, roomData)
150
157
  return roomData.Type == RoomType.DUNGEON and roomData.Subtype == asNumber(nil, DungeonSubType.BEAST_ROOM)
151
158
  end
152
- --- Helper function to check if the provided room is a boss room for a particular boss. This will
159
+ --- Helper function to check if the provided room is the Boss Room for a particular boss. This will
153
160
  -- only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
154
161
  function ____exports.isBossRoomOf(self, roomData, bossID)
155
162
  return roomData.Type == RoomType.BOSS and roomData.StageID == StageID.SPECIAL_ROOMS and roomData.Subtype == asNumber(nil, bossID)
@@ -176,6 +183,20 @@ end
176
183
  function ____exports.isDevilsCrownTreasureRoom(self, roomDescriptor)
177
184
  return hasFlag(nil, roomDescriptor.Flags, RoomDescriptorFlag.DEVIL_TREASURE)
178
185
  end
186
+ --- Helper function to check to see if the provided room is the Boss Room for Dogma.
187
+ --
188
+ -- This function is useful because the `Room.GetBossID` method returns 0 for the Dogma room.
189
+ --
190
+ -- Note that the "living room" on the Home floor with the TV at the top of the room is not the Dogma
191
+ -- Boss Room, as the player is teleported to a different room after watching the TV cutscene.
192
+ --
193
+ -- Under the hood, this checks the stage ID being equal to `StageID.HOME` (35) and the room type
194
+ -- being equal to `RoomType.DEFAULT` (1) and the variant being equal to 1000 (which is the only
195
+ -- Dogma Boss Room that exists in vanilla) and the sub-type being equal to
196
+ -- `HomeRoomSubType.LIVING_ROOM` (3).
197
+ function ____exports.isDogmaRoom(self, roomData)
198
+ return roomData.StageID == StageID.HOME and roomData.Type == RoomType.DEFAULT and roomData.Variant == 1000 and roomData.Subtype == asNumber(nil, HomeRoomSubType.LIVING_ROOM)
199
+ end
179
200
  --- Helper function to detect if the provided room is a Double Trouble Boss Room.
180
201
  --
181
202
  -- This is performed by checking for the string "Double Trouble" inside of the room name. The
@@ -370,19 +391,26 @@ function ____exports.in2x1Room(self)
370
391
  local roomData = getRoomData(nil)
371
392
  return ____exports.is2x1Room(nil, roomData)
372
393
  end
394
+ --- Helper function to check to see if the current room is an angel shop.
395
+ --
396
+ -- Under the hood, this checks the room type being equal to `RoomType.ANGEL` (15) and the sub-type
397
+ -- being equal to `AngelRoomSubType.SHOP` (1).
373
398
  function ____exports.inAngelShop(self)
374
399
  local roomData = getRoomData(nil)
375
400
  return ____exports.isAngelShop(nil, roomData)
376
401
  end
377
- --- Helper function to check to see if the current room is a boss room for The Beast.
402
+ --- Helper function to check to see if the current room is the Boss Room for The Beast.
378
403
  --
379
- -- Under the hood, this checks the room type and sub-type.
404
+ -- This function is useful because the `Room.GetBossID` method returns 0 for The Beast room.
405
+ --
406
+ -- Under the hood, this checks the room type being equal to `RoomType.DUNGEON` (16) and the sub-type
407
+ -- being equal to `DungeonSubType.BEAST_ROOM` (4).
380
408
  function ____exports.inBeastRoom(self)
381
409
  local roomData = getRoomData(nil)
382
410
  return ____exports.isBeastRoom(nil, roomData)
383
411
  end
384
- --- Helper function to check if the current room is a boss room for a particular boss. This will only
385
- -- work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
412
+ --- Helper function to check if the current room is the Boss Room for a particular boss. This will
413
+ -- only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
386
414
  function ____exports.inBossRoomOf(self, bossID)
387
415
  local roomData = getRoomData(nil)
388
416
  return ____exports.isBossRoomOf(nil, roomData, bossID)
@@ -413,6 +441,21 @@ function ____exports.inDevilsCrownTreasureRoom(self)
413
441
  local roomDescriptor = getRoomDescriptorReadOnly(nil)
414
442
  return ____exports.isDevilsCrownTreasureRoom(nil, roomDescriptor)
415
443
  end
444
+ --- Helper function to check to see if the current room is the Boss Room for Dogma.
445
+ --
446
+ -- This function is useful because the `Room.GetBossID` method returns 0 for the Dogma room.
447
+ --
448
+ -- Note that the "living room" on the Home floor with the TV at the top of the room is not the Dogma
449
+ -- Boss Room, as the player is teleported to a different room after watching the TV cutscene.
450
+ --
451
+ -- Under the hood, this checks the stage ID being equal to `StageID.HOME` (35) and the room type
452
+ -- being equal to `RoomType.DEFAULT` (1) and the variant being equal to 1000 (which is the only
453
+ -- Dogma Boss Room that exists in vanilla) and the sub-type being equal to
454
+ -- `HomeRoomSubType.LIVING_ROOM` (3).
455
+ function ____exports.inDogmaRoom(self)
456
+ local roomData = getRoomData(nil)
457
+ return ____exports.isDogmaRoom(nil, roomData)
458
+ end
416
459
  --- Helper function to detect if the current room is a Double Trouble Boss Room.
417
460
  --
418
461
  -- This is performed by checking for the string "Double Trouble" inside of the room name. The
@@ -589,12 +632,12 @@ function ____exports.setRoomCleared(self)
589
632
  for ____, door in ipairs(getDoors(nil)) do
590
633
  do
591
634
  if isHiddenSecretRoomDoor(nil, door) then
592
- goto __continue80
635
+ goto __continue82
593
636
  end
594
637
  openDoorFast(nil, door)
595
638
  door.ExtraVisible = false
596
639
  end
597
- ::__continue80::
640
+ ::__continue82::
598
641
  end
599
642
  sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
600
643
  game:ShakeScreen(0)
@@ -161,6 +161,7 @@ export * from "./types/AnyClass";
161
161
  export * from "./types/AnyEntity";
162
162
  export * from "./types/AnyFunction";
163
163
  export * from "./types/AnyGridEntity";
164
+ export * from "./types/CompositionTypeSatisfiesEnum";
164
165
  export * from "./types/ConversionHeartSubType";
165
166
  export * from "./types/Decrement";
166
167
  export * from "./types/ERange";
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AAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yCAAyC,CAAC;AACxD,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Helper type to validate that a union of interfaces with a field of `type` that is based on an
3
+ * enum is complete.
4
+ *
5
+ * For example:
6
+ *
7
+ * ```ts
8
+ * enum ObjectiveType {
9
+ * FOO,
10
+ * BAR,
11
+ * BAZ,
12
+ * }
13
+ *
14
+ * interface FooObjective {
15
+ * type: ObjectiveType.FOO;
16
+ * fooThing: number;
17
+ * }
18
+ *
19
+ * interface BarObjective {
20
+ * type: ObjectiveType.BAR;
21
+ * barThing: string;
22
+ * }
23
+ *
24
+ * type Objective = FooObjective | BarObjective;
25
+ * type _Test = CompositionTypeSatisfiesEnum<Objective, ObjectiveType>;
26
+ * ```
27
+ *
28
+ * In this example, `Test` would be flagged by TypeScript because `Objective` does not contain an
29
+ * entry for `BazObjective`.
30
+ */
31
+ export type CompositionTypeSatisfiesEnum<T extends {
32
+ type: unknown;
33
+ }, _Enum extends T["type"]> = unknown;
34
+ //# sourceMappingURL=CompositionTypeSatisfiesEnum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CompositionTypeSatisfiesEnum.d.ts","sourceRoot":"","sources":["../../../src/types/CompositionTypeSatisfiesEnum.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,MAAM,4BAA4B,CACtC,CAAC,SAAS;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,EAC3B,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC,IACrB,OAAO,CAAC"}
@@ -0,0 +1,9 @@
1
+ local ____exports = {}
2
+ local ObjectiveType = {}
3
+ ObjectiveType.FOO = 0
4
+ ObjectiveType[ObjectiveType.FOO] = "FOO"
5
+ ObjectiveType.BAR = 1
6
+ ObjectiveType[ObjectiveType.BAR] = "BAR"
7
+ ObjectiveType.BAZ = 2
8
+ ObjectiveType[ObjectiveType.BAZ] = "BAZ"
9
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "51.6.0",
3
+ "version": "51.8.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,9 +1,6 @@
1
- import type {
2
- BossID,
3
- LevelStage,
4
- StageType,
5
- } from "isaac-typescript-definitions";
6
- import { EntityType, LokiVariant } from "isaac-typescript-definitions";
1
+ import type { LevelStage, StageType } from "isaac-typescript-definitions";
2
+ import { BossID, EntityType, LokiVariant } from "isaac-typescript-definitions";
3
+ import { game } from "../core/cachedClasses";
7
4
  import { VectorZero } from "../core/constants";
8
5
  import { ENTITY_TYPE_VARIANT_TO_BOSS_ID_MAP } from "../maps/entityTypeVariantToBossIDMap";
9
6
  import { BOSS_ID_TO_ENTITY_TYPE_VARIANT } from "../objects/bossIDToEntityTypeVariant";
@@ -19,6 +16,7 @@ import { ReadonlySet } from "../types/ReadonlySet";
19
16
  import { getNPCs, spawnNPC } from "./entitiesSpecific";
20
17
  import { getAliveNPCs } from "./npcs";
21
18
  import { isRNG } from "./rng";
19
+ import { inBeastRoom, inDogmaRoom } from "./rooms";
22
20
  import { asNumber } from "./types";
23
21
  import { repeat } from "./utils";
24
22
 
@@ -83,6 +81,26 @@ export function getAllBossesSet(
83
81
  : ALL_BOSSES_EXCLUDING_STORY_BOSSES_SET;
84
82
  }
85
83
 
84
+ /**
85
+ * Helper function to get the boss ID corresponding to the current room. Returns 0 if the current
86
+ * room is not a Boss Room.
87
+ *
88
+ * Use this instead of the vanilla `Room.GetBossID` method since it correctly handles Dogma and The
89
+ * Beast.
90
+ */
91
+ export function getBossID(): BossID | 0 {
92
+ if (inDogmaRoom()) {
93
+ return BossID.DOGMA;
94
+ }
95
+
96
+ if (inBeastRoom()) {
97
+ return BossID.BEAST;
98
+ }
99
+
100
+ const room = game.GetRoom();
101
+ return room.GetBossID();
102
+ }
103
+
86
104
  export function getBossIDFromEntityTypeVariant(
87
105
  entityType: EntityType,
88
106
  variant: int,
@@ -160,11 +178,6 @@ export function isRepentanceBoss(bossID: BossID): boolean {
160
178
  return REPENTANCE_ONLY_BOSS_IDS_SET.has(bossID);
161
179
  }
162
180
 
163
- /** Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust. */
164
- export function isSin(npc: EntityNPC): boolean {
165
- return SIN_ENTITY_TYPES_SET.has(npc.Type);
166
- }
167
-
168
181
  function getNumBossSegments(
169
182
  entityType: EntityType,
170
183
  variant: int,
@@ -198,6 +211,11 @@ function getNumBossSegments(
198
211
  }
199
212
  }
200
213
 
214
+ /** Helper function to check if the provided NPC is a Sin miniboss, such as Sloth or Lust. */
215
+ export function isSin(npc: EntityNPC): boolean {
216
+ return SIN_ENTITY_TYPES_SET.has(npc.Type);
217
+ }
218
+
201
219
  /**
202
220
  * Helper function to spawn a boss.
203
221
  *
@@ -294,15 +294,24 @@ export function in2x1Room(): boolean {
294
294
  return is2x1Room(roomData);
295
295
  }
296
296
 
297
+ /**
298
+ * Helper function to check to see if the current room is an angel shop.
299
+ *
300
+ * Under the hood, this checks the room type being equal to `RoomType.ANGEL` (15) and the sub-type
301
+ * being equal to `AngelRoomSubType.SHOP` (1).
302
+ */
297
303
  export function inAngelShop(): boolean {
298
304
  const roomData = getRoomData();
299
305
  return isAngelShop(roomData);
300
306
  }
301
307
 
302
308
  /**
303
- * Helper function to check to see if the current room is a boss room for The Beast.
309
+ * Helper function to check to see if the current room is the Boss Room for The Beast.
310
+ *
311
+ * This function is useful because the `Room.GetBossID` method returns 0 for The Beast room.
304
312
  *
305
- * Under the hood, this checks the room type and sub-type.
313
+ * Under the hood, this checks the room type being equal to `RoomType.DUNGEON` (16) and the sub-type
314
+ * being equal to `DungeonSubType.BEAST_ROOM` (4).
306
315
  */
307
316
  export function inBeastRoom(): boolean {
308
317
  const roomData = getRoomData();
@@ -310,8 +319,8 @@ export function inBeastRoom(): boolean {
310
319
  }
311
320
 
312
321
  /**
313
- * Helper function to check if the current room is a boss room for a particular boss. This will only
314
- * work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
322
+ * Helper function to check if the current room is the Boss Room for a particular boss. This will
323
+ * only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
315
324
  */
316
325
  export function inBossRoomOf(bossID: BossID): boolean {
317
326
  const roomData = getRoomData();
@@ -356,6 +365,24 @@ export function inDevilsCrownTreasureRoom(): boolean {
356
365
  return isDevilsCrownTreasureRoom(roomDescriptor);
357
366
  }
358
367
 
368
+ /**
369
+ * Helper function to check to see if the current room is the Boss Room for Dogma.
370
+ *
371
+ * This function is useful because the `Room.GetBossID` method returns 0 for the Dogma room.
372
+ *
373
+ * Note that the "living room" on the Home floor with the TV at the top of the room is not the Dogma
374
+ * Boss Room, as the player is teleported to a different room after watching the TV cutscene.
375
+ *
376
+ * Under the hood, this checks the stage ID being equal to `StageID.HOME` (35) and the room type
377
+ * being equal to `RoomType.DEFAULT` (1) and the variant being equal to 1000 (which is the only
378
+ * Dogma Boss Room that exists in vanilla) and the sub-type being equal to
379
+ * `HomeRoomSubType.LIVING_ROOM` (3).
380
+ */
381
+ export function inDogmaRoom(): boolean {
382
+ const roomData = getRoomData();
383
+ return isDogmaRoom(roomData);
384
+ }
385
+
359
386
  /**
360
387
  * Helper function to detect if the current room is a Double Trouble Boss Room.
361
388
  *
@@ -546,6 +573,12 @@ export function isAllRoomsClear(
546
573
  return matchingRooms.every((roomDescriptor) => roomDescriptor.Clear);
547
574
  }
548
575
 
576
+ /**
577
+ * Helper function to check to see if the current room is an angel shop.
578
+ *
579
+ * Under the hood, this checks the room type being equal to `RoomType.ANGEL` (15) and the sub-type
580
+ * being equal to `AngelRoomSubType.SHOP` (1).
581
+ */
549
582
  export function isAngelShop(roomData: RoomConfig): boolean {
550
583
  return (
551
584
  roomData.Type === RoomType.ANGEL &&
@@ -554,9 +587,12 @@ export function isAngelShop(roomData: RoomConfig): boolean {
554
587
  }
555
588
 
556
589
  /**
557
- * Helper function to check to see if the provided room is a boss room for The Beast.
590
+ * Helper function to check to see if the provided room is the Boss Room for The Beast.
558
591
  *
559
- * Under the hood, this checks the room type and sub-type.
592
+ * This function is useful because the `Room.GetBossID` method returns 0 for The Beast room.
593
+ *
594
+ * Under the hood, this checks the room type being equal to `RoomType.DUNGEON` (16) and the sub-type
595
+ * being equal to `DungeonSubType.BEAST_ROOM` (4).
560
596
  */
561
597
  export function isBeastRoom(roomData: RoomConfig): boolean {
562
598
  return (
@@ -566,7 +602,7 @@ export function isBeastRoom(roomData: RoomConfig): boolean {
566
602
  }
567
603
 
568
604
  /**
569
- * Helper function to check if the provided room is a boss room for a particular boss. This will
605
+ * Helper function to check if the provided room is the Boss Room for a particular boss. This will
570
606
  * only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
571
607
  */
572
608
  export function isBossRoomOf(roomData: RoomConfig, bossID: BossID): boolean {
@@ -625,6 +661,28 @@ export function isDevilsCrownTreasureRoom(
625
661
  return hasFlag(roomDescriptor.Flags, RoomDescriptorFlag.DEVIL_TREASURE);
626
662
  }
627
663
 
664
+ /**
665
+ * Helper function to check to see if the provided room is the Boss Room for Dogma.
666
+ *
667
+ * This function is useful because the `Room.GetBossID` method returns 0 for the Dogma room.
668
+ *
669
+ * Note that the "living room" on the Home floor with the TV at the top of the room is not the Dogma
670
+ * Boss Room, as the player is teleported to a different room after watching the TV cutscene.
671
+ *
672
+ * Under the hood, this checks the stage ID being equal to `StageID.HOME` (35) and the room type
673
+ * being equal to `RoomType.DEFAULT` (1) and the variant being equal to 1000 (which is the only
674
+ * Dogma Boss Room that exists in vanilla) and the sub-type being equal to
675
+ * `HomeRoomSubType.LIVING_ROOM` (3).
676
+ */
677
+ export function isDogmaRoom(roomData: RoomConfig): boolean {
678
+ return (
679
+ roomData.StageID === StageID.HOME &&
680
+ roomData.Type === RoomType.DEFAULT &&
681
+ roomData.Variant === 1000 &&
682
+ roomData.Subtype === asNumber(HomeRoomSubType.LIVING_ROOM)
683
+ );
684
+ }
685
+
628
686
  /**
629
687
  * Helper function to detect if the provided room is a Double Trouble Boss Room.
630
688
  *
package/src/index.ts CHANGED
@@ -161,6 +161,7 @@ export * from "./types/AnyClass";
161
161
  export * from "./types/AnyEntity";
162
162
  export * from "./types/AnyFunction";
163
163
  export * from "./types/AnyGridEntity";
164
+ export * from "./types/CompositionTypeSatisfiesEnum";
164
165
  export * from "./types/ConversionHeartSubType";
165
166
  export * from "./types/Decrement";
166
167
  export * from "./types/ERange";
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Helper type to validate that a union of interfaces with a field of `type` that is based on an
3
+ * enum is complete.
4
+ *
5
+ * For example:
6
+ *
7
+ * ```ts
8
+ * enum ObjectiveType {
9
+ * FOO,
10
+ * BAR,
11
+ * BAZ,
12
+ * }
13
+ *
14
+ * interface FooObjective {
15
+ * type: ObjectiveType.FOO;
16
+ * fooThing: number;
17
+ * }
18
+ *
19
+ * interface BarObjective {
20
+ * type: ObjectiveType.BAR;
21
+ * barThing: string;
22
+ * }
23
+ *
24
+ * type Objective = FooObjective | BarObjective;
25
+ * type _Test = CompositionTypeSatisfiesEnum<Objective, ObjectiveType>;
26
+ * ```
27
+ *
28
+ * In this example, `Test` would be flagged by TypeScript because `Objective` does not contain an
29
+ * entry for `BazObjective`.
30
+ */
31
+ export type CompositionTypeSatisfiesEnum<
32
+ T extends { type: unknown },
33
+ _Enum extends T["type"],
34
+ > = unknown;
35
+
36
+ // -----
37
+ // Tests
38
+ // -----
39
+
40
+ enum ObjectiveType {
41
+ FOO,
42
+ BAR,
43
+ BAZ,
44
+ }
45
+
46
+ interface FooObjective {
47
+ type: ObjectiveType.FOO;
48
+ fooThing: number;
49
+ }
50
+
51
+ interface BarObjective {
52
+ type: ObjectiveType.BAR;
53
+ barThing: string;
54
+ }
55
+
56
+ interface BazObjective {
57
+ type: ObjectiveType.BAZ;
58
+ bazThing: string;
59
+ }
60
+
61
+ type Objective1 = FooObjective | BarObjective | BazObjective;
62
+ type _Test1 = CompositionTypeSatisfiesEnum<Objective1, ObjectiveType>;
63
+
64
+ type Objective2 = FooObjective | BarObjective;
65
+ // @ts-expect-error Missing "Baz".
66
+ type _Test2 = CompositionTypeSatisfiesEnum<Objective2, ObjectiveType>;