isaacscript-common 12.4.0 → 12.5.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.
package/dist/index.d.ts CHANGED
@@ -3424,7 +3424,7 @@ export declare function getHorsePillColors(): PillColor[];
3424
3424
  *
3425
3425
  * For example:
3426
3426
  * - If the user does not have a HUD offset configured, this function will return `Vector(0, 0)`.
3427
- * - If the user has a HUD offset of 1.0 configured, this function will return 10
3427
+ * - If the user has a HUD offset of 1.0 configured, this function will return `Vector(20, 12)`.
3428
3428
  */
3429
3429
  export declare function getHUDOffsetVector(): Vector;
3430
3430
 
@@ -3603,8 +3603,11 @@ export declare function getLastTrinketType(): TrinketType;
3603
3603
  * array.
3604
3604
  *
3605
3605
  * This is useful in the `POST_ENTITY_REMOVE` callback; see the `isLeavingRoom` function.
3606
+ *
3607
+ * Note that this function can return undefined in the case where it is called on the first room of
3608
+ * the run.
3606
3609
  */
3607
- export declare function getLatestRoomDescription(): RoomDescription;
3610
+ export declare function getLatestRoomDescription(): RoomDescription | undefined;
3608
3611
 
3609
3612
  /**
3610
3613
  * Helper function to get the closest value from a map based on partial search text. For the
@@ -5409,6 +5412,14 @@ export declare function gridIndexToGridPosition(gridIndex: int, roomShape: RoomS
5409
5412
  */
5410
5413
  export declare function gridPositionToWorldPosition(gridPosition: Vector): Vector;
5411
5414
 
5415
+ /**
5416
+ * Helper function to see if a particular entity has armor. In this context, armor refers to the
5417
+ * damage scaling mechanic. For example, Ultra Greed has armor, but a Gaper does not.
5418
+ *
5419
+ * For more on armor, see the wiki: https://bindingofisaacrebirth.fandom.com/wiki/Damage_Scaling
5420
+ */
5421
+ export declare function hasArmor(entity: Entity): boolean;
5422
+
5412
5423
  export declare function hasCurse(curse: LevelCurse): boolean;
5413
5424
 
5414
5425
  /**
@@ -6167,7 +6178,7 @@ export declare function isLaser(variable: unknown): variable is EntityLaser;
6167
6178
  * in the room history array for the current room.)
6168
6179
  *
6169
6180
  * This function is intended to be used in the `POST_ENTITY_REMOVE` callback to detect when an
6170
- * entity is pseudo-persistent entity such as a pickup is despawning.
6181
+ * entity is despawning.
6171
6182
  */
6172
6183
  export declare function isLeavingRoom(): boolean;
6173
6184
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 12.4.0
3
+ isaacscript-common 12.5.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -19289,6 +19289,81 @@ return ____exports
19289
19289
  end,
19290
19290
  ["src.types.AnyGridEntity"] = function(...)
19291
19291
  local ____exports = {}
19292
+ return ____exports
19293
+ end,
19294
+ ["src.sets.entitiesWithArmorSet"] = function(...)
19295
+ local ____lualib = require("lualib_bundle")
19296
+ local Set = ____lualib.Set
19297
+ local __TS__New = ____lualib.__TS__New
19298
+ local ____exports = {}
19299
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
19300
+ local BeastVariant = ____isaac_2Dtypescript_2Ddefinitions.BeastVariant
19301
+ local BloodPuppyVariant = ____isaac_2Dtypescript_2Ddefinitions.BloodPuppyVariant
19302
+ local BoomFlyVariant = ____isaac_2Dtypescript_2Ddefinitions.BoomFlyVariant
19303
+ local Charger2Variant = ____isaac_2Dtypescript_2Ddefinitions.Charger2Variant
19304
+ local DogmaVariant = ____isaac_2Dtypescript_2Ddefinitions.DogmaVariant
19305
+ local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
19306
+ local FacelessVariant = ____isaac_2Dtypescript_2Ddefinitions.FacelessVariant
19307
+ local Gaper2Variant = ____isaac_2Dtypescript_2Ddefinitions.Gaper2Variant
19308
+ local GuttyFattyVariant = ____isaac_2Dtypescript_2Ddefinitions.GuttyFattyVariant
19309
+ local HiveVariant = ____isaac_2Dtypescript_2Ddefinitions.HiveVariant
19310
+ local HopperVariant = ____isaac_2Dtypescript_2Ddefinitions.HopperVariant
19311
+ local IsaacVariant = ____isaac_2Dtypescript_2Ddefinitions.IsaacVariant
19312
+ local MegaSatanVariant = ____isaac_2Dtypescript_2Ddefinitions.MegaSatanVariant
19313
+ local MoleVariant = ____isaac_2Dtypescript_2Ddefinitions.MoleVariant
19314
+ local MotherVariant = ____isaac_2Dtypescript_2Ddefinitions.MotherVariant
19315
+ local PooterVariant = ____isaac_2Dtypescript_2Ddefinitions.PooterVariant
19316
+ local RoundWormVariant = ____isaac_2Dtypescript_2Ddefinitions.RoundWormVariant
19317
+ local SubHorfVariant = ____isaac_2Dtypescript_2Ddefinitions.SubHorfVariant
19318
+ local SuckerVariant = ____isaac_2Dtypescript_2Ddefinitions.SuckerVariant
19319
+ local UltraGreedVariant = ____isaac_2Dtypescript_2Ddefinitions.UltraGreedVariant
19320
+ local WallCreepVariant = ____isaac_2Dtypescript_2Ddefinitions.WallCreepVariant
19321
+ ____exports.ENTITIES_WITH_ARMOR_SET = __TS__New(
19322
+ Set,
19323
+ {
19324
+ (tostring(EntityType.POOTER) .. ".") .. tostring(PooterVariant.TAINTED_POOTER),
19325
+ (tostring(EntityType.HIVE) .. ".") .. tostring(HiveVariant.TAINTED_MULLIGAN),
19326
+ (tostring(EntityType.BOOM_FLY) .. ".") .. tostring(BoomFlyVariant.TAINTED_BOOM_FLY),
19327
+ (tostring(EntityType.HOPPER) .. ".") .. tostring(HopperVariant.TAINTED_HOPPER),
19328
+ tostring(EntityType.SPITTY),
19329
+ (tostring(EntityType.SUCKER) .. ".") .. tostring(SuckerVariant.TAINTED_SUCKER),
19330
+ (tostring(EntityType.ISAAC) .. ".") .. tostring(IsaacVariant.BLUE_BABY_HUSH),
19331
+ (tostring(EntityType.WALL_CREEP) .. ".") .. tostring(WallCreepVariant.TAINTED_SOY_CREEP),
19332
+ (tostring(EntityType.ROUND_WORM) .. ".") .. tostring(RoundWormVariant.TAINTED_ROUND_WORM),
19333
+ (tostring(EntityType.ROUND_WORM) .. ".") .. tostring(RoundWormVariant.TAINTED_TUBE_WORM),
19334
+ (tostring(EntityType.MEGA_SATAN) .. ".") .. tostring(MegaSatanVariant.MEGA_SATAN),
19335
+ (tostring(EntityType.MEGA_SATAN) .. ".") .. tostring(MegaSatanVariant.MEGA_SATAN_RIGHT_HAND),
19336
+ (tostring(EntityType.MEGA_SATAN) .. ".") .. tostring(MegaSatanVariant.MEGA_SATAN_LEFT_HAND),
19337
+ (tostring(EntityType.MEGA_SATAN_2) .. ".") .. tostring(MegaSatanVariant.MEGA_SATAN),
19338
+ (tostring(EntityType.MEGA_SATAN_2) .. ".") .. tostring(MegaSatanVariant.MEGA_SATAN_RIGHT_HAND),
19339
+ (tostring(EntityType.MEGA_SATAN_2) .. ".") .. tostring(MegaSatanVariant.MEGA_SATAN_LEFT_HAND),
19340
+ (tostring(EntityType.ULTRA_GREED) .. ".") .. tostring(UltraGreedVariant.ULTRA_GREED),
19341
+ (tostring(EntityType.ULTRA_GREED) .. ".") .. tostring(UltraGreedVariant.ULTRA_GREEDIER),
19342
+ tostring(EntityType.HUSH) .. ".0",
19343
+ tostring(EntityType.DELIRIUM) .. ".0",
19344
+ (tostring(EntityType.BLOOD_PUPPY) .. ".") .. tostring(BloodPuppyVariant.SMALL),
19345
+ (tostring(EntityType.BLOOD_PUPPY) .. ".") .. tostring(BloodPuppyVariant.LARGE),
19346
+ (tostring(EntityType.SUB_HORF) .. ".") .. tostring(SubHorfVariant.TAINTED_SUB_HORF),
19347
+ (tostring(EntityType.FACELESS) .. ".") .. tostring(FacelessVariant.TAINTED_FACELESS),
19348
+ (tostring(EntityType.MOLE) .. ".") .. tostring(MoleVariant.TAINTED_MOLE),
19349
+ (tostring(EntityType.GUTTED_FATTY) .. ".") .. tostring(GuttyFattyVariant.GUTTED_FATTY),
19350
+ (tostring(EntityType.GAPER_L2) .. ".") .. tostring(Gaper2Variant.GAPER),
19351
+ (tostring(EntityType.GAPER_L2) .. ".") .. tostring(Gaper2Variant.HORF),
19352
+ (tostring(EntityType.GAPER_L2) .. ".") .. tostring(Gaper2Variant.GUSHER),
19353
+ (tostring(EntityType.CHARGER_L2) .. ".") .. tostring(Charger2Variant.CHARGER),
19354
+ (tostring(EntityType.CHARGER_L2) .. ".") .. tostring(Charger2Variant.ELLEECH),
19355
+ tostring(EntityType.SHADY) .. ".0",
19356
+ (tostring(EntityType.MOTHER) .. ".") .. tostring(MotherVariant.MOTHER_1),
19357
+ (tostring(EntityType.MOTHER) .. ".") .. tostring(MotherVariant.MOTHER_2),
19358
+ (tostring(EntityType.DOGMA) .. ".") .. tostring(DogmaVariant.TV),
19359
+ (tostring(EntityType.DOGMA) .. ".") .. tostring(DogmaVariant.ANGEL_PHASE_2),
19360
+ (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.BEAST),
19361
+ (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.ULTRA_FAMINE),
19362
+ (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.ULTRA_PESTILENCE),
19363
+ (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.ULTRA_WAR),
19364
+ (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.ULTRA_DEATH)
19365
+ }
19366
+ )
19292
19367
  return ____exports
19293
19368
  end,
19294
19369
  ["src.sets.storyBossesSet"] = function(...)
@@ -19499,8 +19574,8 @@ return ____exports
19499
19574
  end,
19500
19575
  ["src.functions.entities"] = function(...)
19501
19576
  local ____lualib = require("lualib_bundle")
19502
- local __TS__ArrayFind = ____lualib.__TS__ArrayFind
19503
19577
  local Set = ____lualib.Set
19578
+ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
19504
19579
  local __TS__New = ____lualib.__TS__New
19505
19580
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
19506
19581
  local __TS__StringSplit = ____lualib.__TS__StringSplit
@@ -19510,6 +19585,8 @@ local ____cachedClasses = require("src.core.cachedClasses")
19510
19585
  local game = ____cachedClasses.game
19511
19586
  local ____constants = require("src.core.constants")
19512
19587
  local VectorZero = ____constants.VectorZero
19588
+ local ____entitiesWithArmorSet = require("src.sets.entitiesWithArmorSet")
19589
+ local ENTITIES_WITH_ARMOR_SET = ____entitiesWithArmorSet.ENTITIES_WITH_ARMOR_SET
19513
19590
  local ____storyBossesSet = require("src.sets.storyBossesSet")
19514
19591
  local STORY_BOSSES_SET = ____storyBossesSet.STORY_BOSSES_SET
19515
19592
  local ____isaacAPIClass = require("src.functions.isaacAPIClass")
@@ -19685,6 +19762,10 @@ function ____exports.getFilteredNewEntities(self, oldEntities, newEntities)
19685
19762
  end
19686
19763
  )
19687
19764
  end
19765
+ function ____exports.hasArmor(self, entity)
19766
+ local typeVariantString = (tostring(entity.Type) .. ".") .. tostring(entity.Variant)
19767
+ return ENTITIES_WITH_ARMOR_SET:has(typeVariantString)
19768
+ end
19688
19769
  function ____exports.isEntityMoving(self, entity, threshold)
19689
19770
  if threshold == nil then
19690
19771
  threshold = 0.01
@@ -41946,16 +42027,15 @@ function ____exports.getPreviousRoomDescription(self)
41946
42027
  error("Failed to find a room description for any rooms thus far on this run.")
41947
42028
  end
41948
42029
  function ____exports.getLatestRoomDescription(self)
41949
- local latestRoomDescription = getLastElement(nil, v.run.roomHistory)
41950
- if latestRoomDescription == nil then
41951
- error("Failed to get the latest room description since the room history array was empty.")
41952
- end
41953
- return latestRoomDescription
42030
+ return getLastElement(nil, v.run.roomHistory)
41954
42031
  end
41955
42032
  function ____exports.isLeavingRoom(self)
41956
42033
  local roomListIndex = getRoomListIndex(nil)
41957
42034
  local roomVisitedCount = getRoomVisitedCount(nil)
41958
42035
  local latestRoomDescription = ____exports.getLatestRoomDescription(nil)
42036
+ if latestRoomDescription == nil then
42037
+ return false
42038
+ end
41959
42039
  return roomListIndex ~= latestRoomDescription.roomListIndex or roomVisitedCount ~= latestRoomDescription.roomVisitedCount
41960
42040
  end
41961
42041
  return ____exports
@@ -42000,6 +42080,9 @@ function checkDespawningFromPlayerLeavingRoom(self, entity)
42000
42080
  end
42001
42081
  function trackDespawningPickupPosition(self, entity, index)
42002
42082
  local previousRoomDescription = getLatestRoomDescription(nil)
42083
+ if previousRoomDescription == nil then
42084
+ return
42085
+ end
42003
42086
  local previousRoomListIndex = previousRoomDescription.roomListIndex
42004
42087
  local persistentEntityDescription = {
42005
42088
  entityType = entity.Type,
@@ -42017,7 +42100,7 @@ function postNewRoomReordered(self)
42017
42100
  local description = ____value[2]
42018
42101
  do
42019
42102
  if roomListIndex ~= description.roomListIndex then
42020
- goto __continue9
42103
+ goto __continue10
42021
42104
  end
42022
42105
  v.level.persistentEntities:delete(index)
42023
42106
  spawnAndTrack(
@@ -42030,7 +42113,7 @@ function postNewRoomReordered(self)
42030
42113
  true
42031
42114
  )
42032
42115
  end
42033
- ::__continue9::
42116
+ ::__continue10::
42034
42117
  end
42035
42118
  end
42036
42119
  function spawnAndTrack(self, entityType, variant, subType, position, index, respawning)
@@ -42091,14 +42174,14 @@ function ____exports.removePersistentEntity(self, persistentEntityIndex, removeE
42091
42174
  do
42092
42175
  local index, entityPtr = table.unpack(tuple)
42093
42176
  if index ~= persistentEntityIndex then
42094
- goto __continue16
42177
+ goto __continue17
42095
42178
  end
42096
42179
  v.room.spawnedPersistentEntities:delete(ptrHash)
42097
42180
  if removeEntity and entityPtr.Ref ~= nil then
42098
42181
  entityPtr.Ref:Remove()
42099
42182
  end
42100
42183
  end
42101
- ::__continue16::
42184
+ ::__continue17::
42102
42185
  end
42103
42186
  end
42104
42187
  return ____exports
@@ -42172,6 +42255,9 @@ function checkDespawningFromPlayerLeavingRoom(self, entity)
42172
42255
  end
42173
42256
  function trackDespawningPickupMetadata(self, entity, pickupIndex)
42174
42257
  local previousRoomDescription = getLatestRoomDescription(nil)
42258
+ if previousRoomDescription == nil then
42259
+ return
42260
+ end
42175
42261
  local previousRoomListIndex = previousRoomDescription.roomListIndex
42176
42262
  local pickupDescriptions = v.level.pickupData:getAndSetDefault(previousRoomListIndex)
42177
42263
  local pickupDescription = {position = entity.Position, initSeed = entity.InitSeed}
@@ -42182,16 +42268,16 @@ function trackDespawningPickupMetadata(self, entity, pickupIndex)
42182
42268
  local room = game:GetRoom()
42183
42269
  local roomType = room:GetType()
42184
42270
  repeat
42185
- local ____switch13 = roomType
42186
- local ____cond13 = ____switch13 == RoomType.TREASURE
42187
- if ____cond13 then
42271
+ local ____switch14 = roomType
42272
+ local ____cond14 = ____switch14 == RoomType.TREASURE
42273
+ if ____cond14 then
42188
42274
  do
42189
42275
  v.run.pickupDataTreasureRooms:set(pickupIndex, pickupDescription)
42190
42276
  break
42191
42277
  end
42192
42278
  end
42193
- ____cond13 = ____cond13 or ____switch13 == RoomType.BOSS
42194
- if ____cond13 then
42279
+ ____cond14 = ____cond14 or ____switch14 == RoomType.BOSS
42280
+ if ____cond14 then
42195
42281
  do
42196
42282
  v.run.pickupDataBossRooms:set(pickupIndex, pickupDescription)
42197
42283
  break
@@ -42243,15 +42329,15 @@ function getPostAscentPickupIndex(self, pickup)
42243
42329
  local room = game:GetRoom()
42244
42330
  local roomType = room:GetType()
42245
42331
  repeat
42246
- local ____switch29 = roomType
42247
- local ____cond29 = ____switch29 == RoomType.TREASURE
42248
- if ____cond29 then
42332
+ local ____switch30 = roomType
42333
+ local ____cond30 = ____switch30 == RoomType.TREASURE
42334
+ if ____cond30 then
42249
42335
  do
42250
42336
  return getStoredPickupIndex(nil, pickup, v.run.pickupDataTreasureRooms)
42251
42337
  end
42252
42338
  end
42253
- ____cond29 = ____cond29 or ____switch29 == RoomType.BOSS
42254
- if ____cond29 then
42339
+ ____cond30 = ____cond30 or ____switch30 == RoomType.BOSS
42340
+ if ____cond30 then
42255
42341
  do
42256
42342
  return getStoredPickupIndex(nil, pickup, v.run.pickupDataBossRooms)
42257
42343
  end
@@ -52207,40 +52293,6 @@ do
52207
52293
  end
52208
52294
  end
52209
52295
  end
52210
- return ____exports
52211
- end,
52212
- ["src.sets.entitiesWithArmorSet"] = function(...)
52213
- local ____lualib = require("lualib_bundle")
52214
- local Set = ____lualib.Set
52215
- local __TS__New = ____lualib.__TS__New
52216
- local ____exports = {}
52217
- local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
52218
- local BeastVariant = ____isaac_2Dtypescript_2Ddefinitions.BeastVariant
52219
- local BoomFlyVariant = ____isaac_2Dtypescript_2Ddefinitions.BoomFlyVariant
52220
- local DogmaVariant = ____isaac_2Dtypescript_2Ddefinitions.DogmaVariant
52221
- local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
52222
- local HiveVariant = ____isaac_2Dtypescript_2Ddefinitions.HiveVariant
52223
- local HopperVariant = ____isaac_2Dtypescript_2Ddefinitions.HopperVariant
52224
- local MotherVariant = ____isaac_2Dtypescript_2Ddefinitions.MotherVariant
52225
- local PooterVariant = ____isaac_2Dtypescript_2Ddefinitions.PooterVariant
52226
- ____exports.ENTITIES_WITH_ARMOR_SET = __TS__New(
52227
- Set,
52228
- {
52229
- (tostring(EntityType.POOTER) .. ".") .. tostring(PooterVariant.TAINTED_POOTER),
52230
- (tostring(EntityType.HIVE) .. ".") .. tostring(HiveVariant.TAINTED_MULLIGAN),
52231
- (tostring(EntityType.BOOM_FLY) .. ".") .. tostring(BoomFlyVariant.TAINTED_BOOM_FLY),
52232
- (tostring(EntityType.HOPPER) .. ".") .. tostring(HopperVariant.TAINTED_HOPPER),
52233
- tostring(EntityType.SPITTY),
52234
- (tostring(EntityType.MOTHER) .. ".") .. tostring(MotherVariant.MOTHER_1),
52235
- (tostring(EntityType.MOTHER) .. ".") .. tostring(MotherVariant.MOTHER_2),
52236
- (tostring(EntityType.DOGMA) .. ".") .. tostring(DogmaVariant.DOGMA_PHASE_1),
52237
- (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.BEAST),
52238
- (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.ULTRA_FAMINE),
52239
- (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.ULTRA_PESTILENCE),
52240
- (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.ULTRA_WAR),
52241
- (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.ULTRA_DEATH)
52242
- }
52243
- )
52244
52296
  return ____exports
52245
52297
  end,
52246
52298
  }
@@ -1 +1 @@
1
- {"version":3,"file":"persistentEntities.d.ts","sourceRoot":"","sources":["../../../src/features/persistentEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAgHtC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,MAAM,GACf,CAAC,MAAM,EAAE,GAAG,CAAC,CAcf;AAwBD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,qBAAqB,EAAE,GAAG,EAC1B,YAAY,UAAO,GAClB,IAAI,CAiBN"}
1
+ {"version":3,"file":"persistentEntities.d.ts","sourceRoot":"","sources":["../../../src/features/persistentEntities.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEX,MAAM,8BAA8B,CAAC;AAoHtC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,MAAM,GACf,CAAC,MAAM,EAAE,GAAG,CAAC,CAcf;AAwBD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,qBAAqB,EAAE,GAAG,EAC1B,YAAY,UAAO,GAClB,IAAI,CAiBN"}
@@ -37,6 +37,9 @@ function checkDespawningFromPlayerLeavingRoom(self, entity)
37
37
  end
38
38
  function trackDespawningPickupPosition(self, entity, index)
39
39
  local previousRoomDescription = getLatestRoomDescription(nil)
40
+ if previousRoomDescription == nil then
41
+ return
42
+ end
40
43
  local previousRoomListIndex = previousRoomDescription.roomListIndex
41
44
  local persistentEntityDescription = {
42
45
  entityType = entity.Type,
@@ -54,7 +57,7 @@ function postNewRoomReordered(self)
54
57
  local description = ____value[2]
55
58
  do
56
59
  if roomListIndex ~= description.roomListIndex then
57
- goto __continue9
60
+ goto __continue10
58
61
  end
59
62
  v.level.persistentEntities:delete(index)
60
63
  spawnAndTrack(
@@ -67,7 +70,7 @@ function postNewRoomReordered(self)
67
70
  true
68
71
  )
69
72
  end
70
- ::__continue9::
73
+ ::__continue10::
71
74
  end
72
75
  end
73
76
  function spawnAndTrack(self, entityType, variant, subType, position, index, respawning)
@@ -152,14 +155,14 @@ function ____exports.removePersistentEntity(self, persistentEntityIndex, removeE
152
155
  do
153
156
  local index, entityPtr = table.unpack(tuple)
154
157
  if index ~= persistentEntityIndex then
155
- goto __continue16
158
+ goto __continue17
156
159
  end
157
160
  v.room.spawnedPersistentEntities:delete(ptrHash)
158
161
  if removeEntity and entityPtr.Ref ~= nil then
159
162
  entityPtr.Ref:Remove()
160
163
  end
161
164
  end
162
- ::__continue16::
165
+ ::__continue17::
163
166
  end
164
167
  end
165
168
  return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"pickupIndex.d.ts","sourceRoot":"","sources":["../../../src/features/pickupIndex.ts"],"names":[],"mappings":";AAeA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAkNnD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,CAahE"}
1
+ {"version":3,"file":"pickupIndex.d.ts","sourceRoot":"","sources":["../../../src/features/pickupIndex.ts"],"names":[],"mappings":";AAeA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAsNnD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW,CAahE"}
@@ -62,6 +62,9 @@ function checkDespawningFromPlayerLeavingRoom(self, entity)
62
62
  end
63
63
  function trackDespawningPickupMetadata(self, entity, pickupIndex)
64
64
  local previousRoomDescription = getLatestRoomDescription(nil)
65
+ if previousRoomDescription == nil then
66
+ return
67
+ end
65
68
  local previousRoomListIndex = previousRoomDescription.roomListIndex
66
69
  local pickupDescriptions = v.level.pickupData:getAndSetDefault(previousRoomListIndex)
67
70
  local pickupDescription = {position = entity.Position, initSeed = entity.InitSeed}
@@ -72,16 +75,16 @@ function trackDespawningPickupMetadata(self, entity, pickupIndex)
72
75
  local room = game:GetRoom()
73
76
  local roomType = room:GetType()
74
77
  repeat
75
- local ____switch13 = roomType
76
- local ____cond13 = ____switch13 == RoomType.TREASURE
77
- if ____cond13 then
78
+ local ____switch14 = roomType
79
+ local ____cond14 = ____switch14 == RoomType.TREASURE
80
+ if ____cond14 then
78
81
  do
79
82
  v.run.pickupDataTreasureRooms:set(pickupIndex, pickupDescription)
80
83
  break
81
84
  end
82
85
  end
83
- ____cond13 = ____cond13 or ____switch13 == RoomType.BOSS
84
- if ____cond13 then
86
+ ____cond14 = ____cond14 or ____switch14 == RoomType.BOSS
87
+ if ____cond14 then
85
88
  do
86
89
  v.run.pickupDataBossRooms:set(pickupIndex, pickupDescription)
87
90
  break
@@ -133,15 +136,15 @@ function getPostAscentPickupIndex(self, pickup)
133
136
  local room = game:GetRoom()
134
137
  local roomType = room:GetType()
135
138
  repeat
136
- local ____switch29 = roomType
137
- local ____cond29 = ____switch29 == RoomType.TREASURE
138
- if ____cond29 then
139
+ local ____switch30 = roomType
140
+ local ____cond30 = ____switch30 == RoomType.TREASURE
141
+ if ____cond30 then
139
142
  do
140
143
  return getStoredPickupIndex(nil, pickup, v.run.pickupDataTreasureRooms)
141
144
  end
142
145
  end
143
- ____cond29 = ____cond29 or ____switch29 == RoomType.BOSS
144
- if ____cond29 then
146
+ ____cond30 = ____cond30 or ____switch30 == RoomType.BOSS
147
+ if ____cond30 then
145
148
  do
146
149
  return getStoredPickupIndex(nil, pickup, v.run.pickupDataBossRooms)
147
150
  end
@@ -16,8 +16,11 @@ export declare function getPreviousRoomDescription(): RoomDescription;
16
16
  * array.
17
17
  *
18
18
  * This is useful in the `POST_ENTITY_REMOVE` callback; see the `isLeavingRoom` function.
19
+ *
20
+ * Note that this function can return undefined in the case where it is called on the first room of
21
+ * the run.
19
22
  */
20
- export declare function getLatestRoomDescription(): RoomDescription;
23
+ export declare function getLatestRoomDescription(): RoomDescription | undefined;
21
24
  /**
22
25
  * Helper function to detect if the game is in the state where the room index has changed to a new
23
26
  * room, but the entities from the previous room are currently in the process of despawning. (At
@@ -25,7 +28,7 @@ export declare function getLatestRoomDescription(): RoomDescription;
25
28
  * in the room history array for the current room.)
26
29
  *
27
30
  * This function is intended to be used in the `POST_ENTITY_REMOVE` callback to detect when an
28
- * entity is pseudo-persistent entity such as a pickup is despawning.
31
+ * entity is despawning.
29
32
  */
30
33
  export declare function isLeavingRoom(): boolean;
31
34
  //# sourceMappingURL=roomHistory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"roomHistory.d.ts","sourceRoot":"","sources":["../../../src/features/roomHistory.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAmDhE;;;GAGG;AACH,wBAAgB,cAAc,IAAI,SAAS,eAAe,EAAE,CAG3D;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,IAAI,eAAe,CAe5D;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,IAAI,eAAe,CAS1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,IAAI,OAAO,CASvC"}
1
+ {"version":3,"file":"roomHistory.d.ts","sourceRoot":"","sources":["../../../src/features/roomHistory.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAmDhE;;;GAGG;AACH,wBAAgB,cAAc,IAAI,SAAS,eAAe,EAAE,CAG3D;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,IAAI,eAAe,CAe5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,IAAI,eAAe,GAAG,SAAS,CAEtE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAevC"}
@@ -79,12 +79,11 @@ end
79
79
  -- array.
80
80
  --
81
81
  -- This is useful in the `POST_ENTITY_REMOVE` callback; see the `isLeavingRoom` function.
82
+ --
83
+ -- Note that this function can return undefined in the case where it is called on the first room of
84
+ -- the run.
82
85
  function ____exports.getLatestRoomDescription(self)
83
- local latestRoomDescription = getLastElement(nil, v.run.roomHistory)
84
- if latestRoomDescription == nil then
85
- error("Failed to get the latest room description since the room history array was empty.")
86
- end
87
- return latestRoomDescription
86
+ return getLastElement(nil, v.run.roomHistory)
88
87
  end
89
88
  --- Helper function to detect if the game is in the state where the room index has changed to a new
90
89
  -- room, but the entities from the previous room are currently in the process of despawning. (At
@@ -92,11 +91,14 @@ end
92
91
  -- in the room history array for the current room.)
93
92
  --
94
93
  -- This function is intended to be used in the `POST_ENTITY_REMOVE` callback to detect when an
95
- -- entity is pseudo-persistent entity such as a pickup is despawning.
94
+ -- entity is despawning.
96
95
  function ____exports.isLeavingRoom(self)
97
96
  local roomListIndex = getRoomListIndex(nil)
98
97
  local roomVisitedCount = getRoomVisitedCount(nil)
99
98
  local latestRoomDescription = ____exports.getLatestRoomDescription(nil)
99
+ if latestRoomDescription == nil then
100
+ return false
101
+ end
100
102
  return roomListIndex ~= latestRoomDescription.roomListIndex or roomVisitedCount ~= latestRoomDescription.roomVisitedCount
101
103
  end
102
104
  return ____exports
@@ -88,6 +88,13 @@ export declare function getEntityIDFromConstituents(entityType: EntityType, vari
88
88
  * second array but not in the first array.
89
89
  */
90
90
  export declare function getFilteredNewEntities<T extends AnyEntity>(oldEntities: T[], newEntities: T[]): T[];
91
+ /**
92
+ * Helper function to see if a particular entity has armor. In this context, armor refers to the
93
+ * damage scaling mechanic. For example, Ultra Greed has armor, but a Gaper does not.
94
+ *
95
+ * For more on armor, see the wiki: https://bindingofisaacrebirth.fandom.com/wiki/Damage_Scaling
96
+ */
97
+ export declare function hasArmor(entity: Entity): boolean;
91
98
  /**
92
99
  * Helper function to measure an entity's velocity to see if it is moving.
93
100
  *
@@ -1 +1 @@
1
- {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../../src/functions/entities.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI1D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAkB/C;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,GAAG,CAcL;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,OAAO,CAGT;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,SAAS,EACpD,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,CAAC,EAAE,GACZ,CAAC,GAAG,SAAS,CAaf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,WAAW,CACzB,UAAU,GAAE,UAAe,EAC3B,OAAO,SAAK,EACZ,OAAO,SAAK,EACZ,cAAc,UAAQ,GACrB,MAAM,EAAE,CAMV;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CA8B3C;AA0BD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAGzE;AAED,2FAA2F;AAC3F,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG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,CACvC,UAAU,EAAE,UAAU,EACtB,aAAa,SAAK,EAClB,aAAa,SAAK,EAClB,GAAG,GAAE,GAAG,GAAG,SAAqB,GAC/B,MAAM,EAAE,CAGV;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,SAAS,EAChD,QAAQ,EAAE,CAAC,EAAE,EACb,GAAG,CAAC,EAAE,GAAG,GACR,CAAC,EAAE,CAgBL;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgB9D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CASzD;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CACnB,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,EACvC,SAAS,GAAE,IAAI,GAAG,GAAG,GAAG,SAAqB,GAC5C,MAAM,CAsCR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,IAAI,GAAG,GAAG,EACrB,QAAQ,GAAE,MAAmB,EAC7B,OAAO,GAAE,MAAM,GAAG,SAAqB,GACtC,MAAM,CAUR"}
@@ -1,6 +1,6 @@
1
1
  local ____lualib = require("lualib_bundle")
2
- local __TS__ArrayFind = ____lualib.__TS__ArrayFind
3
2
  local Set = ____lualib.Set
3
+ local __TS__ArrayFind = ____lualib.__TS__ArrayFind
4
4
  local __TS__New = ____lualib.__TS__New
5
5
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
6
6
  local __TS__StringSplit = ____lualib.__TS__StringSplit
@@ -10,6 +10,8 @@ local ____cachedClasses = require("src.core.cachedClasses")
10
10
  local game = ____cachedClasses.game
11
11
  local ____constants = require("src.core.constants")
12
12
  local VectorZero = ____constants.VectorZero
13
+ local ____entitiesWithArmorSet = require("src.sets.entitiesWithArmorSet")
14
+ local ENTITIES_WITH_ARMOR_SET = ____entitiesWithArmorSet.ENTITIES_WITH_ARMOR_SET
13
15
  local ____storyBossesSet = require("src.sets.storyBossesSet")
14
16
  local STORY_BOSSES_SET = ____storyBossesSet.STORY_BOSSES_SET
15
17
  local ____isaacAPIClass = require("src.functions.isaacAPIClass")
@@ -253,6 +255,14 @@ function ____exports.getFilteredNewEntities(self, oldEntities, newEntities)
253
255
  end
254
256
  )
255
257
  end
258
+ --- Helper function to see if a particular entity has armor. In this context, armor refers to the
259
+ -- damage scaling mechanic. For example, Ultra Greed has armor, but a Gaper does not.
260
+ --
261
+ -- For more on armor, see the wiki: https://bindingofisaacrebirth.fandom.com/wiki/Damage_Scaling
262
+ function ____exports.hasArmor(self, entity)
263
+ local typeVariantString = (tostring(entity.Type) .. ".") .. tostring(entity.Variant)
264
+ return ENTITIES_WITH_ARMOR_SET:has(typeVariantString)
265
+ end
256
266
  --- Helper function to measure an entity's velocity to see if it is moving.
257
267
  --
258
268
  -- Use this helper function over checking if the velocity length is equal to 0 because entities can
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * For example:
10
10
  * - If the user does not have a HUD offset configured, this function will return `Vector(0, 0)`.
11
- * - If the user has a HUD offset of 1.0 configured, this function will return 10
11
+ * - If the user has a HUD offset of 1.0 configured, this function will return `Vector(20, 12)`.
12
12
  */
13
13
  export declare function getHUDOffsetVector(): Vector;
14
14
  /**
@@ -20,7 +20,7 @@ end
20
20
  --
21
21
  -- For example:
22
22
  -- - If the user does not have a HUD offset configured, this function will return `Vector(0, 0)`.
23
- -- - If the user has a HUD offset of 1.0 configured, this function will return 10
23
+ -- - If the user has a HUD offset of 1.0 configured, this function will return `Vector(20, 12)`.
24
24
  function ____exports.getHUDOffsetVector(self)
25
25
  local hudOffset = math.floor(Options.HUDOffset * 10)
26
26
  if hudOffset < 1 or hudOffset > 10 then
@@ -1,8 +1,13 @@
1
1
  /**
2
- * Corresponds to:
2
+ * "Armor" refers to the damage scaling mechanic. The following list corresponds to the entities
3
+ * that have the "shieldStrength" field in the "entities2.xml" file, with some exceptions.
4
+ * (Invulnerable enemies are not included. Furthermore, Ultra Greed, Ultra Greedier, and Delirium
5
+ * all have damage scaling, but do not have a corresponding "shieldStrength" field.)
6
+ *
7
+ * Also see:
3
8
  * https://bindingofisaacrebirth.fandom.com/wiki/Damage_Scaling#Entities_with_Armor_Values
4
9
  *
5
- * We use the entity ID instead of type + variant tuple so that we can have O(1) lookups.
10
+ * We use strings instead of a type + variant tuple so that we can have O(1) lookups.
6
11
  */
7
12
  export declare const ENTITIES_WITH_ARMOR_SET: Set<string>;
8
13
  //# sourceMappingURL=entitiesWithArmorSet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entitiesWithArmorSet.d.ts","sourceRoot":"","sources":["../../../src/sets/entitiesWithArmorSet.ts"],"names":[],"mappings":"AAWA;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,aAwClC,CAAC"}
1
+ {"version":3,"file":"entitiesWithArmorSet.d.ts","sourceRoot":"","sources":["../../../src/sets/entitiesWithArmorSet.ts"],"names":[],"mappings":"AAwBA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,aA0ClC,CAAC"}
@@ -4,17 +4,35 @@ local __TS__New = ____lualib.__TS__New
4
4
  local ____exports = {}
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
6
  local BeastVariant = ____isaac_2Dtypescript_2Ddefinitions.BeastVariant
7
+ local BloodPuppyVariant = ____isaac_2Dtypescript_2Ddefinitions.BloodPuppyVariant
7
8
  local BoomFlyVariant = ____isaac_2Dtypescript_2Ddefinitions.BoomFlyVariant
9
+ local Charger2Variant = ____isaac_2Dtypescript_2Ddefinitions.Charger2Variant
8
10
  local DogmaVariant = ____isaac_2Dtypescript_2Ddefinitions.DogmaVariant
9
11
  local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
12
+ local FacelessVariant = ____isaac_2Dtypescript_2Ddefinitions.FacelessVariant
13
+ local Gaper2Variant = ____isaac_2Dtypescript_2Ddefinitions.Gaper2Variant
14
+ local GuttyFattyVariant = ____isaac_2Dtypescript_2Ddefinitions.GuttyFattyVariant
10
15
  local HiveVariant = ____isaac_2Dtypescript_2Ddefinitions.HiveVariant
11
16
  local HopperVariant = ____isaac_2Dtypescript_2Ddefinitions.HopperVariant
17
+ local IsaacVariant = ____isaac_2Dtypescript_2Ddefinitions.IsaacVariant
18
+ local MegaSatanVariant = ____isaac_2Dtypescript_2Ddefinitions.MegaSatanVariant
19
+ local MoleVariant = ____isaac_2Dtypescript_2Ddefinitions.MoleVariant
12
20
  local MotherVariant = ____isaac_2Dtypescript_2Ddefinitions.MotherVariant
13
21
  local PooterVariant = ____isaac_2Dtypescript_2Ddefinitions.PooterVariant
14
- --- Corresponds to:
22
+ local RoundWormVariant = ____isaac_2Dtypescript_2Ddefinitions.RoundWormVariant
23
+ local SubHorfVariant = ____isaac_2Dtypescript_2Ddefinitions.SubHorfVariant
24
+ local SuckerVariant = ____isaac_2Dtypescript_2Ddefinitions.SuckerVariant
25
+ local UltraGreedVariant = ____isaac_2Dtypescript_2Ddefinitions.UltraGreedVariant
26
+ local WallCreepVariant = ____isaac_2Dtypescript_2Ddefinitions.WallCreepVariant
27
+ --- "Armor" refers to the damage scaling mechanic. The following list corresponds to the entities
28
+ -- that have the "shieldStrength" field in the "entities2.xml" file, with some exceptions.
29
+ -- (Invulnerable enemies are not included. Furthermore, Ultra Greed, Ultra Greedier, and Delirium
30
+ -- all have damage scaling, but do not have a corresponding "shieldStrength" field.)
31
+ --
32
+ -- Also see:
15
33
  -- https://bindingofisaacrebirth.fandom.com/wiki/Damage_Scaling#Entities_with_Armor_Values
16
34
  --
17
- -- We use the entity ID instead of type + variant tuple so that we can have O(1) lookups.
35
+ -- We use strings instead of a type + variant tuple so that we can have O(1) lookups.
18
36
  ____exports.ENTITIES_WITH_ARMOR_SET = __TS__New(
19
37
  Set,
20
38
  {
@@ -23,9 +41,37 @@ ____exports.ENTITIES_WITH_ARMOR_SET = __TS__New(
23
41
  (tostring(EntityType.BOOM_FLY) .. ".") .. tostring(BoomFlyVariant.TAINTED_BOOM_FLY),
24
42
  (tostring(EntityType.HOPPER) .. ".") .. tostring(HopperVariant.TAINTED_HOPPER),
25
43
  tostring(EntityType.SPITTY),
44
+ (tostring(EntityType.SUCKER) .. ".") .. tostring(SuckerVariant.TAINTED_SUCKER),
45
+ (tostring(EntityType.ISAAC) .. ".") .. tostring(IsaacVariant.BLUE_BABY_HUSH),
46
+ (tostring(EntityType.WALL_CREEP) .. ".") .. tostring(WallCreepVariant.TAINTED_SOY_CREEP),
47
+ (tostring(EntityType.ROUND_WORM) .. ".") .. tostring(RoundWormVariant.TAINTED_ROUND_WORM),
48
+ (tostring(EntityType.ROUND_WORM) .. ".") .. tostring(RoundWormVariant.TAINTED_TUBE_WORM),
49
+ (tostring(EntityType.MEGA_SATAN) .. ".") .. tostring(MegaSatanVariant.MEGA_SATAN),
50
+ (tostring(EntityType.MEGA_SATAN) .. ".") .. tostring(MegaSatanVariant.MEGA_SATAN_RIGHT_HAND),
51
+ (tostring(EntityType.MEGA_SATAN) .. ".") .. tostring(MegaSatanVariant.MEGA_SATAN_LEFT_HAND),
52
+ (tostring(EntityType.MEGA_SATAN_2) .. ".") .. tostring(MegaSatanVariant.MEGA_SATAN),
53
+ (tostring(EntityType.MEGA_SATAN_2) .. ".") .. tostring(MegaSatanVariant.MEGA_SATAN_RIGHT_HAND),
54
+ (tostring(EntityType.MEGA_SATAN_2) .. ".") .. tostring(MegaSatanVariant.MEGA_SATAN_LEFT_HAND),
55
+ (tostring(EntityType.ULTRA_GREED) .. ".") .. tostring(UltraGreedVariant.ULTRA_GREED),
56
+ (tostring(EntityType.ULTRA_GREED) .. ".") .. tostring(UltraGreedVariant.ULTRA_GREEDIER),
57
+ tostring(EntityType.HUSH) .. ".0",
58
+ tostring(EntityType.DELIRIUM) .. ".0",
59
+ (tostring(EntityType.BLOOD_PUPPY) .. ".") .. tostring(BloodPuppyVariant.SMALL),
60
+ (tostring(EntityType.BLOOD_PUPPY) .. ".") .. tostring(BloodPuppyVariant.LARGE),
61
+ (tostring(EntityType.SUB_HORF) .. ".") .. tostring(SubHorfVariant.TAINTED_SUB_HORF),
62
+ (tostring(EntityType.FACELESS) .. ".") .. tostring(FacelessVariant.TAINTED_FACELESS),
63
+ (tostring(EntityType.MOLE) .. ".") .. tostring(MoleVariant.TAINTED_MOLE),
64
+ (tostring(EntityType.GUTTED_FATTY) .. ".") .. tostring(GuttyFattyVariant.GUTTED_FATTY),
65
+ (tostring(EntityType.GAPER_L2) .. ".") .. tostring(Gaper2Variant.GAPER),
66
+ (tostring(EntityType.GAPER_L2) .. ".") .. tostring(Gaper2Variant.HORF),
67
+ (tostring(EntityType.GAPER_L2) .. ".") .. tostring(Gaper2Variant.GUSHER),
68
+ (tostring(EntityType.CHARGER_L2) .. ".") .. tostring(Charger2Variant.CHARGER),
69
+ (tostring(EntityType.CHARGER_L2) .. ".") .. tostring(Charger2Variant.ELLEECH),
70
+ tostring(EntityType.SHADY) .. ".0",
26
71
  (tostring(EntityType.MOTHER) .. ".") .. tostring(MotherVariant.MOTHER_1),
27
72
  (tostring(EntityType.MOTHER) .. ".") .. tostring(MotherVariant.MOTHER_2),
28
- (tostring(EntityType.DOGMA) .. ".") .. tostring(DogmaVariant.DOGMA_PHASE_1),
73
+ (tostring(EntityType.DOGMA) .. ".") .. tostring(DogmaVariant.TV),
74
+ (tostring(EntityType.DOGMA) .. ".") .. tostring(DogmaVariant.ANGEL_PHASE_2),
29
75
  (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.BEAST),
30
76
  (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.ULTRA_FAMINE),
31
77
  (tostring(EntityType.BEAST) .. ".") .. tostring(BeastVariant.ULTRA_PESTILENCE),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "12.4.0",
3
+ "version": "12.5.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -82,6 +82,10 @@ function trackDespawningPickupPosition(entity: Entity, index: int) {
82
82
  // (The "latest" room description is really the previous room, because the `POST_NEW_ROOM`
83
83
  // callback was not fired yet.)
84
84
  const previousRoomDescription = getLatestRoomDescription();
85
+ if (previousRoomDescription === undefined) {
86
+ return;
87
+ }
88
+
85
89
  const previousRoomListIndex = previousRoomDescription.roomListIndex;
86
90
  const persistentEntityDescription: PersistentEntityDescription = {
87
91
  entityType: entity.Type,
@@ -114,6 +114,10 @@ function trackDespawningPickupMetadata(
114
114
  // The "latest" room description is really the previous room, because the `POST_NEW_ROOM` callback
115
115
  // was not fired yet.
116
116
  const previousRoomDescription = getLatestRoomDescription();
117
+ if (previousRoomDescription === undefined) {
118
+ return;
119
+ }
120
+
117
121
  const previousRoomListIndex = previousRoomDescription.roomListIndex;
118
122
  const pickupDescriptions = v.level.pickupData.getAndSetDefault(
119
123
  previousRoomListIndex,
@@ -100,16 +100,12 @@ export function getPreviousRoomDescription(): RoomDescription {
100
100
  * array.
101
101
  *
102
102
  * This is useful in the `POST_ENTITY_REMOVE` callback; see the `isLeavingRoom` function.
103
+ *
104
+ * Note that this function can return undefined in the case where it is called on the first room of
105
+ * the run.
103
106
  */
104
- export function getLatestRoomDescription(): RoomDescription {
105
- const latestRoomDescription = getLastElement(v.run.roomHistory);
106
- if (latestRoomDescription === undefined) {
107
- error(
108
- "Failed to get the latest room description since the room history array was empty.",
109
- );
110
- }
111
-
112
- return latestRoomDescription;
107
+ export function getLatestRoomDescription(): RoomDescription | undefined {
108
+ return getLastElement(v.run.roomHistory);
113
109
  }
114
110
 
115
111
  /**
@@ -119,13 +115,19 @@ export function getLatestRoomDescription(): RoomDescription {
119
115
  * in the room history array for the current room.)
120
116
  *
121
117
  * This function is intended to be used in the `POST_ENTITY_REMOVE` callback to detect when an
122
- * entity is pseudo-persistent entity such as a pickup is despawning.
118
+ * entity is despawning.
123
119
  */
124
120
  export function isLeavingRoom(): boolean {
125
121
  const roomListIndex = getRoomListIndex();
126
122
  const roomVisitedCount = getRoomVisitedCount();
127
123
  const latestRoomDescription = getLatestRoomDescription();
128
124
 
125
+ // Sometimes, this function can be called in situations where entities from the previous run are
126
+ // being despawned. If this is the case, then the room history will currently be empty.
127
+ if (latestRoomDescription === undefined) {
128
+ return false;
129
+ }
130
+
129
131
  return (
130
132
  roomListIndex !== latestRoomDescription.roomListIndex ||
131
133
  roomVisitedCount !== latestRoomDescription.roomVisitedCount
@@ -1,6 +1,7 @@
1
1
  import { EntityType } from "isaac-typescript-definitions";
2
2
  import { game } from "../core/cachedClasses";
3
3
  import { VectorZero } from "../core/constants";
4
+ import { ENTITIES_WITH_ARMOR_SET } from "../sets/entitiesWithArmorSet";
4
5
  import { STORY_BOSSES_SET } from "../sets/storyBossesSet";
5
6
  import { AnyEntity } from "../types/AnyEntity";
6
7
  import { getIsaacAPIClassName } from "./isaacAPIClass";
@@ -251,6 +252,17 @@ export function getFilteredNewEntities<T extends AnyEntity>(
251
252
  });
252
253
  }
253
254
 
255
+ /**
256
+ * Helper function to see if a particular entity has armor. In this context, armor refers to the
257
+ * damage scaling mechanic. For example, Ultra Greed has armor, but a Gaper does not.
258
+ *
259
+ * For more on armor, see the wiki: https://bindingofisaacrebirth.fandom.com/wiki/Damage_Scaling
260
+ */
261
+ export function hasArmor(entity: Entity): boolean {
262
+ const typeVariantString = `${entity.Type}.${entity.Variant}`;
263
+ return ENTITIES_WITH_ARMOR_SET.has(typeVariantString);
264
+ }
265
+
254
266
  /**
255
267
  * Helper function to measure an entity's velocity to see if it is moving.
256
268
  *
@@ -10,7 +10,7 @@ import { copyVector } from "./vector";
10
10
  *
11
11
  * For example:
12
12
  * - If the user does not have a HUD offset configured, this function will return `Vector(0, 0)`.
13
- * - If the user has a HUD offset of 1.0 configured, this function will return 10
13
+ * - If the user has a HUD offset of 1.0 configured, this function will return `Vector(20, 12)`.
14
14
  */
15
15
  export function getHUDOffsetVector(): Vector {
16
16
  // Convert e.g. 0.4 to 4.
@@ -1,55 +1,75 @@
1
1
  import {
2
2
  BeastVariant,
3
+ BloodPuppyVariant,
3
4
  BoomFlyVariant,
5
+ Charger2Variant,
4
6
  DogmaVariant,
5
7
  EntityType,
8
+ FacelessVariant,
9
+ Gaper2Variant,
10
+ GuttyFattyVariant,
6
11
  HiveVariant,
7
12
  HopperVariant,
13
+ IsaacVariant,
14
+ MegaSatanVariant,
15
+ MoleVariant,
8
16
  MotherVariant,
9
17
  PooterVariant,
18
+ RoundWormVariant,
19
+ SubHorfVariant,
20
+ SuckerVariant,
21
+ UltraGreedVariant,
22
+ WallCreepVariant,
10
23
  } from "isaac-typescript-definitions";
11
24
 
12
25
  /**
13
- * Corresponds to:
26
+ * "Armor" refers to the damage scaling mechanic. The following list corresponds to the entities
27
+ * that have the "shieldStrength" field in the "entities2.xml" file, with some exceptions.
28
+ * (Invulnerable enemies are not included. Furthermore, Ultra Greed, Ultra Greedier, and Delirium
29
+ * all have damage scaling, but do not have a corresponding "shieldStrength" field.)
30
+ *
31
+ * Also see:
14
32
  * https://bindingofisaacrebirth.fandom.com/wiki/Damage_Scaling#Entities_with_Armor_Values
15
33
  *
16
- * We use the entity ID instead of type + variant tuple so that we can have O(1) lookups.
34
+ * We use strings instead of a type + variant tuple so that we can have O(1) lookups.
17
35
  */
18
36
  export const ENTITIES_WITH_ARMOR_SET = new Set([
19
37
  `${EntityType.POOTER}.${PooterVariant.TAINTED_POOTER}`, // 14.2
20
38
  `${EntityType.HIVE}.${HiveVariant.TAINTED_MULLIGAN}`, // 22.3
21
- `${EntityType.BOOM_FLY}.${BoomFlyVariant.TAINTED_BOOM_FLY}`, // 22.6
39
+ `${EntityType.BOOM_FLY}.${BoomFlyVariant.TAINTED_BOOM_FLY}`, // 25.6
22
40
  `${EntityType.HOPPER}.${HopperVariant.TAINTED_HOPPER}`, // 29.3
23
41
  `${EntityType.SPITTY}`, // 31.1
24
- // 61.7
25
- // 102.2
26
- // 240.3
27
- // 244.2
28
- // 244.3
29
- // 274.0
30
- // 274.1
31
- // 274.2
32
- // 275.0
33
- // 275.1
34
- // 275.2
35
- // 406.0
36
- // 407.0
37
- // 412.0
38
- // 802.0
39
- // 802.1
40
- // 812.1
41
- // 827.1
42
- // 829.1
43
- // 831.0
44
- // 850.0
45
- // 850.1
46
- // 850.2
47
- // 855.0
48
- // 855.1
49
- // 888.0
42
+ `${EntityType.SUCKER}.${SuckerVariant.TAINTED_SUCKER}`, // 61.7
43
+ `${EntityType.ISAAC}.${IsaacVariant.BLUE_BABY_HUSH}`, // 102.2
44
+ `${EntityType.WALL_CREEP}.${WallCreepVariant.TAINTED_SOY_CREEP}`, // 240.3
45
+ `${EntityType.ROUND_WORM}.${RoundWormVariant.TAINTED_ROUND_WORM}`, // 244.2
46
+ `${EntityType.ROUND_WORM}.${RoundWormVariant.TAINTED_TUBE_WORM}`, // 244.3
47
+ `${EntityType.MEGA_SATAN}.${MegaSatanVariant.MEGA_SATAN}`, // 274.0
48
+ `${EntityType.MEGA_SATAN}.${MegaSatanVariant.MEGA_SATAN_RIGHT_HAND}`, // 274.1
49
+ `${EntityType.MEGA_SATAN}.${MegaSatanVariant.MEGA_SATAN_LEFT_HAND}`, // 274.2
50
+ `${EntityType.MEGA_SATAN_2}.${MegaSatanVariant.MEGA_SATAN}`, // 275.0
51
+ `${EntityType.MEGA_SATAN_2}.${MegaSatanVariant.MEGA_SATAN_RIGHT_HAND}`, // 275.1
52
+ `${EntityType.MEGA_SATAN_2}.${MegaSatanVariant.MEGA_SATAN_LEFT_HAND}`, // 275.2
53
+ `${EntityType.ULTRA_GREED}.${UltraGreedVariant.ULTRA_GREED}`, // 406.0
54
+ `${EntityType.ULTRA_GREED}.${UltraGreedVariant.ULTRA_GREEDIER}`, // 406.1
55
+ `${EntityType.HUSH}.0`, // 407.0
56
+ `${EntityType.DELIRIUM}.0`, // 412.0
57
+ `${EntityType.BLOOD_PUPPY}.${BloodPuppyVariant.SMALL}`, // 802.0
58
+ `${EntityType.BLOOD_PUPPY}.${BloodPuppyVariant.LARGE}`, // 802.1
59
+ `${EntityType.SUB_HORF}.${SubHorfVariant.TAINTED_SUB_HORF}`, // 812.1
60
+ `${EntityType.FACELESS}.${FacelessVariant.TAINTED_FACELESS}`, // 827.1
61
+ `${EntityType.MOLE}.${MoleVariant.TAINTED_MOLE}`, // 829.1
62
+ `${EntityType.GUTTED_FATTY}.${GuttyFattyVariant.GUTTED_FATTY}`, // 831.0
63
+ `${EntityType.GAPER_L2}.${Gaper2Variant.GAPER}`, // 850.0
64
+ `${EntityType.GAPER_L2}.${Gaper2Variant.HORF}`, // 850.1
65
+ `${EntityType.GAPER_L2}.${Gaper2Variant.GUSHER}`, // 850.2
66
+ `${EntityType.CHARGER_L2}.${Charger2Variant.CHARGER}`, // 855.0
67
+ `${EntityType.CHARGER_L2}.${Charger2Variant.ELLEECH}`, // 855.1
68
+ `${EntityType.SHADY}.0`, // 888.0
50
69
  `${EntityType.MOTHER}.${MotherVariant.MOTHER_1}`, // 912.0
51
70
  `${EntityType.MOTHER}.${MotherVariant.MOTHER_2}`, // 912.10
52
- `${EntityType.DOGMA}.${DogmaVariant.DOGMA_PHASE_1}`, // 950.0
71
+ `${EntityType.DOGMA}.${DogmaVariant.TV}`, // 950.1
72
+ `${EntityType.DOGMA}.${DogmaVariant.ANGEL_PHASE_2}`, // 950.2
53
73
  `${EntityType.BEAST}.${BeastVariant.BEAST}`, // 951.0
54
74
  `${EntityType.BEAST}.${BeastVariant.ULTRA_FAMINE}`, // 951.10
55
75
  `${EntityType.BEAST}.${BeastVariant.ULTRA_PESTILENCE}`, // 951.20