isaacscript-common 80.2.0 → 80.2.2

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 (62) 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/stage.lua +2 -6
  37. package/dist/functions/trinkets.lua +2 -2
  38. package/dist/functions/types.d.ts +29 -0
  39. package/dist/functions/types.d.ts.map +1 -1
  40. package/dist/index.rollup.d.ts +56 -26
  41. package/dist/isaacscript-common.lua +98 -147
  42. package/package.json +2 -2
  43. package/src/classes/callbacks/PostItemDischarge.ts +1 -2
  44. package/src/classes/features/other/CustomPickups.ts +1 -2
  45. package/src/classes/features/other/CustomStages.ts +1 -4
  46. package/src/classes/features/other/DeployJSONRoom.ts +5 -9
  47. package/src/classes/features/other/ModdedElementDetection.ts +61 -77
  48. package/src/classes/features/other/StageHistory.ts +1 -2
  49. package/src/classes/features/other/extraConsoleCommands/commands.ts +2 -6
  50. package/src/core/constantsFirstLast.ts +29 -6
  51. package/src/functions/bosses.ts +1 -2
  52. package/src/functions/doors.ts +5 -6
  53. package/src/functions/gridEntities.ts +2 -2
  54. package/src/functions/gridEntitiesSpecific.ts +5 -6
  55. package/src/functions/nextStage.ts +4 -5
  56. package/src/functions/npcs.ts +3 -4
  57. package/src/functions/pills.ts +4 -6
  58. package/src/functions/pocketItems.ts +1 -2
  59. package/src/functions/rooms.ts +15 -17
  60. package/src/functions/stage.ts +3 -3
  61. package/src/functions/trinkets.ts +2 -2
  62. package/src/functions/types.ts +30 -0
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 80.1.0
3
+ isaacscript-common 80.2.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -6972,6 +6972,8 @@ local ____exports = {}
6972
6972
  --
6973
6973
  -- This is the sub-type of a player.
6974
6974
  --
6975
+ -- This enum is contiguous. (Every value is satisfied between -1 and 40, inclusive.)
6976
+ --
6975
6977
  -- Conventionally, variables that have this type are represented as "character" instead of
6976
6978
  -- "playerType", since the former is more descriptive of what this value actually represents.
6977
6979
  ____exports.PlayerType = {}
@@ -20120,26 +20122,37 @@ local iRange = ____utils.iRange
20120
20122
  ____exports.FIRST_COLLECTIBLE_TYPE = CollectibleType.SAD_ONION
20121
20123
  --- Calculated from the `CollectibleType` enum.
20122
20124
  --
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.
20125
+ -- Note that this cannot be calculated from the length of the enum, because collectible types are
20126
+ -- not contiguous.
20125
20127
  ____exports.LAST_VANILLA_COLLECTIBLE_TYPE = getHighestEnumValue(nil, CollectibleType)
20126
20128
  --- Calculated from the `CollectibleType` enum. (`CollectibleType.NULL` is not included.)
20127
20129
  ____exports.NUM_VANILLA_COLLECTIBLE_TYPES = getEnumLength(nil, CollectibleType) - 1
20128
20130
  --- Equal to `TrinketType.SWALLOWED_PENNY`.
20129
20131
  ____exports.FIRST_TRINKET_TYPE = TrinketType.SWALLOWED_PENNY
20130
20132
  --- Calculated from the `TrinketType` enum.
20133
+ --
20134
+ -- Note that this cannot be calculated from the length of the enum, because trinket types are not
20135
+ -- contiguous.
20131
20136
  ____exports.LAST_VANILLA_TRINKET_TYPE = getHighestEnumValue(nil, TrinketType)
20132
20137
  --- Calculated from the `TrinketType` enum. (`TrinketType.NULL` is not included.)
20133
20138
  ____exports.NUM_VANILLA_TRINKET_TYPES = getEnumLength(nil, TrinketType) - 1
20134
20139
  --- Equal to `Card.FOOL`.
20135
20140
  ____exports.FIRST_CARD_TYPE = CardType.FOOL
20136
- --- Calculated from the `Card` enum.
20141
+ --- Calculated from the `CardType` enum.
20142
+ --
20143
+ -- Note that this could be calculated from the length of the enum, because card types are
20144
+ -- contiguous. However, we instead get the highest enum value to be safer and to make the code more
20145
+ -- consistent with collectibles and trinkets.
20137
20146
  ____exports.LAST_VANILLA_CARD_TYPE = getHighestEnumValue(nil, CardType)
20138
20147
  --- Calculated from the `Card` enum. `Card.NULL` is not included.
20139
20148
  ____exports.NUM_VANILLA_CARD_TYPES = getEnumLength(nil, CardType) - 1
20140
20149
  --- Equal to `PillEffect.BAD_GAS`.
20141
20150
  ____exports.FIRST_PILL_EFFECT = PillEffect.BAD_GAS
20142
20151
  --- Calculated from the `PillEffect` enum.
20152
+ --
20153
+ -- Note that this could be calculated from the length of the enum, because pill effects are
20154
+ -- contiguous. However, we instead get the highest enum value to be safer and to make the code more
20155
+ -- consistent with collectibles and trinkets.
20143
20156
  ____exports.LAST_VANILLA_PILL_EFFECT = getHighestEnumValue(nil, PillEffect)
20144
20157
  --- Calculated from the `PillEffect` enum. (There is no `PillEffect.NULL` in the custom enum, so we
20145
20158
  -- do not have to subtract one here.)
@@ -20162,6 +20175,10 @@ ____exports.NUM_NORMAL_PILL_COLORS = #iRange(nil, ____exports.FIRST_PILL_COLOR,
20162
20175
  --- Equal to `PlayerType.ISAAC`.
20163
20176
  ____exports.FIRST_CHARACTER = PlayerType.ISAAC
20164
20177
  --- Calculated from the `PlayerType` enum.
20178
+ --
20179
+ -- Note that this could be calculated from the length of the enum, because characters are
20180
+ -- contiguous. However, we instead get the highest enum value to be safer and to make the code more
20181
+ -- consistent with collectibles and trinkets.
20165
20182
  ____exports.LAST_VANILLA_CHARACTER = getHighestEnumValue(nil, PlayerType)
20166
20183
  ____exports.FIRST_ROOM_TYPE = RoomType.DEFAULT
20167
20184
  ____exports.LAST_ROOM_TYPE = getHighestEnumValue(nil, RoomType)
@@ -23561,8 +23578,6 @@ local ____flag = require("functions.flag")
23561
23578
  local hasFlag = ____flag.hasFlag
23562
23579
  local ____tstlClass = require("functions.tstlClass")
23563
23580
  local isTSTLSet = ____tstlClass.isTSTLSet
23564
- local ____types = require("functions.types")
23565
- local asNumber = ____types.asNumber
23566
23581
  function ____exports.doorSlotToDirection(self, doorSlot)
23567
23582
  return DOOR_SLOT_TO_DIRECTION[doorSlot]
23568
23583
  end
@@ -23616,22 +23631,22 @@ end
23616
23631
  -- contains the hole to the Blue Womb. (In vanilla, the door will only appear in the It Lives Boss
23617
23632
  -- Room.)
23618
23633
  function ____exports.isBlueWombDoor(self, door)
23619
- return door.TargetRoomIndex == asNumber(nil, GridRoom.BLUE_WOMB)
23634
+ return door.TargetRoomIndex == GridRoom.BLUE_WOMB
23620
23635
  end
23621
23636
  --- Helper function to check if the provided door is the one that leads to the Boss Rush room. (In
23622
23637
  -- vanilla, the door will only appear in the Boss Room of the sixth floor.)
23623
23638
  function ____exports.isBossRushDoor(self, door)
23624
- return door.TargetRoomIndex == asNumber(nil, GridRoom.BOSS_RUSH)
23639
+ return door.TargetRoomIndex == GridRoom.BOSS_RUSH
23625
23640
  end
23626
23641
  --- Helper function to check if the provided door is the one that leads to the Mega Satan Boss Room.
23627
23642
  -- (In vanilla, the door will only appear in the starting room of The Chest / Dark Room.)
23628
23643
  function ____exports.isMegaSatanDoor(self, door)
23629
- return door.TargetRoomIndex == asNumber(nil, GridRoom.MEGA_SATAN)
23644
+ return door.TargetRoomIndex == GridRoom.MEGA_SATAN
23630
23645
  end
23631
23646
  --- Helper function to check if the provided door leads to the "secret exit" off-grid room that takes
23632
23647
  -- you to the Repentance floor.
23633
23648
  function ____exports.isRepentanceDoor(self, door)
23634
- return door.TargetRoomIndex == asNumber(nil, GridRoom.SECRET_EXIT)
23649
+ return door.TargetRoomIndex == GridRoom.SECRET_EXIT
23635
23650
  end
23636
23651
  --- This refers to the hole in the wall that appears after bombing the entrance to a secret room.
23637
23652
  -- Note that the door still exists before it has been bombed open. It has a sprite filename of
@@ -23647,7 +23662,7 @@ end
23647
23662
  --- Helper function to check if the provided door is the one that leads to the off-grid room that
23648
23663
  -- contains the portal to The Void. (In vanilla, the door will only appear in the Hush Boss Room.)
23649
23664
  function ____exports.isVoidDoor(self, door)
23650
- return door.TargetRoomIndex == asNumber(nil, GridRoom.VOID)
23665
+ return door.TargetRoomIndex == GridRoom.VOID
23651
23666
  end
23652
23667
  --- Helper function to remove a single door.
23653
23668
  function ____exports.removeDoor(self, door)
@@ -29301,8 +29316,6 @@ local ____playerDataStructures = require("functions.playerDataStructures")
29301
29316
  local defaultMapGetPlayer = ____playerDataStructures.defaultMapGetPlayer
29302
29317
  local mapGetPlayer = ____playerDataStructures.mapGetPlayer
29303
29318
  local mapSetPlayer = ____playerDataStructures.mapSetPlayer
29304
- local ____types = require("functions.types")
29305
- local asNumber = ____types.asNumber
29306
29319
  local ____DefaultMap = require("classes.DefaultMap")
29307
29320
  local DefaultMap = ____DefaultMap.DefaultMap
29308
29321
  local ____CustomCallback = require("classes.private.CustomCallback")
@@ -29333,7 +29346,7 @@ function PostItemDischarge.prototype.____constructor(self)
29333
29346
  return callbackCollectibleType == nil or callbackCollectibleType == collectibleType
29334
29347
  end
29335
29348
  self.preNPCCollisionSucker = function(____, npc, collider)
29336
- if npc.Variant == asNumber(nil, SuckerVariant.BULB) then
29349
+ if npc.Variant == SuckerVariant.BULB then
29337
29350
  return self:preNPCCollisionBulb(npc, collider)
29338
29351
  end
29339
29352
  return nil
@@ -32066,7 +32079,6 @@ local ____log = require("functions.log")
32066
32079
  local log = ____log.log
32067
32080
  local ____types = require("functions.types")
32068
32081
  local asLevelStage = ____types.asLevelStage
32069
- local asNumber = ____types.asNumber
32070
32082
  local ____utils = require("functions.utils")
32071
32083
  local inRange = ____utils.inRange
32072
32084
  --- Helper function to check if the provided stage type is equal to `StageType.REPENTANCE` or
@@ -32108,10 +32120,7 @@ function ____exports.calculateStageTypeRepentance(self, stage)
32108
32120
  return StageType.REPENTANCE
32109
32121
  end
32110
32122
  local seeds = game:GetSeeds()
32111
- local adjustedStage = asLevelStage(
32112
- nil,
32113
- asNumber(nil, stage) + 1
32114
- )
32123
+ local adjustedStage = asLevelStage(nil, stage + 1)
32115
32124
  local stageSeed = seeds:GetStageSeed(adjustedStage)
32116
32125
  local halfStageSeed = math.floor(stageSeed / 2)
32117
32126
  if halfStageSeed % 2 == 0 then
@@ -32126,7 +32135,7 @@ function ____exports.getEffectiveStage(self)
32126
32135
  local level = game:GetLevel()
32127
32136
  local stage = level:GetStage()
32128
32137
  if ____exports.onRepentanceStage(nil) then
32129
- return asNumber(nil, stage) + 1
32138
+ return stage + 1
32130
32139
  end
32131
32140
  return stage
32132
32141
  end
@@ -32503,8 +32512,6 @@ local ____roomTransition = require("functions.roomTransition")
32503
32512
  local reloadRoom = ____roomTransition.reloadRoom
32504
32513
  local ____stage = require("functions.stage")
32505
32514
  local getGotoCommand = ____stage.getGotoCommand
32506
- local ____types = require("functions.types")
32507
- local asNumber = ____types.asNumber
32508
32515
  local ____utils = require("functions.utils")
32509
32516
  local assertDefined = ____utils.assertDefined
32510
32517
  local iRange = ____utils.iRange
@@ -32584,7 +32591,7 @@ end
32584
32591
  -- Under the hood, this checks the room type being equal to `RoomType.ANGEL` (15) and the sub-type
32585
32592
  -- being equal to `AngelRoomSubType.SHOP` (1).
32586
32593
  function ____exports.isAngelShop(self, roomData)
32587
- return roomData.Type == RoomType.ANGEL and roomData.Subtype == asNumber(nil, AngelRoomSubType.SHOP)
32594
+ return roomData.Type == RoomType.ANGEL and roomData.Subtype == AngelRoomSubType.SHOP
32588
32595
  end
32589
32596
  --- Helper function to check to see if the provided room is the Boss Room for The Beast.
32590
32597
  --
@@ -32593,7 +32600,7 @@ end
32593
32600
  -- Under the hood, this checks the room type being equal to `RoomType.DUNGEON` (16) and the sub-type
32594
32601
  -- being equal to `DungeonSubType.BEAST_ROOM` (4).
32595
32602
  function ____exports.isBeastRoom(self, roomData)
32596
- return roomData.Type == RoomType.DUNGEON and roomData.Subtype == asNumber(nil, DungeonSubType.BEAST_ROOM)
32603
+ return roomData.Type == RoomType.DUNGEON and roomData.Subtype == DungeonSubType.BEAST_ROOM
32597
32604
  end
32598
32605
  --- Helper function to detect if the provided room is big. Specifically, this is all 1x2 rooms, 2x2
32599
32606
  -- rooms, and L rooms.
@@ -32603,13 +32610,13 @@ end
32603
32610
  --- Helper function to check if the provided room is the Boss Room for a particular boss. This will
32604
32611
  -- only work for bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
32605
32612
  function ____exports.isBossRoomOf(self, roomData, bossID)
32606
- return roomData.Type == RoomType.BOSS and roomData.StageID == StageID.SPECIAL_ROOMS and roomData.Subtype == asNumber(nil, bossID)
32613
+ return roomData.Type == RoomType.BOSS and roomData.StageID == StageID.SPECIAL_ROOMS and roomData.Subtype == bossID
32607
32614
  end
32608
32615
  --- Helper function for determining whether the provided room is a crawl space. Use this function
32609
32616
  -- over comparing to `RoomType.DUNGEON` or `GridRoom.DUNGEON_IDX` since there is a special case of
32610
32617
  -- the player being in a boss fight that takes place in a dungeon.
32611
32618
  function ____exports.isCrawlSpace(self, roomData)
32612
- return roomData.Type == RoomType.DUNGEON and roomData.Subtype == asNumber(nil, DungeonSubType.NORMAL)
32619
+ return roomData.Type == RoomType.DUNGEON and roomData.Subtype == DungeonSubType.NORMAL
32613
32620
  end
32614
32621
  --- Helper function for checking whether the provided room is a crawl space with a door corresponding
32615
32622
  -- to `DoorSlotFlag.RIGHT_0` (1 << 2).
@@ -32618,7 +32625,7 @@ function ____exports.isCrawlSpaceWithBlackMarketEntrance(self, roomData)
32618
32625
  end
32619
32626
  --- Helper function to detect if the provided room is one of the rooms in the Death Certificate area.
32620
32627
  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))
32628
+ return roomData.StageID == StageID.HOME and (roomData.Subtype == HomeRoomSubType.DEATH_CERTIFICATE_ENTRANCE or roomData.Subtype == HomeRoomSubType.DEATH_CERTIFICATE_ITEMS)
32622
32629
  end
32623
32630
  --- Helper function to detect if the provided room is a Treasure Room created when entering with a
32624
32631
  -- Devil's Crown trinket.
@@ -32639,7 +32646,7 @@ end
32639
32646
  -- Dogma Boss Room that exists in vanilla) and the sub-type being equal to
32640
32647
  -- `HomeRoomSubType.LIVING_ROOM` (3).
32641
32648
  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)
32649
+ return roomData.StageID == StageID.HOME and roomData.Type == RoomType.DEFAULT and roomData.Variant == 1000 and roomData.Subtype == HomeRoomSubType.LIVING_ROOM
32643
32650
  end
32644
32651
  --- Helper function to detect if the provided room is a Double Trouble Boss Room.
32645
32652
  --
@@ -32655,14 +32662,14 @@ function ____exports.isDoubleTrouble(self, roomData)
32655
32662
  end
32656
32663
  --- Helper function to determine if the index of the provided room is equal to `GridRoom.GENESIS`.
32657
32664
  function ____exports.isGenesisRoom(self, roomGridIndex)
32658
- return roomGridIndex == asNumber(nil, GridRoom.GENESIS)
32665
+ return roomGridIndex == GridRoom.GENESIS
32659
32666
  end
32660
32667
  --- Helper function to check if the provided room is either the left Home closet (behind the red
32661
32668
  -- door) or the right Home closet (with one random pickup).
32662
32669
  --
32663
32670
  -- Home closets have a unique shape that is different from any other room in the game.
32664
32671
  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))
32672
+ return roomData.StageID == StageID.HOME and (roomData.Subtype == HomeRoomSubType.CLOSET_LEFT or roomData.Subtype == HomeRoomSubType.CLOSET_RIGHT)
32666
32673
  end
32667
32674
  --- Helper function to determine if the provided room is one of the four L room shapes.
32668
32675
  function ____exports.isLRoom(self, roomData)
@@ -32670,7 +32677,7 @@ function ____exports.isLRoom(self, roomData)
32670
32677
  end
32671
32678
  --- Helper function to determine if the index of the provided room is equal to `GridRoom.MEGA_SATAN`.
32672
32679
  function ____exports.isMegaSatanRoom(self, roomGridIndex)
32673
- return roomGridIndex == asNumber(nil, GridRoom.MEGA_SATAN)
32680
+ return roomGridIndex == GridRoom.MEGA_SATAN
32674
32681
  end
32675
32682
  --- Helper function to determine if the provided room is part of the Repentance "escape sequence" in
32676
32683
  -- the Mines/Ashpit.
@@ -32680,12 +32687,12 @@ end
32680
32687
  --- Helper function to check if the provided room is a miniboss room for a particular miniboss. This
32681
32688
  -- will only work for mini-bosses that have dedicated boss rooms in the "00.special rooms.stb" file.
32682
32689
  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)
32690
+ return roomData.Type == RoomType.MINI_BOSS and roomData.StageID == StageID.SPECIAL_ROOMS and roomData.Subtype == minibossID
32684
32691
  end
32685
32692
  --- Helper function to check if the provided room is a "mirror room" in Downpour or Dross. (These
32686
32693
  -- rooms are marked with a specific sub-type.)
32687
32694
  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)
32695
+ return roomData.Type == RoomType.DEFAULT and (roomData.StageID == StageID.DOWNPOUR or roomData.StageID == StageID.DROSS) and roomData.Subtype == DownpourRoomSubType.MIRROR
32689
32696
  end
32690
32697
  --- Helper function to check if the provided room matches one of the given room shapes.
32691
32698
  --
@@ -32704,7 +32711,7 @@ end
32704
32711
  --- Helper function for checking if the provided room is a secret exit that leads to a Repentance
32705
32712
  -- floor.
32706
32713
  function ____exports.isSecretExit(self, roomGridIndex)
32707
- return roomGridIndex == asNumber(nil, GridRoom.SECRET_EXIT)
32714
+ return roomGridIndex == GridRoom.SECRET_EXIT
32708
32715
  end
32709
32716
  --- Helper function for checking if the provided room is a secret shop (from the Member Card
32710
32717
  -- collectible).
@@ -32713,7 +32720,7 @@ end
32713
32720
  -- words, they will have the same room type, room variant, and room sub-type of a normal shop. Thus,
32714
32721
  -- the only way to detect them is by using the grid index.
32715
32722
  function ____exports.isSecretShop(self, roomGridIndex)
32716
- return roomGridIndex == asNumber(nil, GridRoom.SECRET_SHOP)
32723
+ return roomGridIndex == GridRoom.SECRET_SHOP
32717
32724
  end
32718
32725
  local SECRET_ROOM_TYPES = __TS__New(ReadonlySet, {RoomType.SECRET, RoomType.SUPER_SECRET, RoomType.ULTRA_SECRET})
32719
32726
  --- Helper function for quickly switching to a new room without playing a particular animation. Use
@@ -33158,7 +33165,6 @@ local isCircleIntersectingRectangle = ____math.isCircleIntersectingRectangle
33158
33165
  local ____rooms = require("functions.rooms")
33159
33166
  local roomUpdateSafe = ____rooms.roomUpdateSafe
33160
33167
  local ____types = require("functions.types")
33161
- local asNumber = ____types.asNumber
33162
33168
  local isInteger = ____types.isInteger
33163
33169
  local ____utils = require("functions.utils")
33164
33170
  local assertDefined = ____utils.assertDefined
@@ -33516,7 +33522,7 @@ function ____exports.removeGridEntity(self, gridEntityOrGridIndex, updateRoom)
33516
33522
  roomUpdateSafe(nil)
33517
33523
  end
33518
33524
  if gridEntityType == GridEntityType.STATUE then
33519
- local effectVariant = variant == asNumber(nil, StatueVariant.DEVIL) and EffectVariant.DEVIL or EffectVariant.ANGEL
33525
+ local effectVariant = variant == StatueVariant.DEVIL and EffectVariant.DEVIL or EffectVariant.ANGEL
33520
33526
  local effects = getEffects(nil, effectVariant)
33521
33527
  local effectsOnTile = __TS__ArrayFilter(
33522
33528
  effects,
@@ -34508,8 +34514,6 @@ local getGridEntities = ____gridEntities.getGridEntities
34508
34514
  local getMatchingGridEntities = ____gridEntities.getMatchingGridEntities
34509
34515
  local removeGridEntities = ____gridEntities.removeGridEntities
34510
34516
  local spawnGridEntityWithVariant = ____gridEntities.spawnGridEntityWithVariant
34511
- local ____types = require("functions.types")
34512
- local asNumber = ____types.asNumber
34513
34517
  local ____utils = require("functions.utils")
34514
34518
  local assertDefined = ____utils.assertDefined
34515
34519
  --- Helper function to spawn a `GridEntityType.CRAWL_SPACE` (18) with a specific variant.
@@ -34599,7 +34603,7 @@ function ____exports.getCrawlSpaces(self, crawlSpaceVariant)
34599
34603
  if crawlSpaceVariant == nil then
34600
34604
  crawlSpaceVariant = -1
34601
34605
  end
34602
- if asNumber(nil, crawlSpaceVariant) == -1 then
34606
+ if crawlSpaceVariant == -1 then
34603
34607
  return getGridEntities(nil, GridEntityType.CRAWL_SPACE)
34604
34608
  end
34605
34609
  return getMatchingGridEntities(nil, GridEntityType.CRAWL_SPACE, crawlSpaceVariant)
@@ -34617,7 +34621,7 @@ function ____exports.getPits(self, pitVariant)
34617
34621
  local pit = gridEntity:ToPit()
34618
34622
  if pit ~= nil then
34619
34623
  local thisPitVariant = pit:GetVariant()
34620
- if asNumber(nil, pitVariant) == -1 or pitVariant == thisPitVariant then
34624
+ if pitVariant == -1 or pitVariant == thisPitVariant then
34621
34625
  pits[#pits + 1] = pit
34622
34626
  end
34623
34627
  end
@@ -34637,7 +34641,7 @@ function ____exports.getPoops(self, poopVariant)
34637
34641
  local poop = gridEntity:ToPoop()
34638
34642
  if poop ~= nil then
34639
34643
  local thisPoopVariant = poop:GetVariant()
34640
- if asNumber(nil, poopVariant) == -1 or poopVariant == thisPoopVariant then
34644
+ if poopVariant == -1 or poopVariant == thisPoopVariant then
34641
34645
  poops[#poops + 1] = poop
34642
34646
  end
34643
34647
  end
@@ -34657,7 +34661,7 @@ function ____exports.getPressurePlates(self, pressurePlateVariant)
34657
34661
  local pressurePlate = gridEntity:ToPressurePlate()
34658
34662
  if pressurePlate ~= nil then
34659
34663
  local thisPressurePlateVariant = pressurePlate:GetVariant()
34660
- if asNumber(nil, pressurePlateVariant) == -1 or pressurePlateVariant == thisPressurePlateVariant then
34664
+ if pressurePlateVariant == -1 or pressurePlateVariant == thisPressurePlateVariant then
34661
34665
  pressurePlates[#pressurePlates + 1] = pressurePlate
34662
34666
  end
34663
34667
  end
@@ -34743,7 +34747,7 @@ function ____exports.getTrapdoors(self, trapdoorVariant)
34743
34747
  if trapdoorVariant == nil then
34744
34748
  trapdoorVariant = -1
34745
34749
  end
34746
- if asNumber(nil, trapdoorVariant) == -1 then
34750
+ if trapdoorVariant == -1 then
34747
34751
  return getGridEntities(nil, GridEntityType.TRAPDOOR)
34748
34752
  end
34749
34753
  return getMatchingGridEntities(nil, GridEntityType.TRAPDOOR, trapdoorVariant)
@@ -36575,7 +36579,7 @@ local TRINKET_SPRITE_LAYER = 0
36575
36579
  -- For example, passing `TrinketType.SWALLOWED_PENNY` would result in 32769, which is the value that
36576
36580
  -- corresponds to the golden trinket sub-type for Swallowed Penny.
36577
36581
  function ____exports.getGoldenTrinketType(self, trinketType)
36578
- return ____exports.isGoldenTrinketType(nil, trinketType) and trinketType or asNumber(nil, trinketType) + GOLDEN_TRINKET_ADJUSTMENT
36582
+ return ____exports.isGoldenTrinketType(nil, trinketType) and trinketType or trinketType + GOLDEN_TRINKET_ADJUSTMENT
36579
36583
  end
36580
36584
  --- Helper function to get the current effect that the Mysterious Paper trinket is providing to the
36581
36585
  -- player. Returns undefined if the player does not have the Mysterious Paper trinket.
@@ -36609,7 +36613,7 @@ end
36609
36613
  -- If the provided trinket type is already a normal trinket type, then the trinket type will be
36610
36614
  -- returned unmodified.
36611
36615
  function ____exports.getNormalTrinketType(self, trinketType)
36612
- return ____exports.isGoldenTrinketType(nil, trinketType) and asNumber(nil, trinketType) - GOLDEN_TRINKET_ADJUSTMENT or trinketType
36616
+ return ____exports.isGoldenTrinketType(nil, trinketType) and trinketType - GOLDEN_TRINKET_ADJUSTMENT or trinketType
36613
36617
  end
36614
36618
  --- Helper function to get the in-game description for a trinket. Returns "Unknown" if the provided
36615
36619
  -- trinket type was not valid.
@@ -38555,6 +38559,7 @@ return ____exports
38555
38559
  local ____lualib = require("lualib_bundle")
38556
38560
  local __TS__ArraySlice = ____lualib.__TS__ArraySlice
38557
38561
  local ____exports = {}
38562
+ local HORSE_PILL_ADJUSTMENT
38558
38563
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.index")
38559
38564
  local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
38560
38565
  local ____cachedEnumValues = require("arrays.cachedEnumValues")
@@ -38588,15 +38593,14 @@ local asNumber = ____types.asNumber
38588
38593
  local asPillColor = ____types.asPillColor
38589
38594
  local ____utils = require("functions.utils")
38590
38595
  local iRange = ____utils.iRange
38596
+ --- Helper function to see if the given pill color is a horse pill.
38597
+ function ____exports.isHorsePill(self, pillColor)
38598
+ return asNumber(nil, pillColor) > HORSE_PILL_ADJUSTMENT
38599
+ end
38591
38600
  function ____exports.isVanillaPillEffect(self, pillEffect)
38592
38601
  return pillEffect <= LAST_VANILLA_PILL_EFFECT
38593
38602
  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
38603
+ HORSE_PILL_ADJUSTMENT = 2048
38600
38604
  --- Helper function to get an array with every non-null pill color. This includes all gold colors and
38601
38605
  -- all horse colors.
38602
38606
  function ____exports.getAllPillColors(self)
@@ -38613,7 +38617,7 @@ end
38613
38617
  -- For example, passing `PillColor.BLUE_BLUE` would result in 2049, which is the value that
38614
38618
  -- corresponds to the horse pill color for blue/blue.
38615
38619
  function ____exports.getHorsePillColor(self, pillColor)
38616
- return asNumber(nil, pillColor) + HORSE_PILL_ADJUSTMENT
38620
+ return pillColor + HORSE_PILL_ADJUSTMENT
38617
38621
  end
38618
38622
  --- Helper function to get an array with every non-gold horse pill color.
38619
38623
  function ____exports.getHorsePillColors(self)
@@ -38625,11 +38629,7 @@ end
38625
38629
  --
38626
38630
  -- If called with a non-horse pill color, this function will return back the same color.
38627
38631
  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
38632
+ return ____exports.isHorsePill(nil, pillColor) and asPillColor(nil, pillColor - HORSE_PILL_ADJUSTMENT) or pillColor
38633
38633
  end
38634
38634
  --- Helper function to get an array with every non-gold and non-horse pill color.
38635
38635
  function ____exports.getNormalPillColors(self)
@@ -38710,10 +38710,6 @@ end
38710
38710
  function ____exports.isGoldPill(self, pillColor)
38711
38711
  return pillColor == PillColor.GOLD or pillColor == PillColor.HORSE_GOLD
38712
38712
  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
38713
  function ____exports.isModdedPillEffect(self, pillEffect)
38718
38714
  return not ____exports.isVanillaPillEffect(nil, pillEffect)
38719
38715
  end
@@ -38741,8 +38737,6 @@ local ____PocketItemType = require("enums.PocketItemType")
38741
38737
  local PocketItemType = ____PocketItemType.PocketItemType
38742
38738
  local ____players = require("functions.players")
38743
38739
  local isCharacter = ____players.isCharacter
38744
- local ____types = require("functions.types")
38745
- local asNumber = ____types.asNumber
38746
38740
  --- Use this helper function as a workaround for the `EntityPlayer.GetPocketItem` method not working
38747
38741
  -- correctly.
38748
38742
  --
@@ -38778,7 +38772,7 @@ function ____exports.getPocketItems(self, player)
38778
38772
  else
38779
38773
  pocketItems[#pocketItems + 1] = {slot = slot, type = PocketItemType.EMPTY, subType = 0}
38780
38774
  end
38781
- if asNumber(nil, slot) + 1 == maxPocketItems then
38775
+ if slot + 1 == maxPocketItems then
38782
38776
  break
38783
38777
  end
38784
38778
  end
@@ -44457,14 +44451,12 @@ local NUM_VANILLA_PILL_EFFECTS = ____constantsFirstLast.NUM_VANILLA_PILL_EFFECTS
44457
44451
  local NUM_VANILLA_TRINKET_TYPES = ____constantsFirstLast.NUM_VANILLA_TRINKET_TYPES
44458
44452
  local ____decorators = require("decorators")
44459
44453
  local Exported = ____decorators.Exported
44460
- local ____types = require("functions.types")
44461
- local asCardType = ____types.asCardType
44462
- local asCollectibleType = ____types.asCollectibleType
44463
- local asNumber = ____types.asNumber
44464
- local asPillEffect = ____types.asPillEffect
44465
- local asTrinketType = ____types.asTrinketType
44466
44454
  local ____Feature = require("classes.private.Feature")
44467
44455
  local Feature = ____Feature.Feature
44456
+ ____exports.FIRST_MODDED_COLLECTIBLE_TYPE = LAST_VANILLA_COLLECTIBLE_TYPE + 1
44457
+ ____exports.FIRST_MODDED_TRINKET_TYPE = LAST_VANILLA_TRINKET_TYPE + 1
44458
+ ____exports.FIRST_MODDED_CARD_TYPE = LAST_VANILLA_CARD_TYPE + 1
44459
+ ____exports.FIRST_MODDED_PILL_EFFECT = LAST_VANILLA_PILL_EFFECT + 1
44468
44460
  --- Mods can add extra things to the game (e.g. collectibles, trinkets, and so on). Since mods load
44469
44461
  -- in alphabetical order, the total number of things can't be properly be known until at least one
44470
44462
  -- callback fires (which indicates that all mods have been loaded).
@@ -44492,16 +44484,12 @@ function ModdedElementDetection.prototype.errorIfNoCallbacksFired(self, constant
44492
44484
  end
44493
44485
  function ModdedElementDetection.prototype.getFirstModdedCollectibleType(self)
44494
44486
  self:errorIfNoCallbacksFired("collectible")
44495
- local firstModdedCollectibleType = asCollectibleType(
44496
- nil,
44497
- asNumber(nil, LAST_VANILLA_COLLECTIBLE_TYPE) + 1
44498
- )
44499
- local itemConfigItem = itemConfig:GetCollectible(firstModdedCollectibleType)
44487
+ local itemConfigItem = itemConfig:GetCollectible(____exports.FIRST_MODDED_COLLECTIBLE_TYPE)
44500
44488
  local ____temp_0
44501
44489
  if itemConfigItem == nil then
44502
44490
  ____temp_0 = nil
44503
44491
  else
44504
- ____temp_0 = firstModdedCollectibleType
44492
+ ____temp_0 = ____exports.FIRST_MODDED_COLLECTIBLE_TYPE
44505
44493
  end
44506
44494
  return ____temp_0
44507
44495
  end
@@ -44513,28 +44501,22 @@ end
44513
44501
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getLastCollectibleType", true)
44514
44502
  function ModdedElementDetection.prototype.getNumCollectibleTypes(self)
44515
44503
  self:errorIfNoCallbacksFired("collectible")
44516
- local numModdedCollectibleTypes = self:getNumModdedCollectibleTypes()
44517
- return NUM_VANILLA_COLLECTIBLE_TYPES + numModdedCollectibleTypes
44504
+ return NUM_VANILLA_COLLECTIBLE_TYPES + self:getNumModdedCollectibleTypes()
44518
44505
  end
44519
44506
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumCollectibleTypes", true)
44520
44507
  function ModdedElementDetection.prototype.getNumModdedCollectibleTypes(self)
44521
44508
  self:errorIfNoCallbacksFired("collectible")
44522
- local lastCollectibleType = self:getLastCollectibleType()
44523
- return lastCollectibleType - LAST_VANILLA_COLLECTIBLE_TYPE
44509
+ return self:getLastCollectibleType() - LAST_VANILLA_COLLECTIBLE_TYPE
44524
44510
  end
44525
44511
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedCollectibleTypes", true)
44526
44512
  function ModdedElementDetection.prototype.getFirstModdedTrinketType(self)
44527
44513
  self:errorIfNoCallbacksFired("trinket")
44528
- local firstModdedTrinketType = asTrinketType(
44529
- nil,
44530
- asNumber(nil, LAST_VANILLA_TRINKET_TYPE) + 1
44531
- )
44532
- local itemConfigItem = itemConfig:GetTrinket(firstModdedTrinketType)
44514
+ local itemConfigItem = itemConfig:GetTrinket(____exports.FIRST_MODDED_TRINKET_TYPE)
44533
44515
  local ____temp_1
44534
44516
  if itemConfigItem == nil then
44535
44517
  ____temp_1 = nil
44536
44518
  else
44537
- ____temp_1 = firstModdedTrinketType
44519
+ ____temp_1 = ____exports.FIRST_MODDED_TRINKET_TYPE
44538
44520
  end
44539
44521
  return ____temp_1
44540
44522
  end
@@ -44546,80 +44528,66 @@ end
44546
44528
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getLastTrinketType", true)
44547
44529
  function ModdedElementDetection.prototype.getNumTrinketTypes(self)
44548
44530
  self:errorIfNoCallbacksFired("trinket")
44549
- local numModdedTrinketTypes = self:getNumModdedTrinketTypes()
44550
- return NUM_VANILLA_TRINKET_TYPES + numModdedTrinketTypes
44531
+ return NUM_VANILLA_TRINKET_TYPES + self:getNumModdedTrinketTypes()
44551
44532
  end
44552
44533
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumTrinketTypes", true)
44553
44534
  function ModdedElementDetection.prototype.getNumModdedTrinketTypes(self)
44554
44535
  self:errorIfNoCallbacksFired("trinket")
44555
- local lastTrinketType = self:getLastTrinketType()
44556
- return lastTrinketType - LAST_VANILLA_TRINKET_TYPE
44536
+ return self:getLastTrinketType() - LAST_VANILLA_TRINKET_TYPE
44557
44537
  end
44558
44538
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedTrinketTypes", true)
44559
44539
  function ModdedElementDetection.prototype.getFirstModdedCardType(self)
44560
44540
  self:errorIfNoCallbacksFired("card")
44561
- local firstModdedCardType = asCardType(
44562
- nil,
44563
- asNumber(nil, LAST_VANILLA_CARD_TYPE) + 1
44564
- )
44565
- local itemConfigCard = itemConfig:GetCard(firstModdedCardType)
44541
+ local itemConfigCard = itemConfig:GetCard(____exports.FIRST_MODDED_CARD_TYPE)
44566
44542
  local ____temp_2
44567
44543
  if itemConfigCard == nil then
44568
44544
  ____temp_2 = nil
44569
44545
  else
44570
- ____temp_2 = firstModdedCardType
44546
+ ____temp_2 = ____exports.FIRST_MODDED_CARD_TYPE
44571
44547
  end
44572
44548
  return ____temp_2
44573
44549
  end
44574
44550
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getFirstModdedCardType", true)
44575
44551
  function ModdedElementDetection.prototype.getLastCardType(self)
44576
44552
  self:errorIfNoCallbacksFired("card")
44577
- local numCards = self:getNumCardTypes()
44578
- return asCardType(nil, numCards)
44553
+ return itemConfig:GetCards().Size - 1
44579
44554
  end
44580
44555
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getLastCardType", true)
44581
44556
  function ModdedElementDetection.prototype.getNumCardTypes(self)
44582
44557
  self:errorIfNoCallbacksFired("card")
44583
- return itemConfig:GetCards().Size - 1
44558
+ return NUM_VANILLA_CARD_TYPES + self:getNumModdedCardTypes()
44584
44559
  end
44585
44560
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumCardTypes", true)
44586
44561
  function ModdedElementDetection.prototype.getNumModdedCardTypes(self)
44587
44562
  self:errorIfNoCallbacksFired("card")
44588
- local numCardTypes = self:getNumCardTypes()
44589
- return numCardTypes - NUM_VANILLA_CARD_TYPES
44563
+ return self:getLastCardType() - LAST_VANILLA_CARD_TYPE
44590
44564
  end
44591
44565
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedCardTypes", true)
44592
44566
  function ModdedElementDetection.prototype.getFirstModdedPillEffect(self)
44593
44567
  self:errorIfNoCallbacksFired("pill")
44594
- local firstModdedPillEffect = asPillEffect(
44595
- nil,
44596
- asNumber(nil, LAST_VANILLA_PILL_EFFECT) + 1
44597
- )
44598
- local itemConfigPillEffect = itemConfig:GetPillEffect(firstModdedPillEffect)
44568
+ local itemConfigPillEffect = itemConfig:GetPillEffect(____exports.FIRST_MODDED_PILL_EFFECT)
44599
44569
  local ____temp_3
44600
44570
  if itemConfigPillEffect == nil then
44601
44571
  ____temp_3 = nil
44602
44572
  else
44603
- ____temp_3 = firstModdedPillEffect
44573
+ ____temp_3 = ____exports.FIRST_MODDED_PILL_EFFECT
44604
44574
  end
44605
44575
  return ____temp_3
44606
44576
  end
44607
44577
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getFirstModdedPillEffect", true)
44608
44578
  function ModdedElementDetection.prototype.getLastPillEffect(self)
44609
44579
  self:errorIfNoCallbacksFired("pill")
44610
- local numPillEffects = self:getNumPillEffects() - 1
44611
- return asPillEffect(nil, numPillEffects)
44580
+ return itemConfig:GetPillEffects().Size - 1
44612
44581
  end
44613
44582
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getLastPillEffect", true)
44614
44583
  function ModdedElementDetection.prototype.getNumPillEffects(self)
44615
44584
  self:errorIfNoCallbacksFired("pill")
44616
- return itemConfig:GetPillEffects().Size
44585
+ return NUM_VANILLA_PILL_EFFECTS + self:getNumModdedPillEffects()
44617
44586
  end
44618
44587
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumPillEffects", true)
44619
44588
  function ModdedElementDetection.prototype.getNumModdedPillEffects(self)
44620
- self:errorIfNoCallbacksFired("pill")
44621
- local numPillEffects = self:getNumPillEffects()
44622
- return numPillEffects - NUM_VANILLA_PILL_EFFECTS
44589
+ self:errorIfNoCallbacksFired("card")
44590
+ return self:getLastPillEffect() - LAST_VANILLA_PILL_EFFECT
44623
44591
  end
44624
44592
  __TS__DecorateLegacy({Exported}, ModdedElementDetection.prototype, "getNumModdedPillEffects", true)
44625
44593
  return ____exports
@@ -47182,8 +47150,6 @@ local getEntityID = ____entities.getEntityID
47182
47150
  local getEntityIDFromConstituents = ____entities.getEntityIDFromConstituents
47183
47151
  local ____entitiesSpecific = require("functions.entitiesSpecific")
47184
47152
  local spawnEffect = ____entitiesSpecific.spawnEffect
47185
- local ____types = require("functions.types")
47186
- local asNumber = ____types.asNumber
47187
47153
  local ____Feature = require("classes.private.Feature")
47188
47154
  local Feature = ____Feature.Feature
47189
47155
  --- Normally, we would make a custom entity to represent a fading-away pickup, but we don't want to
@@ -47226,7 +47192,7 @@ function CustomPickups.prototype.____constructor(self)
47226
47192
  return nil
47227
47193
  end
47228
47194
  self.postEffectRenderPickupEffect = function(____, effect)
47229
- if effect.SubType ~= asNumber(nil, PICKUP_EFFECT_SUB_TYPE) then
47195
+ if effect.SubType ~= PICKUP_EFFECT_SUB_TYPE then
47230
47196
  return
47231
47197
  end
47232
47198
  local sprite = effect:GetSprite()
@@ -48333,8 +48299,6 @@ local ____stage = require("functions.stage")
48333
48299
  local calculateStageType = ____stage.calculateStageType
48334
48300
  local calculateStageTypeRepentance = ____stage.calculateStageTypeRepentance
48335
48301
  local onRepentanceStage = ____stage.onRepentanceStage
48336
- local ____types = require("functions.types")
48337
- local asNumber = ____types.asNumber
48338
48302
  --- Helper function to get the stage that a trapdoor or heaven door would take the player to, based
48339
48303
  -- on the current stage, room, and game state flags.
48340
48304
  --
@@ -48349,7 +48313,7 @@ function ____exports.getNextStage(self)
48349
48313
  local repentanceStage = onRepentanceStage(nil)
48350
48314
  local roomGridIndex = getRoomGridIndex(nil)
48351
48315
  if backwardsPath then
48352
- local nextStage = asNumber(nil, stage) - 1
48316
+ local nextStage = stage - 1
48353
48317
  return nextStage == 0 and LevelStage.HOME or nextStage
48354
48318
  end
48355
48319
  repeat
@@ -48370,7 +48334,7 @@ function ____exports.getNextStage(self)
48370
48334
  if ____cond4 then
48371
48335
  do
48372
48336
  if repentanceStage then
48373
- return asNumber(nil, stage) + 1
48337
+ return stage + 1
48374
48338
  end
48375
48339
  if stage == LevelStage.DEPTHS_2 or stage == LevelStage.DEPTHS_1 and hasCurse(nil, LevelCurse.LABYRINTH) then
48376
48340
  return LevelStage.DEPTHS_2
@@ -48400,7 +48364,7 @@ function ____exports.getNextStage(self)
48400
48364
  if stage == LevelStage.VOID then
48401
48365
  return LevelStage.VOID
48402
48366
  end
48403
- return asNumber(nil, stage) + 1
48367
+ return stage + 1
48404
48368
  end
48405
48369
  --- Helper function to get the stage type that a trapdoor or heaven door would take the player to,
48406
48370
  -- based on the current stage, room, and game state flags.
@@ -48426,7 +48390,7 @@ function ____exports.getNextStageType(self, upwards)
48426
48390
  if backwardsPath then
48427
48391
  return calculateStageType(nil, nextStage)
48428
48392
  end
48429
- if roomGridIndex == asNumber(nil, GridRoom.SECRET_EXIT) then
48393
+ if roomGridIndex == GridRoom.SECRET_EXIT then
48430
48394
  return calculateStageTypeRepentance(nil, nextStage)
48431
48395
  end
48432
48396
  if repentanceStage and (stage == LevelStage.BASEMENT_1 or stage == LevelStage.CAVES_1 or stage == LevelStage.DEPTHS_1 or stage == LevelStage.WOMB_1) then
@@ -48487,8 +48451,6 @@ local getNextStageType = ____nextStage.getNextStageType
48487
48451
  local ____stage = require("functions.stage")
48488
48452
  local calculateStageType = ____stage.calculateStageType
48489
48453
  local onRepentanceStage = ____stage.onRepentanceStage
48490
- local ____types = require("functions.types")
48491
- local asNumber = ____types.asNumber
48492
48454
  local ____Feature = require("classes.private.Feature")
48493
48455
  local Feature = ____Feature.Feature
48494
48456
  local v = {run = {stageHistory = {}}}
@@ -48635,7 +48597,7 @@ function StageHistory.prototype.getNextStageWithHistory(self)
48635
48597
  end
48636
48598
  return LevelStage.DEPTHS_1
48637
48599
  end
48638
- return asNumber(nil, stage) - 1
48600
+ return stage - 1
48639
48601
  end
48640
48602
  __TS__DecorateLegacy({Exported}, StageHistory.prototype, "getNextStageWithHistory", true)
48641
48603
  function StageHistory.prototype.getStageHistory(self)
@@ -51137,8 +51099,6 @@ local ____ReadonlySet = require("types.ReadonlySet")
51137
51099
  local ReadonlySet = ____ReadonlySet.ReadonlySet
51138
51100
  local ____entitiesSpecific = require("functions.entitiesSpecific")
51139
51101
  local getNPCs = ____entitiesSpecific.getNPCs
51140
- local ____types = require("functions.types")
51141
- local asNumber = ____types.asNumber
51142
51102
  --- Checks for specific NPCs that have "CanShutDoors" set to true naturally by the game, but should
51143
51103
  -- not actually keep the doors closed (like Death's scythes).
51144
51104
  function ____exports.isAliveExceptionNPC(self, npc)
@@ -51177,20 +51137,20 @@ end
51177
51137
  -- `NPCState.SPECIAL`, spit out their head, and then slowly fade away while shooting a burst of
51178
51138
  -- tears.
51179
51139
  function ____exports.isDyingDump(self, npc)
51180
- return npc.Type == EntityType.DUMP and npc.Variant == asNumber(nil, DumpVariant.DUMP) and npc.State == NPCState.SPECIAL
51140
+ return npc.Type == EntityType.DUMP and npc.Variant == DumpVariant.DUMP and npc.State == NPCState.SPECIAL
51181
51141
  end
51182
51142
  --- Helper function to detect the custom death state of an Eggy. Eggies are never actually marked
51183
51143
  -- dead by the game. Instead, when Eggies take fatal damage, they go into NPCState.STATE_SUICIDE and
51184
51144
  -- spawn 14 Swarm Spiders while their StateFrame ticks upwards.
51185
51145
  function ____exports.isDyingEggyWithNoSpidersLeft(self, npc)
51186
- 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
51146
+ return npc.Type == EntityType.HOPPER and npc.Variant == HopperVariant.EGGY and npc.State == NPCState.SUICIDE and npc.StateFrame >= EGGY_STATE_FRAME_OF_FINAL_SPIDER
51187
51147
  end
51188
51148
  --- Helper function to detect the custom death state of a Rag Man Ragling. When Rag Man Raglings die,
51189
51149
  -- they turn into a patch on the ground and can be revived by Rag Man at a later time. This causes
51190
51150
  -- them to show up as an "alive" enemy, so they should usually be filtered out of lists of alive
51191
51151
  -- enemies.
51192
51152
  function ____exports.isRaglingDeathPatch(self, npc)
51193
- return npc.Type == EntityType.RAGLING and npc.Variant == asNumber(nil, RaglingVariant.RAG_MANS_RAGLING) and npc.State == NPCState.SPECIAL
51153
+ return npc.Type == EntityType.RAGLING and npc.Variant == RaglingVariant.RAG_MANS_RAGLING and npc.State == NPCState.SPECIAL
51194
51154
  end
51195
51155
  NON_ALIVE_NPCS_TYPE_VARIANT = __TS__New(
51196
51156
  ReadonlySet,
@@ -51298,8 +51258,6 @@ local isRNG = ____rng.isRNG
51298
51258
  local ____rooms = require("functions.rooms")
51299
51259
  local inBeastRoom = ____rooms.inBeastRoom
51300
51260
  local inDogmaRoom = ____rooms.inDogmaRoom
51301
- local ____types = require("functions.types")
51302
- local asNumber = ____types.asNumber
51303
51261
  local ____utils = require("functions.utils")
51304
51262
  local ____repeat = ____utils["repeat"]
51305
51263
  local BOSSES_THAT_REQUIRE_MULTIPLE_SPAWNS = __TS__New(ReadonlySet, {
@@ -51476,7 +51434,7 @@ local function getNumBossSegments(self, entityType, variant, numSegments)
51476
51434
  ____cond22 = ____cond22 or ____switch22 == EntityType.LOKI
51477
51435
  if ____cond22 then
51478
51436
  do
51479
- return variant == asNumber(nil, LokiVariant.LOKII) and 2 or 1
51437
+ return variant == LokiVariant.LOKII and 2 or 1
51480
51438
  end
51481
51439
  end
51482
51440
  ____cond22 = ____cond22 or ____switch22 == EntityType.GURGLING
@@ -52329,8 +52287,6 @@ local ____sound = require("functions.sound")
52329
52287
  local getMusicForStage = ____sound.getMusicForStage
52330
52288
  local ____stage = require("functions.stage")
52331
52289
  local setStage = ____stage.setStage
52332
- local ____types = require("functions.types")
52333
- local asNumber = ____types.asNumber
52334
52290
  local ____utils = require("functions.utils")
52335
52291
  local assertDefined = ____utils.assertDefined
52336
52292
  local ____Feature = require("classes.private.Feature")
@@ -52656,7 +52612,7 @@ function CustomStages.prototype.setCustomStage(self, name, firstFloor, streakTex
52656
52612
  baseStage = baseStage + 1
52657
52613
  end
52658
52614
  local baseStageType = customStage.baseStageType == nil and DEFAULT_BASE_STAGE_TYPE or customStage.baseStageType
52659
- local reseed = asNumber(nil, stage) >= baseStage
52615
+ local reseed = stage >= baseStage
52660
52616
  setStage(nil, baseStage, baseStageType, reseed)
52661
52617
  musicManager:Disable()
52662
52618
  self:setStageRoomsData(customStage, rng, verbose)
@@ -54647,7 +54603,6 @@ local ____spawnCollectible = require("functions.spawnCollectible")
54647
54603
  local spawnCollectible = ____spawnCollectible.spawnCollectible
54648
54604
  local ____types = require("functions.types")
54649
54605
  local asCollectibleType = ____types.asCollectibleType
54650
- local asNumber = ____types.asNumber
54651
54606
  local ____utils = require("functions.utils")
54652
54607
  local assertDefined = ____utils.assertDefined
54653
54608
  local ____ReadonlySet = require("types.ReadonlySet")
@@ -54872,11 +54827,12 @@ function DeployJSONRoom.prototype.spawnNormalEntityForJSONRoom(self, entityType,
54872
54827
  local position = gridCoordinatesToWorldPosition(nil, x, y)
54873
54828
  local seed = rng:Next()
54874
54829
  local entity
54875
- if entityType == EntityType.PICKUP and variant == asNumber(nil, PickupVariant.COLLECTIBLE) then
54830
+ if entityType == EntityType.PICKUP and variant == PickupVariant.COLLECTIBLE then
54831
+ local collectibleType = asCollectibleType(nil, subType)
54876
54832
  local options = roomType == RoomType.ANGEL
54877
54833
  entity = spawnCollectible(
54878
54834
  nil,
54879
- asCollectibleType(nil, subType),
54835
+ collectibleType,
54880
54836
  position,
54881
54837
  seed,
54882
54838
  options
@@ -54891,7 +54847,7 @@ function DeployJSONRoom.prototype.spawnNormalEntityForJSONRoom(self, entityType,
54891
54847
  seed
54892
54848
  )
54893
54849
  end
54894
- if entityType == EntityType.PITFALL and variant == asNumber(nil, PitfallVariant.PITFALL) then
54850
+ if entityType == EntityType.PITFALL and variant == PitfallVariant.PITFALL then
54895
54851
  entity.EntityCollisionClass = EntityCollisionClass.ENEMIES
54896
54852
  entity.GridCollisionClass = EntityGridCollisionClass.WALLS
54897
54853
  end
@@ -60150,7 +60106,6 @@ local getMapPartialMatch = ____string.getMapPartialMatch
60150
60106
  local ____trinkets = require("functions.trinkets")
60151
60107
  local getGoldenTrinketType = ____trinkets.getGoldenTrinketType
60152
60108
  local ____types = require("functions.types")
60153
- local asCardType = ____types.asCardType
60154
60109
  local asCollectibleType = ____types.asCollectibleType
60155
60110
  local asTrinketType = ____types.asTrinketType
60156
60111
  local ____utils = require("functions.utils")
@@ -60579,11 +60534,7 @@ function ____exports.cards(self)
60579
60534
  return
60580
60535
  end
60581
60536
  local worldPosition = gridCoordinatesToWorldPosition(nil, x, y)
60582
- spawnCard(
60583
- nil,
60584
- asCardType(nil, cardType),
60585
- worldPosition
60586
- )
60537
+ spawnCard(nil, cardType, worldPosition)
60587
60538
  cardType = cardType + 1
60588
60539
  x = x + 1
60589
60540
  end