isaacscript-common 80.1.0 → 80.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/classes/callbacks/PostItemDischarge.d.ts.map +1 -1
  2. package/dist/classes/callbacks/PostItemDischarge.lua +1 -3
  3. package/dist/classes/features/other/CustomPickups.d.ts.map +1 -1
  4. package/dist/classes/features/other/CustomPickups.lua +1 -3
  5. package/dist/classes/features/other/CustomStages.d.ts.map +1 -1
  6. package/dist/classes/features/other/CustomStages.lua +1 -3
  7. package/dist/classes/features/other/DeployJSONRoom.d.ts.map +1 -1
  8. package/dist/classes/features/other/DeployJSONRoom.lua +4 -4
  9. package/dist/classes/features/other/ModdedElementDetection.d.ts +31 -20
  10. package/dist/classes/features/other/ModdedElementDetection.d.ts.map +1 -1
  11. package/dist/classes/features/other/ModdedElementDetection.lua +23 -49
  12. package/dist/classes/features/other/StageHistory.d.ts.map +1 -1
  13. package/dist/classes/features/other/StageHistory.lua +1 -3
  14. package/dist/classes/features/other/extraConsoleCommands/commands.d.ts.map +1 -1
  15. package/dist/classes/features/other/extraConsoleCommands/commands.lua +1 -6
  16. package/dist/core/constantsFirstLast.d.ts +29 -6
  17. package/dist/core/constantsFirstLast.d.ts.map +1 -1
  18. package/dist/core/constantsFirstLast.lua +18 -3
  19. package/dist/functions/bosses.d.ts.map +1 -1
  20. package/dist/functions/bosses.lua +1 -3
  21. package/dist/functions/doors.d.ts.map +1 -1
  22. package/dist/functions/doors.lua +5 -7
  23. package/dist/functions/gridEntities.lua +1 -2
  24. package/dist/functions/gridEntitiesSpecific.d.ts.map +1 -1
  25. package/dist/functions/gridEntitiesSpecific.lua +5 -7
  26. package/dist/functions/nextStage.d.ts.map +1 -1
  27. package/dist/functions/nextStage.lua +4 -6
  28. package/dist/functions/npcs.d.ts.map +1 -1
  29. package/dist/functions/npcs.lua +3 -5
  30. package/dist/functions/pills.d.ts.map +1 -1
  31. package/dist/functions/pills.lua +8 -16
  32. package/dist/functions/pocketItems.d.ts.map +1 -1
  33. package/dist/functions/pocketItems.lua +1 -3
  34. package/dist/functions/rooms.d.ts.map +1 -1
  35. package/dist/functions/rooms.lua +13 -15
  36. package/dist/functions/set.d.ts +37 -1
  37. package/dist/functions/set.d.ts.map +1 -1
  38. package/dist/functions/set.lua +56 -11
  39. package/dist/functions/stage.lua +2 -6
  40. package/dist/functions/trinkets.lua +2 -2
  41. package/dist/functions/types.d.ts +29 -0
  42. package/dist/functions/types.d.ts.map +1 -1
  43. package/dist/index.rollup.d.ts +97 -27
  44. package/dist/isaacscript-common.lua +152 -158
  45. package/package.json +2 -2
  46. package/src/classes/callbacks/PostItemDischarge.ts +1 -2
  47. package/src/classes/features/other/CustomPickups.ts +1 -2
  48. package/src/classes/features/other/CustomStages.ts +1 -4
  49. package/src/classes/features/other/DeployJSONRoom.ts +5 -9
  50. package/src/classes/features/other/ModdedElementDetection.ts +61 -77
  51. package/src/classes/features/other/StageHistory.ts +1 -2
  52. package/src/classes/features/other/extraConsoleCommands/commands.ts +2 -6
  53. package/src/core/constantsFirstLast.ts +29 -6
  54. package/src/functions/bosses.ts +1 -2
  55. package/src/functions/doors.ts +5 -6
  56. package/src/functions/gridEntities.ts +2 -2
  57. package/src/functions/gridEntitiesSpecific.ts +5 -6
  58. package/src/functions/nextStage.ts +4 -5
  59. package/src/functions/npcs.ts +3 -4
  60. package/src/functions/pills.ts +4 -6
  61. package/src/functions/pocketItems.ts +1 -2
  62. package/src/functions/rooms.ts +15 -17
  63. package/src/functions/set.ts +79 -11
  64. package/src/functions/stage.ts +3 -3
  65. package/src/functions/trinkets.ts +2 -2
  66. package/src/functions/types.ts +30 -0
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 80.0.0
3
+ isaacscript-common 80.2.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -20120,26 +20120,37 @@ local iRange = ____utils.iRange
20120
20120
  ____exports.FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
20121
20121
  --- Calculated from the `CollectibleType` enum.
20122
20122
  --
20123
- -- Note that this cannot be calculated from the length of the enum, because unlike all of the other
20124
- -- enums, collectible types are not contiguous.
20123
+ -- Note that this cannot be calculated from the length of the enum, because collectible types are
20124
+ -- not contiguous.
20125
20125
  ____exports.LAST_VANILLA_COLLECTIBLE_TYPE = getHighestEnumValue(nil, CollectibleType)
20126
20126
  --- Calculated from the `CollectibleType` enum. (`CollectibleType.NULL` is not included.)
20127
20127
  ____exports.NUM_VANILLA_COLLECTIBLE_TYPES = getEnumLength(nil, CollectibleType) - 1
20128
20128
  --- Equal to `TrinketType.SWALLOWED_PENNY`.
20129
20129
  ____exports.FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY
20130
20130
  --- Calculated from the `TrinketType` enum.
20131
+ --
20132
+ -- Note that this cannot be calculated from the length of the enum, because trinket types are not
20133
+ -- contiguous.
20131
20134
  ____exports.LAST_VANILLA_TRINKET_TYPE = getHighestEnumValue(nil, TrinketType)
20132
20135
  --- Calculated from the `TrinketType` enum. (`TrinketType.NULL` is not included.)
20133
20136
  ____exports.NUM_VANILLA_TRINKET_TYPES = getEnumLength(nil, TrinketType) - 1
20134
20137
  --- Equal to `Card.FOOL`.
20135
20138
  ____exports.FIRST_CARD_TYPE = CardType.FOOL
20136
- --- Calculated from the `Card` enum.
20139
+ --- Calculated from the `CardType` enum.
20140
+ --
20141
+ -- Note that this could be calculated from the length of the enum, because card types are
20142
+ -- contiguous. However, we instead get the highest enum value to be safer and to make the code more
20143
+ -- consistent with collectibles and trinkets.
20137
20144
  ____exports.LAST_VANILLA_CARD_TYPE = getHighestEnumValue(nil, CardType)
20138
20145
  --- Calculated from the `Card` enum. `Card.NULL` is not included.
20139
20146
  ____exports.NUM_VANILLA_CARD_TYPES = getEnumLength(nil, CardType) - 1
20140
20147
  --- Equal to `PillEffect.BAD_GAS`.
20141
20148
  ____exports.FIRST_PILL_EFFECT = PillEffect.BAD_GAS
20142
20149
  --- Calculated from the `PillEffect` enum.
20150
+ --
20151
+ -- Note that this could be calculated from the length of the enum, because pill effects are
20152
+ -- contiguous. However, we instead get the highest enum value to be safer and to make the code more
20153
+ -- consistent with collectibles and trinkets.
20143
20154
  ____exports.LAST_VANILLA_PILL_EFFECT = getHighestEnumValue(nil, PillEffect)
20144
20155
  --- Calculated from the `PillEffect` enum. (There is no `PillEffect.NULL` in the custom enum, so we
20145
20156
  -- do not have to subtract one here.)
@@ -20162,6 +20173,10 @@ ____exports.NUM_NORMAL_PILL_COLORS = #iRange(nil, ____exports.FIRST_PILL_COLOR,
20162
20173
  --- Equal to `PlayerType.ISAAC`.
20163
20174
  ____exports.FIRST_CHARACTER = PlayerType.ISAAC
20164
20175
  --- Calculated from the `PlayerType` enum.
20176
+ --
20177
+ -- Note that this could be calculated from the length of the enum, because characters are
20178
+ -- contiguous. However, we instead get the highest enum value to be safer and to make the code more
20179
+ -- consistent with collectibles and trinkets.
20165
20180
  ____exports.LAST_VANILLA_CHARACTER = getHighestEnumValue(nil, PlayerType)
20166
20181
  ____exports.FIRST_ROOM_TYPE = RoomType.DEFAULT
20167
20182
  ____exports.LAST_ROOM_TYPE = getHighestEnumValue(nil, RoomType)
@@ -23561,8 +23576,6 @@ local ____flag = require("functions.flag")
23561
23576
  local hasFlag = ____flag.hasFlag
23562
23577
  local ____tstlClass = require("functions.tstlClass")
23563
23578
  local isTSTLSet = ____tstlClass.isTSTLSet
23564
- local ____types = require("functions.types")
23565
- local asNumber = ____types.asNumber
23566
23579
  function ____exports.doorSlotToDirection(self, doorSlot)
23567
23580
  return DOOR_SLOT_TO_DIRECTION[doorSlot]
23568
23581
  end
@@ -23616,22 +23629,22 @@ end
23616
23629
  -- contains the hole to the Blue Womb. (In vanilla, the door will only appear in the It Lives Boss
23617
23630
  -- Room.)
23618
23631
  function ____exports.isBlueWombDoor(self, door)
23619
- return door.TargetRoomIndex == asNumber(nil, GridRoom.BLUE_WOMB)
23632
+ return door.TargetRoomIndex == GridRoom.BLUE_WOMB
23620
23633
  end
23621
23634
  --- Helper function to check if the provided door is the one that leads to the Boss Rush room. (In
23622
23635
  -- vanilla, the door will only appear in the Boss Room of the sixth floor.)
23623
23636
  function ____exports.isBossRushDoor(self, door)
23624
- return door.TargetRoomIndex == asNumber(nil, GridRoom.BOSS_RUSH)
23637
+ return door.TargetRoomIndex == GridRoom.BOSS_RUSH
23625
23638
  end
23626
23639
  --- Helper function to check if the provided door is the one that leads to the Mega Satan Boss Room.
23627
23640
  -- (In vanilla, the door will only appear in the starting room of The Chest / Dark Room.)
23628
23641
  function ____exports.isMegaSatanDoor(self, door)
23629
- return door.TargetRoomIndex == asNumber(nil, GridRoom.MEGA_SATAN)
23642
+ return door.TargetRoomIndex == GridRoom.MEGA_SATAN
23630
23643
  end
23631
23644
  --- Helper function to check if the provided door leads to the "secret exit" off-grid room that takes
23632
23645
  -- you to the Repentance floor.
23633
23646
  function ____exports.isRepentanceDoor(self, door)
23634
- return door.TargetRoomIndex == asNumber(nil, GridRoom.SECRET_EXIT)
23647
+ return door.TargetRoomIndex == GridRoom.SECRET_EXIT
23635
23648
  end
23636
23649
  --- This refers to the hole in the wall that appears after bombing the entrance to a secret room.
23637
23650
  -- Note that the door still exists before it has been bombed open. It has a sprite filename of
@@ -23647,7 +23660,7 @@ end
23647
23660
  --- Helper function to check if the provided door is the one that leads to the off-grid room that
23648
23661
  -- contains the portal to The Void. (In vanilla, the door will only appear in the Hush Boss Room.)
23649
23662
  function ____exports.isVoidDoor(self, door)
23650
- return door.TargetRoomIndex == asNumber(nil, GridRoom.VOID)
23663
+ return door.TargetRoomIndex == GridRoom.VOID
23651
23664
  end
23652
23665
  --- Helper function to remove a single door.
23653
23666
  function ____exports.removeDoor(self, door)
@@ -29301,8 +29314,6 @@ local ____playerDataStructures = require("functions.playerDataStructures")
29301
29314
  local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
29302
29315
  local mapGetPlayer = ____playerDataStructures.mapGetPlayer
29303
29316
  local mapSetPlayer = ____playerDataStructures.mapSetPlayer
29304
- local ____types = require("functions.types")
29305
- local asNumber = ____types.asNumber
29306
29317
  local ____DefaultMap = require("classes.DefaultMap")
29307
29318
  local DefaultMap = ____DefaultMap.DefaultMap
29308
29319
  local ____CustomCallback = require("classes.private.CustomCallback")
@@ -29333,7 +29344,7 @@ function PostItemDischarge.prototype.____constructor(self)
29333
29344
  return callbackCollectibleType == nil or callbackCollectibleType == collectibleType
29334
29345
  end
29335
29346
  self.preNPCCollisionSucker = function(____, npc, collider)
29336
- if npc.Variant == asNumber(nil, SuckerVariant.BULB) then
29347
+ if npc.Variant == SuckerVariant.BULB then
29337
29348
  return self:preNPCCollisionBulb(npc, collider)
29338
29349
  end
29339
29350
  return nil
@@ -32066,7 +32077,6 @@ local ____log = require("functions.log")
32066
32077
  local log = ____log.log
32067
32078
  local ____types = require("functions.types")
32068
32079
  local asLevelStage = ____types.asLevelStage
32069
- local asNumber = ____types.asNumber
32070
32080
  local ____utils = require("functions.utils")
32071
32081
  local inRange = ____utils.inRange
32072
32082
  --- Helper function to check if the provided stage type is equal to `StageType.REPENTANCE` or
@@ -32108,10 +32118,7 @@ function ____exports.calculateStageTypeRepentance(self, stage)
32108
32118
  return StageType.REPENTANCE
32109
32119
  end
32110
32120
  local seeds = game:GetSeeds()
32111
- local adjustedStage = asLevelStage(
32112
- nil,
32113
- asNumber(nil, stage) + 1
32114
- )
32121
+ local adjustedStage = asLevelStage(nil, stage + 1)
32115
32122
  local stageSeed = seeds:GetStageSeed(adjustedStage)
32116
32123
  local halfStageSeed = math.floor(stageSeed / 2)
32117
32124
  if halfStageSeed % 2 == 0 then
@@ -32126,7 +32133,7 @@ function ____exports.getEffectiveStage(self)
32126
32133
  local level = game:GetLevel()
32127
32134
  local stage = level:GetStage()
32128
32135
  if ____exports.onRepentanceStage(nil) then
32129
- return asNumber(nil, stage) + 1
32136
+ return stage + 1
32130
32137
  end
32131
32138
  return stage
32132
32139
  end
@@ -32503,8 +32510,6 @@ local ____roomTransition = require("functions.roomTransition")
32503
32510
  local reloadRoom = ____roomTransition.reloadRoom
32504
32511
  local ____stage = require("functions.stage")
32505
32512
  local getGotoCommand = ____stage.getGotoCommand
32506
- local ____types = require("functions.types")
32507
- local asNumber = ____types.asNumber
32508
32513
  local ____utils = require("functions.utils")
32509
32514
  local assertDefined = ____utils.assertDefined
32510
32515
  local iRange = ____utils.iRange
@@ -32584,7 +32589,7 @@ end
32584
32589
  -- Under the hood, this checks the room type being equal to `RoomType.ANGEL` (15) and the sub-type
32585
32590
  -- being equal to `AngelRoomSubType.SHOP` (1).
32586
32591
  function ____exports.isAngelShop(self, roomData)
32587
- return roomData.Type == RoomType.ANGEL and roomData.Subtype == asNumber(nil, AngelRoomSubType.SHOP)
32592
+ return roomData.Type == RoomType.ANGEL and roomData.Subtype == AngelRoomSubType.SHOP
32588
32593
  end
32589
32594
  --- Helper function to check to see if the provided room is the Boss Room for The Beast.
32590
32595
  --
@@ -32593,7 +32598,7 @@ end
32593
32598
  -- Under the hood, this checks the room type being equal to `RoomType.DUNGEON` (16) and the sub-type
32594
32599
  -- being equal to `DungeonSubType.BEAST_ROOM` (4).
32595
32600
  function ____exports.isBeastRoom(self, roomData)
32596
- return roomData.Type == RoomType.DUNGEON and roomData.Subtype == asNumber(nil, DungeonSubType.BEAST_ROOM)
32601
+ return roomData.Type == RoomType.DUNGEON and roomData.Subtype == DungeonSubType.BEAST_ROOM
32597
32602
  end
32598
32603
  --- Helper function to detect if the provided room is big. Specifically, this is all 1x2 rooms, 2x2
32599
32604
  -- rooms, and L rooms.
@@ -32603,13 +32608,13 @@ end
32603
32608
  --- Helper function to check if the provided room is the Boss Room for a particular boss. This will
32604
32609
  -- only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
32605
32610
  function ____exports.isBossRoomOf(self, roomData, bossID)
32606
- return roomData.Type == RoomType.BOSS and roomData.StageID == StageID.SPECIAL_ROOMS and roomData.Subtype == asNumber(nil, bossID)
32611
+ return roomData.Type == RoomType.BOSS and roomData.StageID == StageID.SPECIAL_ROOMS and roomData.Subtype == bossID
32607
32612
  end
32608
32613
  --- Helper function for determining whether the provided room is a crawl space. Use this function
32609
32614
  -- over comparing to `RoomType.DUNGEON` or `GridRoom.DUNGEON_IDX` since there is a special case of
32610
32615
  -- the player being in a boss fight that takes place in a dungeon.
32611
32616
  function ____exports.isCrawlSpace(self, roomData)
32612
- return roomData.Type == RoomType.DUNGEON and roomData.Subtype == asNumber(nil, DungeonSubType.NORMAL)
32617
+ return roomData.Type == RoomType.DUNGEON and roomData.Subtype == DungeonSubType.NORMAL
32613
32618
  end
32614
32619
  --- Helper function for checking whether the provided room is a crawl space with a door corresponding
32615
32620
  -- to `DoorSlotFlag.RIGHT_0` (1 << 2).
@@ -32618,7 +32623,7 @@ function ____exports.isCrawlSpaceWithBlackMarketEntrance(self, roomData)
32618
32623
  end
32619
32624
  --- Helper function to detect if the provided room is one of the rooms in the Death Certificate area.
32620
32625
  function ____exports.isDeathCertificateArea(self, roomData)
32621
- return roomData.StageID == StageID.HOME and (roomData.Subtype == asNumber(nil, HomeRoomSubType.DEATH_CERTIFICATE_ENTRANCE) or roomData.Subtype == asNumber(nil, HomeRoomSubType.DEATH_CERTIFICATE_ITEMS))
32626
+ return roomData.StageID == StageID.HOME and (roomData.Subtype == HomeRoomSubType.DEATH_CERTIFICATE_ENTRANCE or roomData.Subtype == HomeRoomSubType.DEATH_CERTIFICATE_ITEMS)
32622
32627
  end
32623
32628
  --- Helper function to detect if the provided room is a Treasure Room created when entering with a
32624
32629
  -- Devil's Crown trinket.
@@ -32639,7 +32644,7 @@ end
32639
32644
  -- Dogma Boss Room that exists in vanilla) and the sub-type being equal to
32640
32645
  -- `HomeRoomSubType.LIVING_ROOM` (3).
32641
32646
  function ____exports.isDogmaRoom(self, roomData)
32642
- return roomData.StageID == StageID.HOME and roomData.Type == RoomType.DEFAULT and roomData.Variant == 1000 and roomData.Subtype == asNumber(nil, HomeRoomSubType.LIVING_ROOM)
32647
+ return roomData.StageID == StageID.HOME and roomData.Type == RoomType.DEFAULT and roomData.Variant == 1000 and roomData.Subtype == HomeRoomSubType.LIVING_ROOM
32643
32648
  end
32644
32649
  --- Helper function to detect if the provided room is a Double Trouble Boss Room.
32645
32650
  --
@@ -32655,14 +32660,14 @@ function ____exports.isDoubleTrouble(self, roomData)
32655
32660
  end
32656
32661
  --- Helper function to determine if the index of the provided room is equal to `GridRoom.GENESIS`.
32657
32662
  function ____exports.isGenesisRoom(self, roomGridIndex)
32658
- return roomGridIndex == asNumber(nil, GridRoom.GENESIS)
32663
+ return roomGridIndex == GridRoom.GENESIS
32659
32664
  end
32660
32665
  --- Helper function to check if the provided room is either the left Home closet (behind the red
32661
32666
  -- door) or the right Home closet (with one random pickup).
32662
32667
  --
32663
32668
  -- Home closets have a unique shape that is different from any other room in the game.
32664
32669
  function ____exports.isHomeCloset(self, roomData)
32665
- return roomData.StageID == StageID.HOME and (roomData.Subtype == asNumber(nil, HomeRoomSubType.CLOSET_LEFT) or roomData.Subtype == asNumber(nil, HomeRoomSubType.CLOSET_RIGHT))
32670
+ return roomData.StageID == StageID.HOME and (roomData.Subtype == HomeRoomSubType.CLOSET_LEFT or roomData.Subtype == HomeRoomSubType.CLOSET_RIGHT)
32666
32671
  end
32667
32672
  --- Helper function to determine if the provided room is one of the four L room shapes.
32668
32673
  function ____exports.isLRoom(self, roomData)
@@ -32670,7 +32675,7 @@ function ____exports.isLRoom(self, roomData)
32670
32675
  end
32671
32676
  --- Helper function to determine if the index of the provided room is equal to `GridRoom.MEGA_SATAN`.
32672
32677
  function ____exports.isMegaSatanRoom(self, roomGridIndex)
32673
- return roomGridIndex == asNumber(nil, GridRoom.MEGA_SATAN)
32678
+ return roomGridIndex == GridRoom.MEGA_SATAN
32674
32679
  end
32675
32680
  --- Helper function to determine if the provided room is part of the Repentance "escape sequence" in
32676
32681
  -- the Mines/Ashpit.
@@ -32680,12 +32685,12 @@ end
32680
32685
  --- Helper function to check if the provided room is a miniboss room for a particular miniboss. This
32681
32686
  -- will only work for mini-bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
32682
32687
  function ____exports.isMinibossRoomOf(self, roomData, minibossID)
32683
- return roomData.Type == RoomType.MINI_BOSS and roomData.StageID == StageID.SPECIAL_ROOMS and roomData.Subtype == asNumber(nil, minibossID)
32688
+ return roomData.Type == RoomType.MINI_BOSS and roomData.StageID == StageID.SPECIAL_ROOMS and roomData.Subtype == minibossID
32684
32689
  end
32685
32690
  --- Helper function to check if the provided room is a "mirror room" in Downpour or Dross. (These
32686
32691
  -- rooms are marked with a specific sub-type.)
32687
32692
  function ____exports.isMirrorRoom(self, roomData)
32688
- return roomData.Type == RoomType.DEFAULT and (roomData.StageID == StageID.DOWNPOUR or roomData.StageID == StageID.DROSS) and roomData.Subtype == asNumber(nil, DownpourRoomSubType.MIRROR)
32693
+ return roomData.Type == RoomType.DEFAULT and (roomData.StageID == StageID.DOWNPOUR or roomData.StageID == StageID.DROSS) and roomData.Subtype == DownpourRoomSubType.MIRROR
32689
32694
  end
32690
32695
  --- Helper function to check if the provided room matches one of the given room shapes.
32691
32696
  --
@@ -32704,7 +32709,7 @@ end
32704
32709
  --- Helper function for checking if the provided room is a secret exit that leads to a Repentance
32705
32710
  -- floor.
32706
32711
  function ____exports.isSecretExit(self, roomGridIndex)
32707
- return roomGridIndex == asNumber(nil, GridRoom.SECRET_EXIT)
32712
+ return roomGridIndex == GridRoom.SECRET_EXIT
32708
32713
  end
32709
32714
  --- Helper function for checking if the provided room is a secret shop (from the Member Card
32710
32715
  -- collectible).
@@ -32713,7 +32718,7 @@ end
32713
32718
  -- words, they will have the same room type, room variant, and room sub-type of a normal shop. Thus,
32714
32719
  -- the only way to detect them is by using the grid index.
32715
32720
  function ____exports.isSecretShop(self, roomGridIndex)
32716
- return roomGridIndex == asNumber(nil, GridRoom.SECRET_SHOP)
32721
+ return roomGridIndex == GridRoom.SECRET_SHOP
32717
32722
  end
32718
32723
  local SECRET_ROOM_TYPES = __TS__New(ReadonlySet, {RoomType.SECRET, RoomType.SUPER_SECRET, RoomType.ULTRA_SECRET})
32719
32724
  --- Helper function for quickly switching to a new room without playing a particular animation. Use
@@ -33158,7 +33163,6 @@ local isCircleIntersectingRectangle = ____math.isCircleIntersectingRectangle
33158
33163
  local ____rooms = require("functions.rooms")
33159
33164
  local roomUpdateSafe = ____rooms.roomUpdateSafe
33160
33165
  local ____types = require("functions.types")
33161
- local asNumber = ____types.asNumber
33162
33166
  local isInteger = ____types.isInteger
33163
33167
  local ____utils = require("functions.utils")
33164
33168
  local assertDefined = ____utils.assertDefined
@@ -33516,7 +33520,7 @@ function ____exports.removeGridEntity(self, gridEntityOrGridIndex, updateRoom)
33516
33520
  roomUpdateSafe(nil)
33517
33521
  end
33518
33522
  if gridEntityType == GridEntityType.STATUE then
33519
- local effectVariant = variant == asNumber(nil, StatueVariant.DEVIL) and EffectVariant.DEVIL or EffectVariant.ANGEL
33523
+ local effectVariant = variant == StatueVariant.DEVIL and EffectVariant.DEVIL or EffectVariant.ANGEL
33520
33524
  local effects = getEffects(nil, effectVariant)
33521
33525
  local effectsOnTile = __TS__ArrayFilter(
33522
33526
  effects,
@@ -34508,8 +34512,6 @@ local getGridEntities = ____gridEntities.getGridEntities
34508
34512
  local getMatchingGridEntities = ____gridEntities.getMatchingGridEntities
34509
34513
  local removeGridEntities = ____gridEntities.removeGridEntities
34510
34514
  local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
34511
- local ____types = require("functions.types")
34512
- local asNumber = ____types.asNumber
34513
34515
  local ____utils = require("functions.utils")
34514
34516
  local assertDefined = ____utils.assertDefined
34515
34517
  --- Helper function to spawn a `GridEntityType.CRAWL_SPACE` (18) with a specific variant.
@@ -34599,7 +34601,7 @@ function ____exports.getCrawlSpaces(self, crawlSpaceVariant)
34599
34601
  if crawlSpaceVariant == nil then
34600
34602
  crawlSpaceVariant = -1
34601
34603
  end
34602
- if asNumber(nil, crawlSpaceVariant) == -1 then
34604
+ if crawlSpaceVariant == -1 then
34603
34605
  return getGridEntities(nil, GridEntityType.CRAWL_SPACE)
34604
34606
  end
34605
34607
  return getMatchingGridEntities(nil, GridEntityType.CRAWL_SPACE, crawlSpaceVariant)
@@ -34617,7 +34619,7 @@ function ____exports.getPits(self, pitVariant)
34617
34619
  local pit = gridEntity:ToPit()
34618
34620
  if pit ~= nil then
34619
34621
  local thisPitVariant = pit:GetVariant()
34620
- if asNumber(nil, pitVariant) == -1 or pitVariant == thisPitVariant then
34622
+ if pitVariant == -1 or pitVariant == thisPitVariant then
34621
34623
  pits[#pits + 1] = pit
34622
34624
  end
34623
34625
  end
@@ -34637,7 +34639,7 @@ function ____exports.getPoops(self, poopVariant)
34637
34639
  local poop = gridEntity:ToPoop()
34638
34640
  if poop ~= nil then
34639
34641
  local thisPoopVariant = poop:GetVariant()
34640
- if asNumber(nil, poopVariant) == -1 or poopVariant == thisPoopVariant then
34642
+ if poopVariant == -1 or poopVariant == thisPoopVariant then
34641
34643
  poops[#poops + 1] = poop
34642
34644
  end
34643
34645
  end
@@ -34657,7 +34659,7 @@ function ____exports.getPressurePlates(self, pressurePlateVariant)
34657
34659
  local pressurePlate = gridEntity:ToPressurePlate()
34658
34660
  if pressurePlate ~= nil then
34659
34661
  local thisPressurePlateVariant = pressurePlate:GetVariant()
34660
- if asNumber(nil, pressurePlateVariant) == -1 or pressurePlateVariant == thisPressurePlateVariant then
34662
+ if pressurePlateVariant == -1 or pressurePlateVariant == thisPressurePlateVariant then
34661
34663
  pressurePlates[#pressurePlates + 1] = pressurePlate
34662
34664
  end
34663
34665
  end
@@ -34743,7 +34745,7 @@ function ____exports.getTrapdoors(self, trapdoorVariant)
34743
34745
  if trapdoorVariant == nil then
34744
34746
  trapdoorVariant = -1
34745
34747
  end
34746
- if asNumber(nil, trapdoorVariant) == -1 then
34748
+ if trapdoorVariant == -1 then
34747
34749
  return getGridEntities(nil, GridEntityType.TRAPDOOR)
34748
34750
  end
34749
34751
  return getMatchingGridEntities(nil, GridEntityType.TRAPDOOR, trapdoorVariant)
@@ -36575,7 +36577,7 @@ local TRINKET_SPRITE_LAYER = 0
36575
36577
  -- For example, passing `TrinketType.SWALLOWED_PENNY` would result in 32769, which is the value that
36576
36578
  -- corresponds to the golden trinket sub-type for Swallowed Penny.
36577
36579
  function ____exports.getGoldenTrinketType(self, trinketType)
36578
- return ____exports.isGoldenTrinketType(nil, trinketType) and trinketType or asNumber(nil, trinketType) + GOLDEN_TRINKET_ADJUSTMENT
36580
+ return ____exports.isGoldenTrinketType(nil, trinketType) and trinketType or trinketType + GOLDEN_TRINKET_ADJUSTMENT
36579
36581
  end
36580
36582
  --- Helper function to get the current effect that the Mysterious Paper trinket is providing to the
36581
36583
  -- player. Returns undefined if the player does not have the Mysterious Paper trinket.
@@ -36609,7 +36611,7 @@ end
36609
36611
  -- If the provided trinket type is already a normal trinket type, then the trinket type will be
36610
36612
  -- returned unmodified.
36611
36613
  function ____exports.getNormalTrinketType(self, trinketType)
36612
- return ____exports.isGoldenTrinketType(nil, trinketType) and asNumber(nil, trinketType) - GOLDEN_TRINKET_ADJUSTMENT or trinketType
36614
+ return ____exports.isGoldenTrinketType(nil, trinketType) and trinketType - GOLDEN_TRINKET_ADJUSTMENT or trinketType
36613
36615
  end
36614
36616
  --- Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
36615
36617
  -- trinket type was not valid.
@@ -38555,6 +38557,7 @@ return ____exports
38555
38557
  local ____lualib = require("lualib_bundle")
38556
38558
  local __TS__ArraySlice = ____lualib.__TS__ArraySlice
38557
38559
  local ____exports = {}
38560
+ local HORSE_PILL_ADJUSTMENT
38558
38561
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.index")
38559
38562
  local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
38560
38563
  local ____cachedEnumValues = require("arrays.cachedEnumValues")
@@ -38588,15 +38591,14 @@ local asNumber = ____types.asNumber
38588
38591
  local asPillColor = ____types.asPillColor
38589
38592
  local ____utils = require("functions.utils")
38590
38593
  local iRange = ____utils.iRange
38594
+ --- Helper function to see if the given pill color is a horse pill.
38595
+ function ____exports.isHorsePill(self, pillColor)
38596
+ return asNumber(nil, pillColor) > HORSE_PILL_ADJUSTMENT
38597
+ end
38591
38598
  function ____exports.isVanillaPillEffect(self, pillEffect)
38592
38599
  return pillEffect <= LAST_VANILLA_PILL_EFFECT
38593
38600
  end
38594
- --- Add this to a `PillColor` to get the corresponding giant pill color.
38595
- --
38596
- -- Corresponds to the vanilla `PillColor.GIANT_FLAG` value.
38597
- --
38598
- -- 1 << 11
38599
- local HORSE_PILL_ADJUSTMENT = 2048
38601
+ HORSE_PILL_ADJUSTMENT = 2048
38600
38602
  --- Helper function to get an array with every non-null pill color. This includes all gold colors and
38601
38603
  -- all horse colors.
38602
38604
  function ____exports.getAllPillColors(self)
@@ -38613,7 +38615,7 @@ end
38613
38615
  -- For example, passing `PillColor.BLUE_BLUE` would result in 2049, which is the value that
38614
38616
  -- corresponds to the horse pill color for blue/blue.
38615
38617
  function ____exports.getHorsePillColor(self, pillColor)
38616
- return asNumber(nil, pillColor) + HORSE_PILL_ADJUSTMENT
38618
+ return pillColor + HORSE_PILL_ADJUSTMENT
38617
38619
  end
38618
38620
  --- Helper function to get an array with every non-gold horse pill color.
38619
38621
  function ____exports.getHorsePillColors(self)
@@ -38625,11 +38627,7 @@ end
38625
38627
  --
38626
38628
  -- If called with a non-horse pill color, this function will return back the same color.
38627
38629
  function ____exports.getNormalPillColorFromHorse(self, pillColor)
38628
- local normalPillColor = asPillColor(
38629
- nil,
38630
- asNumber(nil, pillColor) - HORSE_PILL_ADJUSTMENT
38631
- )
38632
- return normalPillColor > PillColor.NULL and normalPillColor or pillColor
38630
+ return ____exports.isHorsePill(nil, pillColor) and asPillColor(nil, pillColor - HORSE_PILL_ADJUSTMENT) or pillColor
38633
38631
  end
38634
38632
  --- Helper function to get an array with every non-gold and non-horse pill color.
38635
38633
  function ____exports.getNormalPillColors(self)
@@ -38710,10 +38708,6 @@ end
38710
38708
  function ____exports.isGoldPill(self, pillColor)
38711
38709
  return pillColor == PillColor.GOLD or pillColor == PillColor.HORSE_GOLD
38712
38710
  end
38713
- --- Helper function to see if the given pill color is a horse pill.
38714
- function ____exports.isHorsePill(self, pillColor)
38715
- return asNumber(nil, pillColor) > HORSE_PILL_ADJUSTMENT
38716
- end
38717
38711
  function ____exports.isModdedPillEffect(self, pillEffect)
38718
38712
  return not ____exports.isVanillaPillEffect(nil, pillEffect)
38719
38713
  end
@@ -38741,8 +38735,6 @@ local ____PocketItemType = require("enums.PocketItemType")
38741
38735
  local PocketItemType = ____PocketItemType.PocketItemType
38742
38736
  local ____players = require("functions.players")
38743
38737
  local isCharacter = ____players.isCharacter
38744
- local ____types = require("functions.types")
38745
- local asNumber = ____types.asNumber
38746
38738
  --- Use this helper function as a workaround for the `EntityPlayer.GetPocketItem` method not working
38747
38739
  -- correctly.
38748
38740
  --
@@ -38778,7 +38770,7 @@ function ____exports.getPocketItems(self, player)
38778
38770
  else
38779
38771
  pocketItems[#pocketItems + 1] = {slot = slot, type = PocketItemType.EMPTY, subType = 0}
38780
38772
  end
38781
- if asNumber(nil, slot) + 1 == maxPocketItems then
38773
+ if slot + 1 == maxPocketItems then
38782
38774
  break
38783
38775
  end
38784
38776
  end
@@ -44248,6 +44240,8 @@ local __TS__New = ____lualib.__TS__New
44248
44240
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
44249
44241
  local __TS__Spread = ____lualib.__TS__Spread
44250
44242
  local __TS__ArraySort = ____lualib.__TS__ArraySort
44243
+ local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
44244
+ local __TS__ObjectValues = ____lualib.__TS__ObjectValues
44251
44245
  local __TS__ArraySome = ____lualib.__TS__ArraySome
44252
44246
  local ____exports = {}
44253
44247
  local ____ReadonlySet = require("types.ReadonlySet")
@@ -44260,20 +44254,45 @@ local ____types = require("functions.types")
44260
44254
  local isPrimitive = ____types.isPrimitive
44261
44255
  --- Helper function to get a sorted array based on the contents of a set.
44262
44256
  --
44263
- -- Normally, set values are returned in a random order, so use this function when the ordering of
44257
+ -- Normally, set values are returned in insertion order, so use this function when the ordering of
44264
44258
  -- the contents is important.
44265
44259
  function ____exports.getSortedSetValues(self, set)
44266
- local values = set:values()
44267
- local array = {__TS__Spread(values)}
44268
- local firstElement = array[1]
44260
+ local values = {__TS__Spread(set)}
44261
+ local firstElement = values[1]
44269
44262
  if firstElement ~= nil then
44270
44263
  local arrayType = type(firstElement)
44271
44264
  if not isPrimitive(nil, arrayType) then
44272
44265
  error(("Failed to get the sorted set values because the provided set was of type \"" .. tostring(arrayType)) .. "\". Having sets with non-primitive types doesn't make much sense in general, so you might need to rethink what you are doing.")
44273
44266
  end
44274
44267
  end
44275
- __TS__ArraySort(array)
44276
- return array
44268
+ __TS__ArraySort(values)
44269
+ return values
44270
+ end
44271
+ --- Helper function to convert the keys of an object to a set.
44272
+ --
44273
+ -- Note that the set values will be inserted in a random order, due to how `pairs` works under the
44274
+ -- hood.
44275
+ --
44276
+ -- Also see the `objectKeysToReadonlySet` function.
44277
+ function ____exports.objectKeysToSet(self, object)
44278
+ local set = __TS__New(Set)
44279
+ for ____, key in ipairs(__TS__ObjectKeys(object)) do
44280
+ set:add(key)
44281
+ end
44282
+ return set
44283
+ end
44284
+ --- Helper function to convert the values of an object to a set.
44285
+ --
44286
+ -- Note that the set values will be inserted in a random order, due to how `pairs` works under the
44287
+ -- hood.
44288
+ --
44289
+ -- Also see the `objectValuesToReadonlySet` function.
44290
+ function ____exports.objectValuesToSet(self, object)
44291
+ local set = __TS__New(Set)
44292
+ for ____, key in ipairs(__TS__ObjectValues(object)) do
44293
+ set:add(key)
44294
+ end
44295
+ return set
44277
44296
  end
44278
44297
  --- Helper function to add all of the values in one set to another set. The first set passed will be
44279
44298
  -- modified in place.
@@ -44282,7 +44301,7 @@ end
44282
44301
  function ____exports.addSetsToSet(self, mainSet, ...)
44283
44302
  local setsToAdd = {...}
44284
44303
  for ____, set in ipairs(setsToAdd) do
44285
- for ____, value in __TS__Iterator(set:values()) do
44304
+ for ____, value in __TS__Iterator(set) do
44286
44305
  mainSet:add(value)
44287
44306
  end
44288
44307
  end
@@ -44294,7 +44313,7 @@ function ____exports.combineSets(self, ...)
44294
44313
  local sets = {...}
44295
44314
  local newSet = __TS__New(Set)
44296
44315
  for ____, set in ipairs(sets) do
44297
- for ____, value in __TS__Iterator(set:values()) do
44316
+ for ____, value in __TS__Iterator(set) do
44298
44317
  newSet:add(value)
44299
44318
  end
44300
44319
  end
@@ -44303,7 +44322,7 @@ end
44303
44322
  --- Helper function to copy a set. (You can also use a Set constructor to accomplish this task.)
44304
44323
  function ____exports.copySet(self, oldSet)
44305
44324
  local newSet = __TS__New(Set)
44306
- for ____, value in __TS__Iterator(oldSet:values()) do
44325
+ for ____, value in __TS__Iterator(oldSet) do
44307
44326
  newSet:add(value)
44308
44327
  end
44309
44328
  return newSet
@@ -44315,7 +44334,7 @@ end
44315
44334
  function ____exports.deleteSetsFromSet(self, mainSet, ...)
44316
44335
  local setsToRemove = {...}
44317
44336
  for ____, set in ipairs(setsToRemove) do
44318
- for ____, value in __TS__Iterator(set:values()) do
44337
+ for ____, value in __TS__Iterator(set) do
44319
44338
  mainSet:delete(value)
44320
44339
  end
44321
44340
  end
@@ -44362,6 +44381,24 @@ function ____exports.getSetCombinations(self, set, includeEmptyArray)
44362
44381
  function(____, array) return __TS__New(ReadonlySet, array) end
44363
44382
  )
44364
44383
  end
44384
+ --- Helper function to convert the keys of an object to a read-only set.
44385
+ --
44386
+ -- Note that the set values will be inserted in a random order, due to how `pairs` works under the
44387
+ -- hood.
44388
+ --
44389
+ -- Also see the `objectKeysToSet` function.
44390
+ function ____exports.objectKeysToReadonlySet(self, object)
44391
+ return ____exports.objectKeysToSet(nil, object)
44392
+ end
44393
+ --- Helper function to convert the values of an object to a read-only set.
44394
+ --
44395
+ -- Note that the set values will be inserted in a random order, due to how `pairs` works under the
44396
+ -- hood.
44397
+ --
44398
+ -- Also see the `objectValuesToSet` function.
44399
+ function ____exports.objectValuesToReadonlySet(self, object)
44400
+ return ____exports.objectValuesToSet(nil, object)
44401
+ end
44365
44402
  --- Helper function to add one or more elements to a set at once without having to repeatedly call
44366
44403
  -- the `Set.add` method.
44367
44404
  --
@@ -44386,7 +44423,7 @@ function ____exports.setHas(self, set, ...)
44386
44423
  end
44387
44424
  --- Helper function to sum every value in a set together.
44388
44425
  function ____exports.sumSet(self, set)
44389
- local values = {__TS__Spread(set:values())}
44426
+ local values = {__TS__Spread(set)}
44390
44427
  return sumArray(nil, values)
44391
44428
  end
44392
44429
  return ____exports
@@ -44412,14 +44449,12 @@ local NUM_VANILLA_PILL_EFFECTS = ____constantsFirstLast.NUM_VANILLA_PILL_EFFECTS
44412
44449
  local NUM_VANILLA_TRINKET_TYPES = ____constantsFirstLast.NUM_VANILLA_TRINKET_TYPES
44413
44450
  local ____decorators = require("decorators")
44414
44451
  local Exported = ____decorators.Exported
44415
- local ____types = require("functions.types")
44416
- local asCardType = ____types.asCardType
44417
- local asCollectibleType = ____types.asCollectibleType
44418
- local asNumber = ____types.asNumber
44419
- local asPillEffect = ____types.asPillEffect
44420
- local asTrinketType = ____types.asTrinketType
44421
44452
  local ____Feature = require("classes.private.Feature")
44422
44453
  local Feature = ____Feature.Feature
44454
+ ____exports.FIRST_MODDED_COLLECTIBLE_TYPE = LAST_VANILLA_COLLECTIBLE_TYPE + 1
44455
+ ____exports.FIRST_MODDED_TRINKET_TYPE = LAST_VANILLA_TRINKET_TYPE + 1
44456
+ ____exports.FIRST_MODDED_CARD_TYPE = LAST_VANILLA_CARD_TYPE + 1
44457
+ ____exports.FIRST_MODDED_PILL_EFFECT = LAST_VANILLA_PILL_EFFECT + 1
44423
44458
  --- Mods can add extra things to the game (e.g. collectibles, trinkets, and so on). Since mods load
44424
44459
  -- in alphabetical order, the total number of things can't be properly be known until at least one
44425
44460
  -- callback fires (which indicates that all mods have been loaded).
@@ -44447,16 +44482,12 @@ function ModdedElementDetection.prototype.errorIfNoCallbacksFired(self, constant
44447
44482
  end
44448
44483
  function ModdedElementDetection.prototype.getFirstModdedCollectibleType(self)
44449
44484
  self:errorIfNoCallbacksFired("collectible")
44450
- local firstModdedCollectibleType = asCollectibleType(
44451
- nil,
44452
- asNumber(nil, LAST_VANILLA_COLLECTIBLE_TYPE) + 1
44453
- )
44454
- local itemConfigItem = itemConfig:GetCollectible(firstModdedCollectibleType)
44485
+ local itemConfigItem = itemConfig:GetCollectible(____exports.FIRST_MODDED_COLLECTIBLE_TYPE)
44455
44486
  local ____temp_0
44456
44487
  if itemConfigItem == nil then
44457
44488
  ____temp_0 = nil
44458
44489
  else
44459
- ____temp_0 = firstModdedCollectibleType
44490
+ ____temp_0 = ____exports.FIRST_MODDED_COLLECTIBLE_TYPE
44460
44491
  end
44461
44492
  return ____temp_0
44462
44493
  end
@@ -44468,28 +44499,22 @@ end
44468
44499
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getLastCollectibleType", true)
44469
44500
  function ModdedElementDetection.prototype.getNumCollectibleTypes(self)
44470
44501
  self:errorIfNoCallbacksFired("collectible")
44471
- local numModdedCollectibleTypes = self:getNumModdedCollectibleTypes()
44472
- return NUM_VANILLA_COLLECTIBLE_TYPES + numModdedCollectibleTypes
44502
+ return NUM_VANILLA_COLLECTIBLE_TYPES + self:getNumModdedCollectibleTypes()
44473
44503
  end
44474
44504
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumCollectibleTypes", true)
44475
44505
  function ModdedElementDetection.prototype.getNumModdedCollectibleTypes(self)
44476
44506
  self:errorIfNoCallbacksFired("collectible")
44477
- local lastCollectibleType = self:getLastCollectibleType()
44478
- return lastCollectibleType - LAST_VANILLA_COLLECTIBLE_TYPE
44507
+ return self:getLastCollectibleType() - LAST_VANILLA_COLLECTIBLE_TYPE
44479
44508
  end
44480
44509
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedCollectibleTypes", true)
44481
44510
  function ModdedElementDetection.prototype.getFirstModdedTrinketType(self)
44482
44511
  self:errorIfNoCallbacksFired("trinket")
44483
- local firstModdedTrinketType = asTrinketType(
44484
- nil,
44485
- asNumber(nil, LAST_VANILLA_TRINKET_TYPE) + 1
44486
- )
44487
- local itemConfigItem = itemConfig:GetTrinket(firstModdedTrinketType)
44512
+ local itemConfigItem = itemConfig:GetTrinket(____exports.FIRST_MODDED_TRINKET_TYPE)
44488
44513
  local ____temp_1
44489
44514
  if itemConfigItem == nil then
44490
44515
  ____temp_1 = nil
44491
44516
  else
44492
- ____temp_1 = firstModdedTrinketType
44517
+ ____temp_1 = ____exports.FIRST_MODDED_TRINKET_TYPE
44493
44518
  end
44494
44519
  return ____temp_1
44495
44520
  end
@@ -44501,80 +44526,66 @@ end
44501
44526
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getLastTrinketType", true)
44502
44527
  function ModdedElementDetection.prototype.getNumTrinketTypes(self)
44503
44528
  self:errorIfNoCallbacksFired("trinket")
44504
- local numModdedTrinketTypes = self:getNumModdedTrinketTypes()
44505
- return NUM_VANILLA_TRINKET_TYPES + numModdedTrinketTypes
44529
+ return NUM_VANILLA_TRINKET_TYPES + self:getNumModdedTrinketTypes()
44506
44530
  end
44507
44531
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumTrinketTypes", true)
44508
44532
  function ModdedElementDetection.prototype.getNumModdedTrinketTypes(self)
44509
44533
  self:errorIfNoCallbacksFired("trinket")
44510
- local lastTrinketType = self:getLastTrinketType()
44511
- return lastTrinketType - LAST_VANILLA_TRINKET_TYPE
44534
+ return self:getLastTrinketType() - LAST_VANILLA_TRINKET_TYPE
44512
44535
  end
44513
44536
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedTrinketTypes", true)
44514
44537
  function ModdedElementDetection.prototype.getFirstModdedCardType(self)
44515
44538
  self:errorIfNoCallbacksFired("card")
44516
- local firstModdedCardType = asCardType(
44517
- nil,
44518
- asNumber(nil, LAST_VANILLA_CARD_TYPE) + 1
44519
- )
44520
- local itemConfigCard = itemConfig:GetCard(firstModdedCardType)
44539
+ local itemConfigCard = itemConfig:GetCard(____exports.FIRST_MODDED_CARD_TYPE)
44521
44540
  local ____temp_2
44522
44541
  if itemConfigCard == nil then
44523
44542
  ____temp_2 = nil
44524
44543
  else
44525
- ____temp_2 = firstModdedCardType
44544
+ ____temp_2 = ____exports.FIRST_MODDED_CARD_TYPE
44526
44545
  end
44527
44546
  return ____temp_2
44528
44547
  end
44529
44548
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getFirstModdedCardType", true)
44530
44549
  function ModdedElementDetection.prototype.getLastCardType(self)
44531
44550
  self:errorIfNoCallbacksFired("card")
44532
- local numCards = self:getNumCardTypes()
44533
- return asCardType(nil, numCards)
44551
+ return itemConfig:GetCards().Size - 1
44534
44552
  end
44535
44553
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getLastCardType", true)
44536
44554
  function ModdedElementDetection.prototype.getNumCardTypes(self)
44537
44555
  self:errorIfNoCallbacksFired("card")
44538
- return itemConfig:GetCards().Size - 1
44556
+ return NUM_VANILLA_CARD_TYPES + self:getNumModdedCardTypes()
44539
44557
  end
44540
44558
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumCardTypes", true)
44541
44559
  function ModdedElementDetection.prototype.getNumModdedCardTypes(self)
44542
44560
  self:errorIfNoCallbacksFired("card")
44543
- local numCardTypes = self:getNumCardTypes()
44544
- return numCardTypes - NUM_VANILLA_CARD_TYPES
44561
+ return self:getLastCardType() - LAST_VANILLA_CARD_TYPE
44545
44562
  end
44546
44563
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedCardTypes", true)
44547
44564
  function ModdedElementDetection.prototype.getFirstModdedPillEffect(self)
44548
44565
  self:errorIfNoCallbacksFired("pill")
44549
- local firstModdedPillEffect = asPillEffect(
44550
- nil,
44551
- asNumber(nil, LAST_VANILLA_PILL_EFFECT) + 1
44552
- )
44553
- local itemConfigPillEffect = itemConfig:GetPillEffect(firstModdedPillEffect)
44566
+ local itemConfigPillEffect = itemConfig:GetPillEffect(____exports.FIRST_MODDED_PILL_EFFECT)
44554
44567
  local ____temp_3
44555
44568
  if itemConfigPillEffect == nil then
44556
44569
  ____temp_3 = nil
44557
44570
  else
44558
- ____temp_3 = firstModdedPillEffect
44571
+ ____temp_3 = ____exports.FIRST_MODDED_PILL_EFFECT
44559
44572
  end
44560
44573
  return ____temp_3
44561
44574
  end
44562
44575
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getFirstModdedPillEffect", true)
44563
44576
  function ModdedElementDetection.prototype.getLastPillEffect(self)
44564
44577
  self:errorIfNoCallbacksFired("pill")
44565
- local numPillEffects = self:getNumPillEffects() - 1
44566
- return asPillEffect(nil, numPillEffects)
44578
+ return itemConfig:GetPillEffects().Size - 1
44567
44579
  end
44568
44580
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getLastPillEffect", true)
44569
44581
  function ModdedElementDetection.prototype.getNumPillEffects(self)
44570
44582
  self:errorIfNoCallbacksFired("pill")
44571
- return itemConfig:GetPillEffects().Size
44583
+ return NUM_VANILLA_PILL_EFFECTS + self:getNumModdedPillEffects()
44572
44584
  end
44573
44585
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumPillEffects", true)
44574
44586
  function ModdedElementDetection.prototype.getNumModdedPillEffects(self)
44575
- self:errorIfNoCallbacksFired("pill")
44576
- local numPillEffects = self:getNumPillEffects()
44577
- return numPillEffects - NUM_VANILLA_PILL_EFFECTS
44587
+ self:errorIfNoCallbacksFired("card")
44588
+ return self:getLastPillEffect() - LAST_VANILLA_PILL_EFFECT
44578
44589
  end
44579
44590
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedPillEffects", true)
44580
44591
  return ____exports
@@ -47137,8 +47148,6 @@ local getEntityID = ____entities.getEntityID
47137
47148
  local getEntityIDFromConstituents = ____entities.getEntityIDFromConstituents
47138
47149
  local ____entitiesSpecific = require("functions.entitiesSpecific")
47139
47150
  local spawnEffect = ____entitiesSpecific.spawnEffect
47140
- local ____types = require("functions.types")
47141
- local asNumber = ____types.asNumber
47142
47151
  local ____Feature = require("classes.private.Feature")
47143
47152
  local Feature = ____Feature.Feature
47144
47153
  --- Normally, we would make a custom entity to represent a fading-away pickup, but we don't want to
@@ -47181,7 +47190,7 @@ function CustomPickups.prototype.____constructor(self)
47181
47190
  return nil
47182
47191
  end
47183
47192
  self.postEffectRenderPickupEffect = function(____, effect)
47184
- if effect.SubType ~= asNumber(nil, PICKUP_EFFECT_SUB_TYPE) then
47193
+ if effect.SubType ~= PICKUP_EFFECT_SUB_TYPE then
47185
47194
  return
47186
47195
  end
47187
47196
  local sprite = effect:GetSprite()
@@ -48288,8 +48297,6 @@ local ____stage = require("functions.stage")
48288
48297
  local calculateStageType = ____stage.calculateStageType
48289
48298
  local calculateStageTypeRepentance = ____stage.calculateStageTypeRepentance
48290
48299
  local onRepentanceStage = ____stage.onRepentanceStage
48291
- local ____types = require("functions.types")
48292
- local asNumber = ____types.asNumber
48293
48300
  --- Helper function to get the stage that a trapdoor or heaven door would take the player to, based
48294
48301
  -- on the current stage, room, and game state flags.
48295
48302
  --
@@ -48304,7 +48311,7 @@ function ____exports.getNextStage(self)
48304
48311
  local repentanceStage = onRepentanceStage(nil)
48305
48312
  local roomGridIndex = getRoomGridIndex(nil)
48306
48313
  if backwardsPath then
48307
- local nextStage = asNumber(nil, stage) - 1
48314
+ local nextStage = stage - 1
48308
48315
  return nextStage == 0 and LevelStage.HOME or nextStage
48309
48316
  end
48310
48317
  repeat
@@ -48325,7 +48332,7 @@ function ____exports.getNextStage(self)
48325
48332
  if ____cond4 then
48326
48333
  do
48327
48334
  if repentanceStage then
48328
- return asNumber(nil, stage) + 1
48335
+ return stage + 1
48329
48336
  end
48330
48337
  if stage == LevelStage.DEPTHS_2 or stage == LevelStage.DEPTHS_1 and hasCurse(nil, LevelCurse.LABYRINTH) then
48331
48338
  return LevelStage.DEPTHS_2
@@ -48355,7 +48362,7 @@ function ____exports.getNextStage(self)
48355
48362
  if stage == LevelStage.VOID then
48356
48363
  return LevelStage.VOID
48357
48364
  end
48358
- return asNumber(nil, stage) + 1
48365
+ return stage + 1
48359
48366
  end
48360
48367
  --- Helper function to get the stage type that a trapdoor or heaven door would take the player to,
48361
48368
  -- based on the current stage, room, and game state flags.
@@ -48381,7 +48388,7 @@ function ____exports.getNextStageType(self, upwards)
48381
48388
  if backwardsPath then
48382
48389
  return calculateStageType(nil, nextStage)
48383
48390
  end
48384
- if roomGridIndex == asNumber(nil, GridRoom.SECRET_EXIT) then
48391
+ if roomGridIndex == GridRoom.SECRET_EXIT then
48385
48392
  return calculateStageTypeRepentance(nil, nextStage)
48386
48393
  end
48387
48394
  if repentanceStage and (stage == LevelStage.BASEMENT_1 or stage == LevelStage.CAVES_1 or stage == LevelStage.DEPTHS_1 or stage == LevelStage.WOMB_1) then
@@ -48442,8 +48449,6 @@ local getNextStageType = ____nextStage.getNextStageType
48442
48449
  local ____stage = require("functions.stage")
48443
48450
  local calculateStageType = ____stage.calculateStageType
48444
48451
  local onRepentanceStage = ____stage.onRepentanceStage
48445
- local ____types = require("functions.types")
48446
- local asNumber = ____types.asNumber
48447
48452
  local ____Feature = require("classes.private.Feature")
48448
48453
  local Feature = ____Feature.Feature
48449
48454
  local v = {run = {stageHistory = {}}}
@@ -48590,7 +48595,7 @@ function StageHistory.prototype.getNextStageWithHistory(self)
48590
48595
  end
48591
48596
  return LevelStage.DEPTHS_1
48592
48597
  end
48593
- return asNumber(nil, stage) - 1
48598
+ return stage - 1
48594
48599
  end
48595
48600
  __TS__DecorateLegacy({Exported}, StageHistory.prototype, "getNextStageWithHistory", true)
48596
48601
  function StageHistory.prototype.getStageHistory(self)
@@ -51092,8 +51097,6 @@ local ____ReadonlySet = require("types.ReadonlySet")
51092
51097
  local ReadonlySet = ____ReadonlySet.ReadonlySet
51093
51098
  local ____entitiesSpecific = require("functions.entitiesSpecific")
51094
51099
  local getNPCs = ____entitiesSpecific.getNPCs
51095
- local ____types = require("functions.types")
51096
- local asNumber = ____types.asNumber
51097
51100
  --- Checks for specific NPCs that have "CanShutDoors" set to true naturally by the game, but should
51098
51101
  -- not actually keep the doors closed (like Death's scythes).
51099
51102
  function ____exports.isAliveExceptionNPC(self, npc)
@@ -51132,20 +51135,20 @@ end
51132
51135
  -- `NPCState.SPECIAL`, spit out their head, and then slowly fade away while shooting a burst of
51133
51136
  -- tears.
51134
51137
  function ____exports.isDyingDump(self, npc)
51135
- return npc.Type == EntityType.DUMP and npc.Variant == asNumber(nil, DumpVariant.DUMP) and npc.State == NPCState.SPECIAL
51138
+ return npc.Type == EntityType.DUMP and npc.Variant == DumpVariant.DUMP and npc.State == NPCState.SPECIAL
51136
51139
  end
51137
51140
  --- Helper function to detect the custom death state of an Eggy. Eggies are never actually marked
51138
51141
  -- dead by the game. Instead, when Eggies take fatal damage, they go into NPCState.STATE_SUICIDE and
51139
51142
  -- spawn 14 Swarm Spiders while their StateFrame ticks upwards.
51140
51143
  function ____exports.isDyingEggyWithNoSpidersLeft(self, npc)
51141
- return npc.Type == EntityType.HOPPER and npc.Variant == asNumber(nil, HopperVariant.EGGY) and npc.State == NPCState.SUICIDE and npc.StateFrame >= EGGY_STATE_FRAME_OF_FINAL_SPIDER
51144
+ return npc.Type == EntityType.HOPPER and npc.Variant == HopperVariant.EGGY and npc.State == NPCState.SUICIDE and npc.StateFrame >= EGGY_STATE_FRAME_OF_FINAL_SPIDER
51142
51145
  end
51143
51146
  --- Helper function to detect the custom death state of a Rag Man Ragling. When Rag Man Raglings die,
51144
51147
  -- they turn into a patch on the ground and can be revived by Rag Man at a later time. This causes
51145
51148
  -- them to show up as an "alive" enemy, so they should usually be filtered out of lists of alive
51146
51149
  -- enemies.
51147
51150
  function ____exports.isRaglingDeathPatch(self, npc)
51148
- return npc.Type == EntityType.RAGLING and npc.Variant == asNumber(nil, RaglingVariant.RAG_MANS_RAGLING) and npc.State == NPCState.SPECIAL
51151
+ return npc.Type == EntityType.RAGLING and npc.Variant == RaglingVariant.RAG_MANS_RAGLING and npc.State == NPCState.SPECIAL
51149
51152
  end
51150
51153
  NON_ALIVE_NPCS_TYPE_VARIANT = __TS__New(
51151
51154
  ReadonlySet,
@@ -51253,8 +51256,6 @@ local isRNG = ____rng.isRNG
51253
51256
  local ____rooms = require("functions.rooms")
51254
51257
  local inBeastRoom = ____rooms.inBeastRoom
51255
51258
  local inDogmaRoom = ____rooms.inDogmaRoom
51256
- local ____types = require("functions.types")
51257
- local asNumber = ____types.asNumber
51258
51259
  local ____utils = require("functions.utils")
51259
51260
  local ____repeat = ____utils["repeat"]
51260
51261
  local BOSSES_THAT_REQUIRE_MULTIPLE_SPAWNS = __TS__New(ReadonlySet, {
@@ -51431,7 +51432,7 @@ local function getNumBossSegments(self, entityType, variant, numSegments)
51431
51432
  ____cond22 = ____cond22 or ____switch22 == EntityType.LOKI
51432
51433
  if ____cond22 then
51433
51434
  do
51434
- return variant == asNumber(nil, LokiVariant.LOKII) and 2 or 1
51435
+ return variant == LokiVariant.LOKII and 2 or 1
51435
51436
  end
51436
51437
  end
51437
51438
  ____cond22 = ____cond22 or ____switch22 == EntityType.GURGLING
@@ -52284,8 +52285,6 @@ local ____sound = require("functions.sound")
52284
52285
  local getMusicForStage = ____sound.getMusicForStage
52285
52286
  local ____stage = require("functions.stage")
52286
52287
  local setStage = ____stage.setStage
52287
- local ____types = require("functions.types")
52288
- local asNumber = ____types.asNumber
52289
52288
  local ____utils = require("functions.utils")
52290
52289
  local assertDefined = ____utils.assertDefined
52291
52290
  local ____Feature = require("classes.private.Feature")
@@ -52611,7 +52610,7 @@ function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakTex
52611
52610
  baseStage = baseStage + 1
52612
52611
  end
52613
52612
  local baseStageType = customStage.baseStageType == nil and DEFAULT_BASE_STAGE_TYPE or customStage.baseStageType
52614
- local reseed = asNumber(nil, stage) >= baseStage
52613
+ local reseed = stage >= baseStage
52615
52614
  setStage(nil, baseStage, baseStageType, reseed)
52616
52615
  musicManager:Disable()
52617
52616
  self:setStageRoomsData(customStage, rng, verbose)
@@ -54602,7 +54601,6 @@ local ____spawnCollectible = require("functions.spawnCollectible")
54602
54601
  local spawnCollectible = ____spawnCollectible.spawnCollectible
54603
54602
  local ____types = require("functions.types")
54604
54603
  local asCollectibleType = ____types.asCollectibleType
54605
- local asNumber = ____types.asNumber
54606
54604
  local ____utils = require("functions.utils")
54607
54605
  local assertDefined = ____utils.assertDefined
54608
54606
  local ____ReadonlySet = require("types.ReadonlySet")
@@ -54827,11 +54825,12 @@ function DeployJSONRoom.prototype.spawnNormalEntityForJSONRoom(self, entityType,
54827
54825
  local position = gridCoordinatesToWorldPosition(nil, x, y)
54828
54826
  local seed = rng:Next()
54829
54827
  local entity
54830
- if entityType == EntityType.PICKUP and variant == asNumber(nil, PickupVariant.COLLECTIBLE) then
54828
+ if entityType == EntityType.PICKUP and variant == PickupVariant.COLLECTIBLE then
54829
+ local collectibleType = asCollectibleType(nil, subType)
54831
54830
  local options = roomType == RoomType.ANGEL
54832
54831
  entity = spawnCollectible(
54833
54832
  nil,
54834
- asCollectibleType(nil, subType),
54833
+ collectibleType,
54835
54834
  position,
54836
54835
  seed,
54837
54836
  options
@@ -54846,7 +54845,7 @@ function DeployJSONRoom.prototype.spawnNormalEntityForJSONRoom(self, entityType,
54846
54845
  seed
54847
54846
  )
54848
54847
  end
54849
- if entityType == EntityType.PITFALL and variant == asNumber(nil, PitfallVariant.PITFALL) then
54848
+ if entityType == EntityType.PITFALL and variant == PitfallVariant.PITFALL then
54850
54849
  entity.EntityCollisionClass = EntityCollisionClass.ENEMIES
54851
54850
  entity.GridCollisionClass = EntityGridCollisionClass.WALLS
54852
54851
  end
@@ -60105,7 +60104,6 @@ local getMapPartialMatch = ____string.getMapPartialMatch
60105
60104
  local ____trinkets = require("functions.trinkets")
60106
60105
  local getGoldenTrinketType = ____trinkets.getGoldenTrinketType
60107
60106
  local ____types = require("functions.types")
60108
- local asCardType = ____types.asCardType
60109
60107
  local asCollectibleType = ____types.asCollectibleType
60110
60108
  local asTrinketType = ____types.asTrinketType
60111
60109
  local ____utils = require("functions.utils")
@@ -60534,11 +60532,7 @@ function ____exports.cards(self)
60534
60532
  return
60535
60533
  end
60536
60534
  local worldPosition = gridCoordinatesToWorldPosition(nil, x, y)
60537
- spawnCard(
60538
- nil,
60539
- asCardType(nil, cardType),
60540
- worldPosition
60541
- )
60535
+ spawnCard(nil, cardType, worldPosition)
60542
60536
  cardType = cardType + 1
60543
60537
  x = x + 1
60544
60538
  end