isaacscript-common 1.0.511 → 1.0.515

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 (125) hide show
  1. package/dist/callbacks/itemPickup.lua +6 -2
  2. package/dist/callbacks/postBombInitLate.lua +5 -1
  3. package/dist/callbacks/postCursedTeleport.lua +10 -8
  4. package/dist/callbacks/postEffectInitLate.lua +5 -1
  5. package/dist/callbacks/postEsauJr.lua +4 -2
  6. package/dist/callbacks/postFamiliarInitLate.lua +5 -1
  7. package/dist/callbacks/postFlip.lua +4 -2
  8. package/dist/callbacks/postGridEntity.lua +18 -8
  9. package/dist/callbacks/postKnifeInitLate.lua +5 -1
  10. package/dist/callbacks/postLaserInitLate.lua +5 -1
  11. package/dist/callbacks/postNPCInitLate.lua +5 -1
  12. package/dist/callbacks/postPickupCollect.lua +5 -1
  13. package/dist/callbacks/postPickupInitLate.lua +5 -1
  14. package/dist/callbacks/postPlayerChangeHealth.lua +13 -9
  15. package/dist/callbacks/postPlayerChangeType.lua +5 -1
  16. package/dist/callbacks/postPlayerFatalDamage.lua +2 -2
  17. package/dist/callbacks/postPlayerInitLate.lua +5 -1
  18. package/dist/callbacks/postPlayerReordered.lua +1 -1
  19. package/dist/callbacks/postProjectileInitLate.lua +5 -1
  20. package/dist/callbacks/postPurchase.lua +15 -17
  21. package/dist/callbacks/postSacrifice.lua +3 -3
  22. package/dist/callbacks/postSlotInitUpdate.lua +11 -3
  23. package/dist/callbacks/postSlotRenderBroken.lua +8 -2
  24. package/dist/callbacks/postTearInitLate.lua +5 -1
  25. package/dist/callbacks/postTransformation.lua +5 -1
  26. package/dist/callbacks/reorderedCallbacks.lua +4 -4
  27. package/dist/callbacks/subscriptions/postBombInitLate.lua +3 -3
  28. package/dist/callbacks/subscriptions/postCursedTeleport.lua +1 -1
  29. package/dist/callbacks/subscriptions/postCustomRevive.lua +3 -3
  30. package/dist/callbacks/subscriptions/postEffectInitLate.lua +3 -3
  31. package/dist/callbacks/subscriptions/postEsauJr.lua +1 -1
  32. package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +3 -3
  33. package/dist/callbacks/subscriptions/postFirstEsauJr.lua +1 -1
  34. package/dist/callbacks/subscriptions/postFirstFlip.lua +1 -1
  35. package/dist/callbacks/subscriptions/postFlip.lua +1 -1
  36. package/dist/callbacks/subscriptions/postGameStartedReordered.lua +1 -1
  37. package/dist/callbacks/subscriptions/postGridEntityInit.lua +3 -3
  38. package/dist/callbacks/subscriptions/postGridEntityRemove.lua +3 -3
  39. package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +3 -3
  40. package/dist/callbacks/subscriptions/postItemPickup.lua +5 -5
  41. package/dist/callbacks/subscriptions/postKnifeInitLate.lua +3 -3
  42. package/dist/callbacks/subscriptions/postLaserInitLate.lua +3 -3
  43. package/dist/callbacks/subscriptions/postNPCInitLate.lua +3 -3
  44. package/dist/callbacks/subscriptions/postNewLevelReordered.lua +1 -1
  45. package/dist/callbacks/subscriptions/postNewRoomEarly.lua +1 -1
  46. package/dist/callbacks/subscriptions/postNewRoomReordered.lua +1 -1
  47. package/dist/callbacks/subscriptions/postPickupCollect.lua +3 -3
  48. package/dist/callbacks/subscriptions/postPickupInitLate.lua +3 -3
  49. package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +3 -3
  50. package/dist/callbacks/subscriptions/postPlayerChangeType.lua +1 -1
  51. package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +3 -3
  52. package/dist/callbacks/subscriptions/postPlayerInitLate.lua +3 -3
  53. package/dist/callbacks/subscriptions/postPlayerInitReordered.lua +3 -3
  54. package/dist/callbacks/subscriptions/postPlayerRenderReordered.lua +3 -3
  55. package/dist/callbacks/subscriptions/postPlayerUpdateReordered.lua +3 -3
  56. package/dist/callbacks/subscriptions/postProjectileInitLate.lua +3 -3
  57. package/dist/callbacks/subscriptions/postPurchase.lua +2 -8
  58. package/dist/callbacks/subscriptions/postSacrifice.lua +1 -1
  59. package/dist/callbacks/subscriptions/postSlotDestroyed.lua +3 -3
  60. package/dist/callbacks/subscriptions/postSlotInit.lua +3 -3
  61. package/dist/callbacks/subscriptions/postSlotRender.lua +3 -3
  62. package/dist/callbacks/subscriptions/postSlotUpdate.lua +3 -3
  63. package/dist/callbacks/subscriptions/postTearInitLate.lua +3 -3
  64. package/dist/callbacks/subscriptions/postTransformation.lua +3 -3
  65. package/dist/callbacks/subscriptions/preCustomRevive.lua +1 -1
  66. package/dist/callbacks/subscriptions/preItemPickup.lua +5 -5
  67. package/dist/constants.lua +5 -47
  68. package/dist/features/deployJSONRoom.lua +61 -90
  69. package/dist/features/disableInputs.lua +3 -9
  70. package/dist/features/forgottenSwitch.lua +1 -1
  71. package/dist/features/getCollectibleItemPoolType.lua +10 -4
  72. package/dist/features/preventCollectibleRotate.lua +9 -3
  73. package/dist/features/saveDataManager/load.lua +6 -2
  74. package/dist/features/saveDataManager/main.lua +1 -1
  75. package/dist/features/saveDataManager/merge.lua +4 -2
  76. package/dist/features/sirenHelpers.lua +5 -5
  77. package/dist/functions/array.lua +7 -5
  78. package/dist/functions/bitwise.lua +1 -1
  79. package/dist/functions/charge.lua +12 -10
  80. package/dist/functions/collectibles.lua +23 -18
  81. package/dist/functions/color.lua +1 -9
  82. package/dist/functions/deepCopy.lua +22 -42
  83. package/dist/functions/deepCopyTests.lua +20 -12
  84. package/dist/functions/doors.lua +19 -7
  85. package/dist/functions/entity.lua +2 -8
  86. package/dist/functions/flag.lua +1 -1
  87. package/dist/functions/gridEntity.lua +9 -14
  88. package/dist/functions/input.lua +18 -14
  89. package/dist/functions/jsonRoom.lua +9 -3
  90. package/dist/functions/language.lua +1 -9
  91. package/dist/functions/log.lua +46 -18
  92. package/dist/functions/math.lua +17 -15
  93. package/dist/functions/npc.lua +17 -15
  94. package/dist/functions/pickups.lua +1 -14
  95. package/dist/functions/player.lua +47 -25
  96. package/dist/functions/playerHealth.lua +9 -19
  97. package/dist/functions/pocketItems.lua +4 -4
  98. package/dist/functions/random.lua +2 -2
  99. package/dist/functions/revive.lua +4 -4
  100. package/dist/functions/rooms.d.ts +14 -1
  101. package/dist/functions/rooms.lua +77 -17
  102. package/dist/functions/spawnCollectible.lua +2 -10
  103. package/dist/functions/sprite.lua +2 -2
  104. package/dist/functions/stage.lua +6 -6
  105. package/dist/functions/tears.lua +1 -1
  106. package/dist/functions/transformations.lua +10 -4
  107. package/dist/functions/trinketGive.lua +2 -2
  108. package/dist/functions/trinkets.lua +5 -3
  109. package/dist/functions/ui.lua +3 -3
  110. package/dist/functions/util.lua +8 -4
  111. package/dist/functions/vector.lua +8 -8
  112. package/dist/lualib_bundle.lua +555 -603
  113. package/dist/maps/cardDescriptionMap.lua +1 -99
  114. package/dist/maps/cardNameMap.lua +1 -99
  115. package/dist/maps/collectibleDescriptionMap.lua +1 -722
  116. package/dist/maps/collectibleNameMap.lua +1 -722
  117. package/dist/maps/gridEntityXMLMap.lua +1 -36
  118. package/dist/maps/pillEffectNameMap.lua +1 -52
  119. package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +1 -7
  120. package/dist/maps/transformationMap.lua +12 -19
  121. package/dist/maps/trinketDescriptionMap.lua +1 -190
  122. package/dist/maps/trinketNameMap.lua +1 -190
  123. package/dist/sets/cards.lua +2 -98
  124. package/dist/types/ModUpgraded.lua +50 -44
  125. package/package.json +2 -2
@@ -5,6 +5,7 @@
5
5
  * do not forget to set the LeaveDoor property.
6
6
  */
7
7
  export declare function changeRoom(roomGridIndex: int): void;
8
+ export declare function getAllRoomGridIndexes(): int[];
8
9
  export declare function getCurrentDimension(): Dimension;
9
10
  export declare function getRoomData(): RoomConfig | undefined;
10
11
  /**
@@ -45,7 +46,7 @@ export declare function getRoomSafeGridIndex(): int;
45
46
  *
46
47
  * This function only searches through rooms in the current dimension.
47
48
  */
48
- export declare function getRoomGridIndexesForType(roomType: RoomType): Set<int>;
49
+ export declare function getRoomGridIndexesForType(roomType: RoomType): int[];
49
50
  /**
50
51
  * Helper function to get the item pool type for the current room. For example, this returns
51
52
  * `ItemPoolType.ItemPoolType.POOL_ANGEL` if you are in an Angel Room.
@@ -121,12 +122,24 @@ export declare function inDimension(dimension: Dimension): boolean;
121
122
  /** Helper function to determine if the current room shape is one of the four L room shapes. */
122
123
  export declare function inLRoom(): boolean;
123
124
  export declare function inGenesisRoom(): boolean;
125
+ /**
126
+ * Helper function to check if the current room is a miniboss room for a particular miniboss. This
127
+ * will only work for minibosses that have dedicated boss rooms in the "00.special rooms.stb" file.
128
+ */
129
+ export declare function inMinibossRoomOf(minibossID: MinibossID): boolean;
124
130
  /**
125
131
  * Helper function to determine whether or not the current room is the starting room of a floor.
126
132
  * Only returns true for the starting room of the primary dimension (meaning that being in the
127
133
  * starting room of the mirror world does not count).
128
134
  */
129
135
  export declare function inStartingRoom(): boolean;
136
+ /**
137
+ * Helper function to loop through every room on the floor and see if it has been cleared.
138
+ *
139
+ * @param onlyCheckRoomTypes Optional. A whitelist of room types. Room types not in the provided
140
+ * array will be ignored. If not specified, then all rooms will be checked. Undefined by default.
141
+ */
142
+ export declare function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean;
130
143
  /**
131
144
  * Helper function to determine whether or not the current room is part of the floor layout. For
132
145
  * example, Devil Rooms and the Mega Satan room are not considered to be inside the map.
@@ -47,7 +47,7 @@ end
47
47
  function ____exports.inDeathCertificateArea(self)
48
48
  local roomStageID = ____exports.getRoomStageID(nil)
49
49
  local roomSubType = ____exports.getRoomSubType(nil)
50
- return roomStageID == 35 and (roomSubType == 33 or roomSubType == 33)
50
+ return (roomStageID == 35) and ((roomSubType == 33) or (roomSubType == 33))
51
51
  end
52
52
  function ____exports.changeRoom(self, roomGridIndex)
53
53
  local game = Game()
@@ -55,6 +55,23 @@ function ____exports.changeRoom(self, roomGridIndex)
55
55
  level.LeaveDoor = -1
56
56
  game:ChangeRoom(roomGridIndex)
57
57
  end
58
+ function ____exports.getAllRoomGridIndexes(self)
59
+ local game = Game()
60
+ local level = game:GetLevel()
61
+ local rooms = level:GetRooms()
62
+ local allRoomGridIndexes = {}
63
+ do
64
+ local i = 0
65
+ while i < rooms.Size do
66
+ local roomDesc = rooms:Get(i)
67
+ if roomDesc ~= nil then
68
+ __TS__ArrayPush(allRoomGridIndexes, roomDesc.SafeGridIndex)
69
+ end
70
+ i = i + 1
71
+ end
72
+ end
73
+ return allRoomGridIndexes
74
+ end
58
75
  function ____exports.getCurrentDimension(self)
59
76
  local game = Game()
60
77
  local level = game:GetLevel()
@@ -75,7 +92,9 @@ function ____exports.getCurrentDimension(self)
75
92
  dimension = dimension + 1
76
93
  end
77
94
  end
78
- error("Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex))
95
+ error(
96
+ "Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomGridIndex)
97
+ )
79
98
  return 0
80
99
  end
81
100
  function ____exports.getRoomDataType(self)
@@ -94,13 +113,13 @@ end
94
113
  function ____exports.getRoomGridIndexesForType(self, roomType)
95
114
  local game = Game()
96
115
  local level = game:GetLevel()
97
- local roomGridIndexes = __TS__New(Set)
116
+ local roomGridIndexes = {}
98
117
  do
99
118
  local i = 0
100
119
  while i <= MAX_ROOM_INDEX do
101
120
  local room = level:GetRoomByIdx(i)
102
- if room ~= nil and room.Data ~= nil and room.Data.Type == roomType then
103
- roomGridIndexes:add(room.SafeGridIndex)
121
+ if ((room ~= nil) and (room.Data ~= nil)) and (room.Data.Type == roomType) then
122
+ __TS__ArrayPush(roomGridIndexes, room.SafeGridIndex)
104
123
  end
105
124
  i = i + 1
106
125
  end
@@ -140,26 +159,26 @@ function ____exports.gridToPos(self, x, y)
140
159
  local room = game:GetRoom()
141
160
  x = x + 1
142
161
  y = y + 1
143
- local gridIndex = y * room:GetGridWidth() + x
162
+ local gridIndex = (y * room:GetGridWidth()) + x
144
163
  return room:GetGridPosition(gridIndex)
145
164
  end
146
165
  function ____exports.in2x1Room(self)
147
166
  local game = Game()
148
167
  local room = game:GetRoom()
149
168
  local roomShape = room:GetRoomShape()
150
- return roomShape == RoomShape.ROOMSHAPE_1x2 or roomShape == RoomShape.ROOMSHAPE_2x1
169
+ return (roomShape == RoomShape.ROOMSHAPE_1x2) or (roomShape == RoomShape.ROOMSHAPE_2x1)
151
170
  end
152
171
  function ____exports.inAngelShop(self)
153
172
  local game = Game()
154
173
  local room = game:GetRoom()
155
174
  local roomType = room:GetType()
156
175
  local roomSubType = ____exports.getRoomSubType(nil)
157
- return roomType == RoomType.ROOM_ANGEL and roomSubType == 1
176
+ return (roomType == RoomType.ROOM_ANGEL) and (roomSubType == 1)
158
177
  end
159
178
  function ____exports.inBeastRoom(self)
160
179
  local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
161
180
  local roomSubType = ____exports.getRoomSubType(nil)
162
- return roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX and roomSubType == 4
181
+ return (roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX) and (roomSubType == 4)
163
182
  end
164
183
  function ____exports.inBossRoomOf(self, bossID)
165
184
  local game = Game()
@@ -167,12 +186,12 @@ function ____exports.inBossRoomOf(self, bossID)
167
186
  local roomType = room:GetType()
168
187
  local roomStageID = ____exports.getRoomStageID(nil)
169
188
  local roomSubType = ____exports.getRoomSubType(nil)
170
- return roomType == RoomType.ROOM_BOSS and roomStageID == 0 and roomSubType == bossID
189
+ return ((roomType == RoomType.ROOM_BOSS) and (roomStageID == 0)) and (roomSubType == bossID)
171
190
  end
172
191
  function ____exports.inCrawlspace(self)
173
192
  local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
174
193
  local roomSubType = ____exports.getRoomSubType(nil)
175
- return roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX and roomSubType ~= 4
194
+ return (roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX) and (roomSubType ~= 4)
176
195
  end
177
196
  function ____exports.inDevilsCrownTreasureRoom(self)
178
197
  local game = Game()
@@ -187,7 +206,7 @@ function ____exports.inLRoom(self)
187
206
  local game = Game()
188
207
  local room = game:GetRoom()
189
208
  local roomShape = room:GetRoomShape()
190
- return roomShape == RoomShape.ROOMSHAPE_LTL or roomShape == RoomShape.ROOMSHAPE_LTR or roomShape == RoomShape.ROOMSHAPE_LBL or roomShape == RoomShape.ROOMSHAPE_LBR
209
+ return (((roomShape == RoomShape.ROOMSHAPE_LTL) or (roomShape == RoomShape.ROOMSHAPE_LTR)) or (roomShape == RoomShape.ROOMSHAPE_LBL)) or (roomShape == RoomShape.ROOMSHAPE_LBR)
191
210
  end
192
211
  function ____exports.inGenesisRoom(self)
193
212
  local game = Game()
@@ -195,14 +214,53 @@ function ____exports.inGenesisRoom(self)
195
214
  local roomType = room:GetType()
196
215
  local roomVariant = ____exports.getRoomVariant(nil)
197
216
  local roomSubType = ____exports.getRoomSubType(nil)
198
- return roomType == RoomType.ROOM_ISAACS and roomVariant == GENESIS_ROOM_VARIANT and roomSubType == GENESIS_ROOM_SUBTYPE
217
+ return ((roomType == RoomType.ROOM_ISAACS) and (roomVariant == GENESIS_ROOM_VARIANT)) and (roomSubType == GENESIS_ROOM_SUBTYPE)
218
+ end
219
+ function ____exports.inMinibossRoomOf(self, minibossID)
220
+ local game = Game()
221
+ local room = game:GetRoom()
222
+ local roomType = room:GetType()
223
+ local roomStageID = ____exports.getRoomStageID(nil)
224
+ local roomSubType = ____exports.getRoomSubType(nil)
225
+ return ((roomType == RoomType.ROOM_MINIBOSS) and (roomStageID == 0)) and (roomSubType == minibossID)
199
226
  end
200
227
  function ____exports.inStartingRoom(self)
201
228
  local game = Game()
202
229
  local level = game:GetLevel()
203
230
  local startingRoomGridIndex = level:GetStartingRoomIndex()
204
231
  local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
205
- return roomSafeGridIndex == startingRoomGridIndex and ____exports.inDimension(nil, 0)
232
+ return (roomSafeGridIndex == startingRoomGridIndex) and ____exports.inDimension(nil, 0)
233
+ end
234
+ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
235
+ local game = Game()
236
+ local level = game:GetLevel()
237
+ local rooms = level:GetRooms()
238
+ local roomTypeWhitelist = (((onlyCheckRoomTypes == nil) and (function() return nil end)) or (function() return __TS__New(Set, onlyCheckRoomTypes) end))()
239
+ do
240
+ local i = 0
241
+ while i < rooms.Size do
242
+ do
243
+ local roomDesc = rooms:Get(i)
244
+ if roomDesc == nil then
245
+ goto __continue42
246
+ end
247
+ local roomData = roomDesc.Data
248
+ if roomData == nil then
249
+ goto __continue42
250
+ end
251
+ local roomType = roomData.Type
252
+ if (roomTypeWhitelist ~= nil) and (not roomTypeWhitelist:has(roomType)) then
253
+ goto __continue42
254
+ end
255
+ if not roomDesc.Clear then
256
+ return false
257
+ end
258
+ end
259
+ ::__continue42::
260
+ i = i + 1
261
+ end
262
+ end
263
+ return true
206
264
  end
207
265
  function ____exports.isRoomInsideMap(self)
208
266
  local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
@@ -227,17 +285,19 @@ function ____exports.setRoomCleared(self)
227
285
  return
228
286
  end
229
287
  room:SetClear(true)
230
- for ____, door in ipairs(getDoors(nil)) do
288
+ for ____, door in ipairs(
289
+ getDoors(nil)
290
+ ) do
231
291
  do
232
292
  if isHiddenSecretRoomDoor(nil, door) then
233
- goto __continue41
293
+ goto __continue51
234
294
  end
235
295
  door.State = DoorState.STATE_OPEN
236
296
  local sprite = door:GetSprite()
237
297
  sprite:Play("Opened", true)
238
298
  door.ExtraVisible = false
239
299
  end
240
- ::__continue41::
300
+ ::__continue51::
241
301
  end
242
302
  sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
243
303
  game:ShakeScreen(0)
@@ -22,22 +22,14 @@ function ____exports.spawnCollectible(self, collectibleType, position, seed, opt
22
22
  error("Failed to spawn a collectible since the provided seed was 0, which is not allowed. (It will cause the game to crash.)")
23
23
  end
24
24
  local game = Game()
25
- local collectible = game:Spawn(
26
- EntityType.ENTITY_PICKUP,
27
- PickupVariant.PICKUP_COLLECTIBLE,
28
- position,
29
- Vector.Zero,
30
- nil,
31
- collectibleType,
32
- seed
33
- ):ToPickup()
25
+ local collectible = game:Spawn(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, position, Vector.Zero, nil, collectibleType, seed):ToPickup()
34
26
  if collectible == nil then
35
27
  error("Failed to spawn a collectible.")
36
28
  end
37
29
  if options then
38
30
  collectible.OptionsPickupIndex = 1
39
31
  end
40
- if anyPlayerIs(nil, PlayerType.PLAYER_KEEPER_B) and not isQuestCollectible(nil, collectibleType) and not forceFreeItem then
32
+ if (anyPlayerIs(nil, PlayerType.PLAYER_KEEPER_B) and (not isQuestCollectible(nil, collectibleType))) and (not forceFreeItem) then
41
33
  collectible.ShopItemId = -1
42
34
  collectible.Price = 15
43
35
  end
@@ -12,12 +12,12 @@ end
12
12
  function ____exports.getFinalFrameOfAnimation(self, sprite, animation)
13
13
  local currentAnimation = sprite:GetAnimation()
14
14
  local currentFrame = sprite:GetFrame()
15
- if animation ~= nil and animation ~= currentAnimation then
15
+ if (animation ~= nil) and (animation ~= currentAnimation) then
16
16
  sprite:SetAnimation(animation)
17
17
  end
18
18
  sprite:SetLastFrame()
19
19
  local finalFrame = sprite:GetFrame()
20
- if animation ~= nil and animation ~= currentAnimation then
20
+ if (animation ~= nil) and (animation ~= currentAnimation) then
21
21
  sprite:Play(currentAnimation, true)
22
22
  end
23
23
  sprite:SetFrame(currentFrame)
@@ -4,7 +4,7 @@ function ____exports.onRepentanceStage(self)
4
4
  local game = Game()
5
5
  local level = game:GetLevel()
6
6
  local stageType = level:GetStageType()
7
- return stageType == StageType.STAGETYPE_REPENTANCE or stageType == StageType.STAGETYPE_REPENTANCE_B
7
+ return (stageType == StageType.STAGETYPE_REPENTANCE) or (stageType == StageType.STAGETYPE_REPENTANCE_B)
8
8
  end
9
9
  function ____exports.getEffectiveStage(self)
10
10
  local game = Game()
@@ -20,33 +20,33 @@ function ____exports.onCathedral(self)
20
20
  local level = game:GetLevel()
21
21
  local stage = level:GetStage()
22
22
  local stageType = level:GetStageType()
23
- return stage == 10 and stageType == 1
23
+ return (stage == 10) and (stageType == 1)
24
24
  end
25
25
  function ____exports.onChest(self)
26
26
  local game = Game()
27
27
  local level = game:GetLevel()
28
28
  local stage = level:GetStage()
29
29
  local stageType = level:GetStageType()
30
- return stage == 11 and stageType == 1
30
+ return (stage == 11) and (stageType == 1)
31
31
  end
32
32
  function ____exports.onDarkRoom(self)
33
33
  local game = Game()
34
34
  local level = game:GetLevel()
35
35
  local stage = level:GetStage()
36
36
  local stageType = level:GetStageType()
37
- return stage == 11 and stageType == 0
37
+ return (stage == 11) and (stageType == 0)
38
38
  end
39
39
  function ____exports.onFinalFloor(self)
40
40
  local game = Game()
41
41
  local level = game:GetLevel()
42
42
  local stage = level:GetStage()
43
- return stage == 11 or stage == 12 or stage == 13 or stage == 8 and ____exports.onRepentanceStage(nil)
43
+ return (((stage == 11) or (stage == 12)) or (stage == 13)) or ((stage == 8) and ____exports.onRepentanceStage(nil))
44
44
  end
45
45
  function ____exports.onSheol(self)
46
46
  local game = Game()
47
47
  local level = game:GetLevel()
48
48
  local stage = level:GetStage()
49
49
  local stageType = level:GetStageType()
50
- return stage == 10 and stageType == 0
50
+ return (stage == 10) and (stageType == 0)
51
51
  end
52
52
  return ____exports
@@ -1,7 +1,7 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
3
  function ____exports.getFireDelay(self, tearsStat)
4
- return math.max(30 / tearsStat - 1, -0.9999)
4
+ return math.max((30 / tearsStat) - 1, -0.9999)
5
5
  end
6
6
  function ____exports.getTearsStat(self, fireDelay)
7
7
  return 30 / (fireDelay + 1)
@@ -9,20 +9,26 @@ local ____util = require("functions.util")
9
9
  local copySet = ____util.copySet
10
10
  function ____exports.getPlayerNumTransformationCollectibles(self, player, playerForm)
11
11
  if TRANSFORMATIONS_NOT_BASED_ON_ITEMS:has(playerForm) then
12
- error(("The transformation of " .. tostring(playerForm)) .. " cannot be tracked by this function.")
12
+ error(
13
+ ("The transformation of " .. tostring(playerForm)) .. " cannot be tracked by this function."
14
+ )
13
15
  end
14
16
  local itemsForTransformation = TRANSFORMATION_TO_ITEMS_MAP:get(playerForm)
15
17
  if itemsForTransformation == nil then
16
- error(("The transformation of " .. tostring(playerForm)) .. " is not a valid value of the PlayerForm enum.")
18
+ error(
19
+ ("The transformation of " .. tostring(playerForm)) .. " is not a valid value of the PlayerForm enum."
20
+ )
17
21
  end
18
22
  local numCollectibles = 0
19
- for ____, collectibleType in __TS__Iterator(itemsForTransformation:values()) do
23
+ for ____, collectibleType in __TS__Iterator(
24
+ itemsForTransformation:values()
25
+ ) do
20
26
  numCollectibles = numCollectibles + player:GetCollectibleNum(collectibleType)
21
27
  end
22
28
  return numCollectibles
23
29
  end
24
30
  function ____exports.getTransformationsForItem(self, collectibleType)
25
31
  local transformations = ITEM_TO_TRANSFORMATION_MAP:get(collectibleType)
26
- return transformations == nil and __TS__New(Set) or copySet(nil, transformations)
32
+ return ((transformations == nil) and __TS__New(Set)) or copySet(nil, transformations)
27
33
  end
28
34
  return ____exports
@@ -14,11 +14,11 @@ function ____exports.temporarilyRemoveTrinkets(self, player, trinketType)
14
14
  numTrinkets = numTrinkets + 1
15
15
  end
16
16
  local numSmeltedTrinkets = numTrinkets
17
- local trinketWasInSlot1 = trinket1 == trinketType or trinket1 + GOLDEN_TRINKET_SHIFT == trinketType
17
+ local trinketWasInSlot1 = (trinket1 == trinketType) or ((trinket1 + GOLDEN_TRINKET_SHIFT) == trinketType)
18
18
  if trinketWasInSlot1 then
19
19
  numSmeltedTrinkets = numSmeltedTrinkets - 1
20
20
  end
21
- local trinketWasInSlot2 = trinket2 == trinketType or trinket2 + GOLDEN_TRINKET_SHIFT == trinketType
21
+ local trinketWasInSlot2 = (trinket2 == trinketType) or ((trinket2 + GOLDEN_TRINKET_SHIFT) == trinketType)
22
22
  if trinketWasInSlot2 then
23
23
  numSmeltedTrinkets = numSmeltedTrinkets - 1
24
24
  end
@@ -16,15 +16,17 @@ function ____exports.getOpenTrinketSlot(self, player)
16
16
  local trinket0 = player:GetTrinket(0)
17
17
  local trinket1 = player:GetTrinket(1)
18
18
  if maxTrinkets == 1 then
19
- return trinket0 == TrinketType.TRINKET_NULL and 0 or nil
19
+ return ((trinket0 == TrinketType.TRINKET_NULL) and 0) or nil
20
20
  end
21
21
  if maxTrinkets == 2 then
22
22
  if trinket0 == TrinketType.TRINKET_NULL then
23
23
  return 0
24
24
  end
25
- return trinket1 == TrinketType.TRINKET_NULL and 1 or nil
25
+ return ((trinket1 == TrinketType.TRINKET_NULL) and 1) or nil
26
26
  end
27
- error("The player has an unknown number of trinket slots: " .. tostring(maxTrinkets))
27
+ error(
28
+ "The player has an unknown number of trinket slots: " .. tostring(maxTrinkets)
29
+ )
28
30
  return nil
29
31
  end
30
32
  function ____exports.getTrinkets(self, matchingSubType)
@@ -16,14 +16,14 @@ function ____exports.getHeartsUIWidth(self)
16
16
  local soulHearts = player:GetSoulHearts()
17
17
  local boneHearts = player:GetBoneHearts()
18
18
  local extraLives = player:GetExtraLives()
19
- local combinedHearts = maxHearts + soulHearts + boneHearts * 2
19
+ local combinedHearts = (maxHearts + soulHearts) + (boneHearts * 2)
20
20
  if combinedHearts > 12 then
21
21
  combinedHearts = 12
22
22
  end
23
23
  if curses == LevelCurse.CURSE_OF_THE_UNKNOWN then
24
24
  combinedHearts = 2
25
25
  end
26
- local width = combinedHearts / 2 * UI_HEART_WIDTH
26
+ local width = (combinedHearts / 2) * UI_HEART_WIDTH
27
27
  if extraLives > 9 then
28
28
  width = width + 20
29
29
  if player:HasCollectible(CollectibleType.COLLECTIBLE_GUPPYS_COLLAR) then
@@ -40,7 +40,7 @@ end
40
40
  function ____exports.getHUDOffsetVector(self)
41
41
  local defaultVector = Vector.Zero
42
42
  local hudOffset = math.floor(Options.HUDOffset * 10)
43
- if hudOffset < 1 or hudOffset > 10 then
43
+ if (hudOffset < 1) or (hudOffset > 10) then
44
44
  return defaultVector
45
45
  end
46
46
  local x = hudOffset * 2
@@ -4,7 +4,9 @@ local ____exports = {}
4
4
  local HEX_STRING_LENGTH = 6
5
5
  function ____exports.copySet(self, oldSet)
6
6
  local newSet = __TS__New(Set)
7
- for ____, value in __TS__Iterator(oldSet:values()) do
7
+ for ____, value in __TS__Iterator(
8
+ oldSet:values()
9
+ ) do
8
10
  newSet:add(value)
9
11
  end
10
12
  return newSet
@@ -23,7 +25,9 @@ end
23
25
  function ____exports.hexToKColor(self, hexString, alpha)
24
26
  hexString = __TS__StringReplace(hexString, "#", "")
25
27
  if #hexString ~= HEX_STRING_LENGTH then
26
- error(("Hex strings must be of length " .. tostring(HEX_STRING_LENGTH)) .. ".")
28
+ error(
29
+ ("Hex strings must be of length " .. tostring(HEX_STRING_LENGTH)) .. "."
30
+ )
27
31
  end
28
32
  local rString = __TS__StringSubstr(hexString, 0, 2)
29
33
  local R = tonumber("0x" .. rString)
@@ -45,14 +49,14 @@ function ____exports.hexToKColor(self, hexString, alpha)
45
49
  end
46
50
  function ____exports.isGreedMode(self)
47
51
  local game = Game()
48
- return game.Difficulty == Difficulty.DIFFICULTY_GREED or game.Difficulty == Difficulty.DIFFICULTY_GREEDIER
52
+ return (game.Difficulty == Difficulty.DIFFICULTY_GREED) or (game.Difficulty == Difficulty.DIFFICULTY_GREEDIER)
49
53
  end
50
54
  function ____exports.onSetSeed(self)
51
55
  local game = Game()
52
56
  local seeds = game:GetSeeds()
53
57
  local customRun = seeds:IsCustomRun()
54
58
  local challenge = Isaac.GetChallenge()
55
- return challenge == Challenge.CHALLENGE_NULL and customRun
59
+ return (challenge == Challenge.CHALLENGE_NULL) and customRun
56
60
  end
57
61
  function ____exports.printConsole(self, msg)
58
62
  Isaac.ConsoleOutput(msg .. "\n")
@@ -14,25 +14,25 @@ function ____exports.directionToVector(self, direction)
14
14
  return Vector(0, 1)
15
15
  end
16
16
  end
17
- ____cond4 = ____cond4 or ____switch4 == Direction.LEFT
17
+ ____cond4 = ____cond4 or (____switch4 == Direction.LEFT)
18
18
  if ____cond4 then
19
19
  do
20
20
  return Vector(-1, 0)
21
21
  end
22
22
  end
23
- ____cond4 = ____cond4 or ____switch4 == Direction.RIGHT
23
+ ____cond4 = ____cond4 or (____switch4 == Direction.RIGHT)
24
24
  if ____cond4 then
25
25
  do
26
26
  return Vector(1, 0)
27
27
  end
28
28
  end
29
- ____cond4 = ____cond4 or ____switch4 == Direction.UP
29
+ ____cond4 = ____cond4 or (____switch4 == Direction.UP)
30
30
  if ____cond4 then
31
31
  do
32
32
  return Vector(0, -1)
33
33
  end
34
34
  end
35
- ____cond4 = ____cond4 or ____switch4 == Direction.NO_DIRECTION
35
+ ____cond4 = ____cond4 or (____switch4 == Direction.NO_DIRECTION)
36
36
  if ____cond4 then
37
37
  do
38
38
  return Vector.Zero
@@ -66,16 +66,16 @@ function ____exports.isVector(self, object)
66
66
  end
67
67
  function ____exports.vectorToDirection(self, vector)
68
68
  local degrees = vector:GetAngleDegrees()
69
- if degrees > -45 and degrees < 45 then
69
+ if (degrees > -45) and (degrees < 45) then
70
70
  return Direction.RIGHT
71
71
  end
72
- if degrees >= 45 and degrees <= 135 then
72
+ if (degrees >= 45) and (degrees <= 135) then
73
73
  return Direction.DOWN
74
74
  end
75
- if degrees <= -45 and degrees >= -135 then
75
+ if (degrees <= -45) and (degrees >= -135) then
76
76
  return Direction.UP
77
77
  end
78
- if degrees > 135 or degrees < -135 then
78
+ if (degrees > 135) or (degrees < -135) then
79
79
  return Direction.LEFT
80
80
  end
81
81
  return Direction.NO_DIRECTION