isaacscript-common 1.0.488 → 1.0.492

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 (130) hide show
  1. package/README.md +2 -0
  2. package/dist/callbacks/itemPickup.lua +2 -6
  3. package/dist/callbacks/postBombInitLate.lua +6 -8
  4. package/dist/callbacks/postCursedTeleport.lua +8 -10
  5. package/dist/callbacks/postEffectInitLate.lua +6 -8
  6. package/dist/callbacks/postEsauJr.lua +2 -4
  7. package/dist/callbacks/postFamiliarInitLate.lua +6 -8
  8. package/dist/callbacks/postFlip.lua +2 -4
  9. package/dist/callbacks/postGridEntity.lua +8 -18
  10. package/dist/callbacks/postKnifeInitLate.lua +6 -8
  11. package/dist/callbacks/postLaserInitLate.lua +6 -8
  12. package/dist/callbacks/postNPCInitLate.lua +6 -8
  13. package/dist/callbacks/postPickupCollect.lua +1 -5
  14. package/dist/callbacks/postPickupInitLate.lua +6 -8
  15. package/dist/callbacks/postPlayerChangeHealth.lua +9 -13
  16. package/dist/callbacks/postPlayerChangeType.lua +1 -5
  17. package/dist/callbacks/postPlayerFatalDamage.lua +2 -2
  18. package/dist/callbacks/postPlayerInitLate.lua +1 -5
  19. package/dist/callbacks/postPlayerReordered.lua +1 -1
  20. package/dist/callbacks/postProjectileInitLate.lua +6 -8
  21. package/dist/callbacks/postPurchase.lua +10 -14
  22. package/dist/callbacks/postSacrifice.lua +3 -3
  23. package/dist/callbacks/postSlotInitUpdate.lua +3 -11
  24. package/dist/callbacks/postSlotRenderBroken.lua +2 -8
  25. package/dist/callbacks/postTearInitLate.lua +6 -8
  26. package/dist/callbacks/postTransformation.lua +1 -5
  27. package/dist/callbacks/reorderedCallbacks.lua +4 -4
  28. package/dist/callbacks/subscriptions/postBombInitLate.lua +3 -3
  29. package/dist/callbacks/subscriptions/postCursedTeleport.lua +1 -1
  30. package/dist/callbacks/subscriptions/postCustomRevive.lua +3 -3
  31. package/dist/callbacks/subscriptions/postEffectInitLate.lua +3 -3
  32. package/dist/callbacks/subscriptions/postEsauJr.lua +1 -1
  33. package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +3 -3
  34. package/dist/callbacks/subscriptions/postFirstEsauJr.lua +1 -1
  35. package/dist/callbacks/subscriptions/postFirstFlip.lua +1 -1
  36. package/dist/callbacks/subscriptions/postFlip.lua +1 -1
  37. package/dist/callbacks/subscriptions/postGameStartedReordered.lua +1 -1
  38. package/dist/callbacks/subscriptions/postGridEntityInit.lua +3 -3
  39. package/dist/callbacks/subscriptions/postGridEntityRemove.lua +3 -3
  40. package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +3 -3
  41. package/dist/callbacks/subscriptions/postItemPickup.lua +5 -5
  42. package/dist/callbacks/subscriptions/postKnifeInitLate.lua +3 -3
  43. package/dist/callbacks/subscriptions/postLaserInitLate.lua +3 -3
  44. package/dist/callbacks/subscriptions/postNPCInitLate.lua +3 -3
  45. package/dist/callbacks/subscriptions/postNewLevelReordered.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 +8 -2
  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.d.ts +9 -0
  68. package/dist/constants.lua +41 -4
  69. package/dist/features/deployJSONRoom.lua +90 -61
  70. package/dist/features/disableInputs.lua +9 -3
  71. package/dist/features/forgottenSwitch.lua +1 -1
  72. package/dist/features/getCollectibleItemPoolType.lua +10 -14
  73. package/dist/features/preventCollectibleRotate.lua +3 -9
  74. package/dist/features/saveDataManager/load.lua +2 -6
  75. package/dist/features/saveDataManager/main.lua +1 -1
  76. package/dist/features/saveDataManager/merge.lua +2 -4
  77. package/dist/features/sirenHelpers.lua +5 -5
  78. package/dist/functions/array.lua +5 -7
  79. package/dist/functions/bitwise.lua +1 -1
  80. package/dist/functions/cards.d.ts +2 -2
  81. package/dist/functions/charge.lua +10 -12
  82. package/dist/functions/collectibles.d.ts +23 -2
  83. package/dist/functions/collectibles.lua +26 -21
  84. package/dist/functions/color.lua +9 -1
  85. package/dist/functions/deepCopy.lua +45 -25
  86. package/dist/functions/deepCopyTests.lua +12 -20
  87. package/dist/functions/doors.lua +7 -19
  88. package/dist/functions/entity.lua +7 -1
  89. package/dist/functions/flag.lua +1 -1
  90. package/dist/functions/gridEntity.lua +13 -8
  91. package/dist/functions/input.lua +14 -18
  92. package/dist/functions/jsonRoom.lua +3 -9
  93. package/dist/functions/language.lua +9 -1
  94. package/dist/functions/log.lua +18 -46
  95. package/dist/functions/math.lua +15 -17
  96. package/dist/functions/npc.lua +15 -17
  97. package/dist/functions/pickups.lua +14 -1
  98. package/dist/functions/pills.d.ts +1 -1
  99. package/dist/functions/player.d.ts +12 -0
  100. package/dist/functions/player.lua +45 -59
  101. package/dist/functions/playerHealth.lua +19 -9
  102. package/dist/functions/pocketItems.lua +4 -4
  103. package/dist/functions/random.lua +2 -2
  104. package/dist/functions/revive.lua +4 -4
  105. package/dist/functions/rooms.lua +13 -17
  106. package/dist/functions/spawnCollectible.lua +10 -2
  107. package/dist/functions/sprite.lua +2 -2
  108. package/dist/functions/stage.lua +6 -6
  109. package/dist/functions/tears.lua +1 -1
  110. package/dist/functions/transformations.lua +4 -10
  111. package/dist/functions/trinketGive.lua +2 -2
  112. package/dist/functions/trinkets.d.ts +6 -2
  113. package/dist/functions/trinkets.lua +3 -5
  114. package/dist/functions/ui.lua +3 -3
  115. package/dist/functions/util.lua +4 -8
  116. package/dist/functions/vector.lua +8 -8
  117. package/dist/lualib_bundle.lua +603 -555
  118. package/dist/maps/cardDescriptionMap.lua +99 -1
  119. package/dist/maps/cardNameMap.lua +99 -1
  120. package/dist/maps/collectibleDescriptionMap.lua +722 -1
  121. package/dist/maps/collectibleNameMap.lua +722 -1
  122. package/dist/maps/gridEntityXMLMap.lua +36 -1
  123. package/dist/maps/pillEffectNameMap.lua +52 -1
  124. package/dist/maps/roomTypeToItemPoolMap.lua +15 -1
  125. package/dist/maps/transformationMap.lua +19 -12
  126. package/dist/maps/trinketDescriptionMap.lua +190 -1
  127. package/dist/maps/trinketNameMap.lua +190 -1
  128. package/dist/sets/cards.lua +98 -2
  129. package/dist/types/ModUpgraded.lua +82 -166
  130. package/package.json +5 -5
@@ -3,6 +3,8 @@ require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local EXCLUDED_CHARACTERS
5
5
  local ____constants = require("constants")
6
+ local CHARACTERS_WITH_NO_RED_HEARTS = ____constants.CHARACTERS_WITH_NO_RED_HEARTS
7
+ local CHARACTERS_WITH_NO_SOUL_HEARTS = ____constants.CHARACTERS_WITH_NO_SOUL_HEARTS
6
8
  local LOST_STYLE_PLAYER_TYPES = ____constants.LOST_STYLE_PLAYER_TYPES
7
9
  local ____HealthType = require("types.HealthType")
8
10
  local HealthType = ____HealthType.HealthType
@@ -27,18 +29,18 @@ function ____exports.getPlayers(self, performExclusions)
27
29
  do
28
30
  local player = Isaac.GetPlayer(i)
29
31
  if player == nil then
30
- goto __continue51
32
+ goto __continue53
31
33
  end
32
34
  if ____exports.isChildPlayer(nil, player) then
33
- goto __continue51
35
+ goto __continue53
34
36
  end
35
37
  local character = player:GetPlayerType()
36
38
  if performExclusions and EXCLUDED_CHARACTERS:has(character) then
37
- goto __continue51
39
+ goto __continue53
38
40
  end
39
41
  __TS__ArrayPush(players, player)
40
42
  end
41
- ::__continue51::
43
+ ::__continue53::
42
44
  i = i + 1
43
45
  end
44
46
  end
@@ -46,7 +48,7 @@ function ____exports.getPlayers(self, performExclusions)
46
48
  end
47
49
  function ____exports.getPlayerIndex(self, player)
48
50
  local character = player:GetPlayerType()
49
- local collectibleToUse = ((character == PlayerType.PLAYER_LAZARUS2_B) and CollectibleType.COLLECTIBLE_INNER_EYE) or CollectibleType.COLLECTIBLE_SAD_ONION
51
+ local collectibleToUse = character == PlayerType.PLAYER_LAZARUS2_B and CollectibleType.COLLECTIBLE_INNER_EYE or CollectibleType.COLLECTIBLE_SAD_ONION
50
52
  local collectibleRNG = player:GetCollectibleRNG(collectibleToUse)
51
53
  local seed = collectibleRNG:GetSeed()
52
54
  return seed
@@ -72,9 +74,7 @@ function ____exports.addTrinketCostume(self, player, trinketType)
72
74
  player:AddCostume(itemConfigTrinket, false)
73
75
  end
74
76
  function ____exports.anyPlayerCloserThan(self, position, distance)
75
- for ____, player in ipairs(
76
- ____exports.getPlayers(nil)
77
- ) do
77
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
78
78
  if player.Position:Distance(position) <= distance then
79
79
  return true
80
80
  end
@@ -82,9 +82,7 @@ function ____exports.anyPlayerCloserThan(self, position, distance)
82
82
  return false
83
83
  end
84
84
  function ____exports.anyPlayerHasCollectible(self, collectibleType)
85
- for ____, player in ipairs(
86
- ____exports.getPlayers(nil)
87
- ) do
85
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
88
86
  if player:HasCollectible(collectibleType) then
89
87
  return true
90
88
  end
@@ -92,9 +90,7 @@ function ____exports.anyPlayerHasCollectible(self, collectibleType)
92
90
  return false
93
91
  end
94
92
  function ____exports.anyPlayerHasTrinket(self, trinketType)
95
- for ____, player in ipairs(
96
- ____exports.getPlayers(nil)
97
- ) do
93
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
98
94
  if player:HasTrinket(trinketType) then
99
95
  return true
100
96
  end
@@ -102,9 +98,7 @@ function ____exports.anyPlayerHasTrinket(self, trinketType)
102
98
  return false
103
99
  end
104
100
  function ____exports.anyPlayerIs(self, matchingCharacter)
105
- for ____, player in ipairs(
106
- ____exports.getPlayers(nil)
107
- ) do
101
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
108
102
  local character = player:GetPlayerType()
109
103
  if character == matchingCharacter then
110
104
  return true
@@ -112,20 +106,24 @@ function ____exports.anyPlayerIs(self, matchingCharacter)
112
106
  end
113
107
  return false
114
108
  end
109
+ function ____exports.characterCanHaveRedHearts(self, character)
110
+ return not CHARACTERS_WITH_NO_RED_HEARTS:has(character)
111
+ end
112
+ function ____exports.characterCanHaveSoulHearts(self, character)
113
+ return not CHARACTERS_WITH_NO_SOUL_HEARTS:has(character)
114
+ end
115
115
  function ____exports.getAzazelBrimstoneDistance(self, playerOrTearHeight)
116
116
  local tearHeight = tonumber(playerOrTearHeight)
117
117
  if tearHeight == nil then
118
118
  local player = playerOrTearHeight
119
119
  tearHeight = player.TearHeight
120
120
  end
121
- return 32 - (2.5 * tearHeight)
121
+ return 32 - 2.5 * tearHeight
122
122
  end
123
123
  function ____exports.getClosestPlayer(self, position)
124
124
  local closestPlayer = nil
125
125
  local closestDistance = math.huge
126
- for ____, player in ipairs(
127
- ____exports.getPlayers(nil)
128
- ) do
126
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
129
127
  local distance = position:Distance(player.Position)
130
128
  if distance < closestDistance then
131
129
  closestPlayer = player
@@ -156,10 +154,10 @@ function ____exports.getLastHeart(self, player)
156
154
  local boneHearts = player:GetBoneHearts()
157
155
  local rottenHearts = player:GetRottenHearts()
158
156
  local soulHeartSlots = soulHearts / 2
159
- local lastHeartIndex = (boneHearts + soulHeartSlots) - 1
157
+ local lastHeartIndex = boneHearts + soulHeartSlots - 1
160
158
  local isLastHeartBone = player:IsBoneHeart(lastHeartIndex)
161
159
  if isLastHeartBone then
162
- local isLastContainerEmpty = hearts <= (effectiveMaxHearts - 2)
160
+ local isLastContainerEmpty = hearts <= effectiveMaxHearts - 2
163
161
  if isLastContainerEmpty then
164
162
  return HealthType.BONE
165
163
  end
@@ -191,9 +189,7 @@ end
191
189
  function ____exports.getNewestPlayer(self)
192
190
  local newestPlayer = nil
193
191
  local lowestFrame = math.huge
194
- for ____, player in ipairs(
195
- ____exports.getPlayers(nil)
196
- ) do
192
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
197
193
  if player.FrameCount < lowestFrame then
198
194
  newestPlayer = player
199
195
  lowestFrame = player.FrameCount
@@ -209,9 +205,7 @@ function ____exports.getFinalPlayer(self)
209
205
  return players[#players]
210
206
  end
211
207
  function ____exports.getPlayerCloserThan(self, position, distance)
212
- for ____, player in ipairs(
213
- ____exports.getPlayers(nil)
214
- ) do
208
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
215
209
  if player.Position:Distance(position) <= distance then
216
210
  return player
217
211
  end
@@ -221,9 +215,7 @@ end
221
215
  function ____exports.getPlayerCollectibleMap(self, player)
222
216
  local collectibleSet = getCollectibleSet(nil)
223
217
  local collectibleMap = __TS__New(Map)
224
- for ____, collectibleType in __TS__Iterator(
225
- collectibleSet:values()
226
- ) do
218
+ for ____, collectibleType in __TS__Iterator(collectibleSet:values()) do
227
219
  local collectibleNum = player:GetCollectibleNum(collectibleType, true)
228
220
  if collectibleNum > 0 then
229
221
  collectibleMap:set(collectibleType, collectibleNum)
@@ -232,9 +224,7 @@ function ____exports.getPlayerCollectibleMap(self, player)
232
224
  return collectibleMap
233
225
  end
234
226
  function ____exports.getPlayerFromIndex(self, playerIndex)
235
- for ____, player in ipairs(
236
- ____exports.getPlayers(nil)
237
- ) do
227
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
238
228
  local existingPlayerIndex = ____exports.getPlayerIndex(nil, player)
239
229
  if existingPlayerIndex == playerIndex then
240
230
  return player
@@ -244,9 +234,7 @@ function ____exports.getPlayerFromIndex(self, playerIndex)
244
234
  end
245
235
  function ____exports.getPlayersOfType(self, playerType)
246
236
  local players = {}
247
- for ____, player in ipairs(
248
- ____exports.getPlayers(nil)
249
- ) do
237
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
250
238
  local character = player:GetPlayerType()
251
239
  if character == playerType then
252
240
  __TS__ArrayPush(players, player)
@@ -263,14 +251,14 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
263
251
  do
264
252
  local player = Isaac.GetPlayer(i)
265
253
  if player == nil then
266
- goto __continue60
254
+ goto __continue62
267
255
  end
268
256
  local playerHash = GetPtrHash(player)
269
257
  if playerHash == playerToFindHash then
270
258
  return i
271
259
  end
272
260
  end
273
- ::__continue60::
261
+ ::__continue62::
274
262
  i = i + 1
275
263
  end
276
264
  end
@@ -281,7 +269,7 @@ function ____exports.getPlayerNumAllHearts(self, player)
281
269
  local soulHearts = player:GetSoulHearts()
282
270
  local boneHearts = player:GetBoneHearts()
283
271
  local eternalHearts = player:GetEternalHearts()
284
- return ((hearts + soulHearts) + boneHearts) + eternalHearts
272
+ return hearts + soulHearts + boneHearts + eternalHearts
285
273
  end
286
274
  function ____exports.getTotalCharge(self, player, activeSlot)
287
275
  local activeCharge = player:GetActiveCharge(activeSlot)
@@ -290,9 +278,7 @@ function ____exports.getTotalCharge(self, player, activeSlot)
290
278
  end
291
279
  function ____exports.getTotalPlayerCollectibles(self, collectibleType)
292
280
  local numCollectibles = 0
293
- for ____, player in ipairs(
294
- ____exports.getPlayers(nil)
295
- ) do
281
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
296
282
  numCollectibles = numCollectibles + player:GetCollectibleNum(collectibleType)
297
283
  end
298
284
  return numCollectibles
@@ -310,32 +296,32 @@ function ____exports.hasOpenActiveItemSlot(self, player)
310
296
  local activeItemSecondary = player:GetActiveItem(ActiveSlot.SLOT_SECONDARY)
311
297
  local hasSchoolbag = player:HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG)
312
298
  if hasSchoolbag then
313
- return (activeItemPrimary == CollectibleType.COLLECTIBLE_NULL) or (activeItemSecondary == CollectibleType.COLLECTIBLE_NULL)
299
+ return activeItemPrimary == CollectibleType.COLLECTIBLE_NULL or activeItemSecondary == CollectibleType.COLLECTIBLE_NULL
314
300
  end
315
301
  return activeItemPrimary == CollectibleType.COLLECTIBLE_NULL
316
302
  end
317
303
  function ____exports.isBethany(self, player)
318
304
  local character = player:GetPlayerType()
319
- return (character == PlayerType.PLAYER_BETHANY) or (character == PlayerType.PLAYER_BETHANY_B)
305
+ return character == PlayerType.PLAYER_BETHANY or character == PlayerType.PLAYER_BETHANY_B
320
306
  end
321
307
  function ____exports.isFirstPlayer(self, player)
322
308
  return ____exports.getPlayerIndexVanilla(nil, player) == 0
323
309
  end
324
310
  function ____exports.isJacobOrEsau(self, player)
325
311
  local character = player:GetPlayerType()
326
- return (character == PlayerType.PLAYER_JACOB) or (character == PlayerType.PLAYER_ESAU)
312
+ return character == PlayerType.PLAYER_JACOB or character == PlayerType.PLAYER_ESAU
327
313
  end
328
314
  function ____exports.isKeeper(self, player)
329
315
  local character = player:GetPlayerType()
330
- return (character == PlayerType.PLAYER_KEEPER) or (character == PlayerType.PLAYER_KEEPER_B)
316
+ return character == PlayerType.PLAYER_KEEPER or character == PlayerType.PLAYER_KEEPER_B
331
317
  end
332
318
  function ____exports.isLost(self, player)
333
319
  local character = player:GetPlayerType()
334
- return (character == PlayerType.PLAYER_THELOST) or (character == PlayerType.PLAYER_THELOST_B)
320
+ return character == PlayerType.PLAYER_THELOST or character == PlayerType.PLAYER_THELOST_B
335
321
  end
336
322
  function ____exports.isTaintedLazarus(self, player)
337
323
  local character = player:GetPlayerType()
338
- return (character == PlayerType.PLAYER_LAZARUS_B) or (character == PlayerType.PLAYER_LAZARUS2_B)
324
+ return character == PlayerType.PLAYER_LAZARUS_B or character == PlayerType.PLAYER_LAZARUS2_B
339
325
  end
340
326
  function ____exports.removeCollectibleCostume(self, player, collectibleType)
341
327
  local itemConfig = Isaac.GetItemConfig()
@@ -378,9 +364,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
378
364
  itemPool:RemoveCollectible(collectibleType)
379
365
  end
380
366
  repeat
381
- local ____switch87 = activeSlot
382
- local ____cond87 = ____switch87 == ActiveSlot.SLOT_PRIMARY
383
- if ____cond87 then
367
+ local ____switch89 = activeSlot
368
+ local ____cond89 = ____switch89 == ActiveSlot.SLOT_PRIMARY
369
+ if ____cond89 then
384
370
  do
385
371
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
386
372
  player:RemoveCollectible(primaryCollectibleType)
@@ -389,8 +375,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
389
375
  break
390
376
  end
391
377
  end
392
- ____cond87 = ____cond87 or (____switch87 == ActiveSlot.SLOT_SECONDARY)
393
- if ____cond87 then
378
+ ____cond89 = ____cond89 or ____switch89 == ActiveSlot.SLOT_SECONDARY
379
+ if ____cond89 then
394
380
  do
395
381
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
396
382
  player:RemoveCollectible(primaryCollectibleType)
@@ -405,16 +391,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
405
391
  break
406
392
  end
407
393
  end
408
- ____cond87 = ____cond87 or (____switch87 == ActiveSlot.SLOT_POCKET)
409
- if ____cond87 then
394
+ ____cond89 = ____cond89 or ____switch89 == ActiveSlot.SLOT_POCKET
395
+ if ____cond89 then
410
396
  do
411
397
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
412
398
  player:SetActiveCharge(charge, activeSlot)
413
399
  break
414
400
  end
415
401
  end
416
- ____cond87 = ____cond87 or (____switch87 == ActiveSlot.SLOT_POCKET2)
417
- if ____cond87 then
402
+ ____cond89 = ____cond89 or ____switch89 == ActiveSlot.SLOT_POCKET2
403
+ if ____cond89 then
418
404
  do
419
405
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
420
406
  break
@@ -27,29 +27,29 @@ function ____exports.getPlayerHealth(self, player)
27
27
  local rottenHearts = player:GetRottenHearts()
28
28
  local brokenHearts = player:GetBrokenHearts()
29
29
  local subPlayer = player:GetSubPlayer()
30
- if (character == PlayerType.PLAYER_THEFORGOTTEN) and (subPlayer ~= nil) then
30
+ if character == PlayerType.PLAYER_THEFORGOTTEN and subPlayer ~= nil then
31
31
  maxHearts = boneHearts * 2
32
32
  boneHearts = 0
33
33
  soulHearts = subPlayer:GetSoulHearts()
34
- elseif (character == PlayerType.PLAYER_THESOUL) and (subPlayer ~= nil) then
34
+ elseif character == PlayerType.PLAYER_THESOUL and subPlayer ~= nil then
35
35
  maxHearts = subPlayer:GetBoneHearts() * 2
36
36
  hearts = subPlayer:GetHearts()
37
37
  end
38
- hearts = hearts - (rottenHearts * 2)
38
+ hearts = hearts - rottenHearts * 2
39
39
  local extraHearts = math.ceil(soulHearts / 2) + boneHearts
40
40
  local currentSoulHeart = 0
41
41
  do
42
42
  local i = 0
43
43
  while i < extraHearts do
44
44
  local isBoneHeart = player:IsBoneHeart(i)
45
- if (character == PlayerType.PLAYER_THEFORGOTTEN) and (subPlayer ~= nil) then
45
+ if character == PlayerType.PLAYER_THEFORGOTTEN and subPlayer ~= nil then
46
46
  isBoneHeart = subPlayer:IsBoneHeart(i)
47
47
  end
48
48
  if isBoneHeart then
49
49
  __TS__ArrayPush(soulHeartTypes, HeartSubType.HEART_BONE)
50
50
  else
51
51
  local isBlackHeart = player:IsBlackHeart(currentSoulHeart + 1)
52
- if (character == PlayerType.PLAYER_THEFORGOTTEN) and (subPlayer ~= nil) then
52
+ if character == PlayerType.PLAYER_THEFORGOTTEN and subPlayer ~= nil then
53
53
  isBlackHeart = subPlayer:IsBlackHeart(currentSoulHeart + 1)
54
54
  end
55
55
  if isBlackHeart then
@@ -62,13 +62,23 @@ function ____exports.getPlayerHealth(self, player)
62
62
  i = i + 1
63
63
  end
64
64
  end
65
- return {soulHeartTypes = soulHeartTypes, maxHearts = maxHearts, hearts = hearts, eternalHearts = eternalHearts, soulHearts = soulHearts, boneHearts = boneHearts, goldenHearts = goldenHearts, rottenHearts = rottenHearts, brokenHearts = brokenHearts}
65
+ return {
66
+ soulHeartTypes = soulHeartTypes,
67
+ maxHearts = maxHearts,
68
+ hearts = hearts,
69
+ eternalHearts = eternalHearts,
70
+ soulHearts = soulHearts,
71
+ boneHearts = boneHearts,
72
+ goldenHearts = goldenHearts,
73
+ rottenHearts = rottenHearts,
74
+ brokenHearts = brokenHearts
75
+ }
66
76
  end
67
77
  function ____exports.setPlayerHealth(self, player, playerHealth)
68
78
  local character = player:GetPlayerType()
69
79
  local subPlayer = player:GetSubPlayer()
70
80
  ____exports.removeAllPlayerHealth(nil, player)
71
- if (character == PlayerType.PLAYER_THESOUL) and (subPlayer ~= nil) then
81
+ if character == PlayerType.PLAYER_THESOUL and subPlayer ~= nil then
72
82
  subPlayer:AddMaxHearts(playerHealth.maxHearts, false)
73
83
  else
74
84
  player:AddMaxHearts(playerHealth.maxHearts, false)
@@ -79,9 +89,9 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
79
89
  local i = 0
80
90
  while i < #playerHealth.soulHeartTypes do
81
91
  local heartType = playerHealth.soulHeartTypes[i + 1]
82
- local isHalf = (playerHealth.soulHearts + (playerHealth.boneHearts * 2)) < ((i + 1) * 2)
92
+ local isHalf = playerHealth.soulHearts + playerHealth.boneHearts * 2 < (i + 1) * 2
83
93
  local addAmount = 2
84
- if (isHalf or (heartType == HeartSubType.HEART_BONE)) or (soulHeartsRemaining < 2) then
94
+ if isHalf or heartType == HeartSubType.HEART_BONE or soulHeartsRemaining < 2 then
85
95
  addAmount = 1
86
96
  end
87
97
  if heartType == HeartSubType.HEART_SOUL then
@@ -21,10 +21,10 @@ function ____exports.getPocketItems(self, player)
21
21
  __TS__ArrayPush(pocketItems, {type = PocketItemType.CARD, id = card, slot = slot})
22
22
  elseif pill ~= PillColor.PILL_NULL then
23
23
  __TS__ArrayPush(pocketItems, {type = PocketItemType.PILL, id = pill, slot = slot})
24
- elseif (hasPocketItem and (not hasPocketItem2)) and (not pocketItemIdentified) then
24
+ elseif hasPocketItem and not hasPocketItem2 and not pocketItemIdentified then
25
25
  pocketItemIdentified = true
26
26
  __TS__ArrayPush(pocketItems, {type = PocketItemType.ACTIVE_ITEM, id = pocketItem, slot = slot})
27
- elseif ((not hasPocketItem) and hasPocketItem2) and (not pocketItem2Identified) then
27
+ elseif not hasPocketItem and hasPocketItem2 and not pocketItem2Identified then
28
28
  pocketItem2Identified = true
29
29
  __TS__ArrayPush(pocketItems, {type = PocketItemType.DICE_BAG_DICE, id = pocketItem2, slot = slot})
30
30
  elseif hasPocketItem and hasPocketItem2 then
@@ -32,7 +32,7 @@ function ____exports.getPocketItems(self, player)
32
32
  else
33
33
  __TS__ArrayPush(pocketItems, {type = PocketItemType.EMPTY, id = 0, slot = slot})
34
34
  end
35
- if (slot + 1) == maxPocketItems then
35
+ if slot + 1 == maxPocketItems then
36
36
  break
37
37
  end
38
38
  slot = slot + 1
@@ -43,7 +43,7 @@ end
43
43
  function ____exports.getFirstCardOrPill(self, player)
44
44
  local pocketItems = ____exports.getPocketItems(nil, player)
45
45
  for ____, pocketItem in ipairs(pocketItems) do
46
- if (pocketItem.type == PocketItemType.CARD) or (pocketItem.type == PocketItemType.PILL) then
46
+ if pocketItem.type == PocketItemType.CARD or pocketItem.type == PocketItemType.PILL then
47
47
  return pocketItem
48
48
  end
49
49
  end
@@ -24,14 +24,14 @@ function ____exports.getRandomFloat(self, min, max, seed)
24
24
  if seed == nil then
25
25
  seed = Random()
26
26
  end
27
- return min + (____exports.getRandom(nil, seed) * (max - min))
27
+ return min + ____exports.getRandom(nil, seed) * (max - min)
28
28
  end
29
29
  function ____exports.getRandomInt(self, min, max, seed)
30
30
  if seed == nil then
31
31
  seed = Random()
32
32
  end
33
33
  local rng = ____exports.initRNG(nil, seed)
34
- return rng:RandomInt((max - min) + 1) + min
34
+ return rng:RandomInt(max - min + 1) + min
35
35
  end
36
36
  function ____exports.nextSeed(self, seed)
37
37
  local rng = ____exports.initRNG(nil, seed)
@@ -13,12 +13,12 @@ function ____exports.willMysteriousPaperRevive(self, player)
13
13
  local sprite = player:GetSprite()
14
14
  local animation = getDeathAnimationName(nil, player)
15
15
  local deathAnimationFrames = getFinalFrameOfAnimation(nil, sprite, animation)
16
- local frameOfDeath = (gameFrameCount + deathAnimationFrames) + 1
17
- return (frameOfDeath % 4) == 3
16
+ local frameOfDeath = gameFrameCount + deathAnimationFrames + 1
17
+ return frameOfDeath % 4 == 3
18
18
  end
19
19
  function ____exports.willPlayerRevive(self, player)
20
20
  local trinketSituation = temporarilyRemoveTrinkets(nil, player, TrinketType.TRINKET_MYSTERIOUS_PAPER)
21
- local willRevive = player:WillPlayerRevive() or ((trinketSituation ~= nil) and ____exports.willMysteriousPaperRevive(nil, player))
21
+ local willRevive = player:WillPlayerRevive() or trinketSituation ~= nil and ____exports.willMysteriousPaperRevive(nil, player)
22
22
  giveTrinketsBack(nil, player, trinketSituation)
23
23
  return willRevive
24
24
  end
@@ -29,6 +29,6 @@ function ____exports.willReviveFromSpiritShackles(self, player)
29
29
  local effects = player:GetEffects()
30
30
  local spiritShacklesEnabled = not effects:HasNullEffect(NullItemID.ID_SPIRIT_SHACKLES_DISABLED)
31
31
  local playerInSoulForm = effects:HasNullEffect(NullItemID.ID_SPIRIT_SHACKLES_SOUL)
32
- return spiritShacklesEnabled and (not playerInSoulForm)
32
+ return spiritShacklesEnabled and not playerInSoulForm
33
33
  end
34
34
  return ____exports
@@ -53,9 +53,7 @@ function ____exports.getCurrentDimension(self)
53
53
  dimension = dimension + 1
54
54
  end
55
55
  end
56
- error(
57
- "Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomIndex)
58
- )
56
+ error("Failed to get the current dimension using the starting room index of: " .. tostring(startingRoomIndex))
59
57
  return 0
60
58
  end
61
59
  function ____exports.getRoomData(self)
@@ -80,7 +78,7 @@ function ____exports.getRoomIndexesForType(self, roomType)
80
78
  local i = 0
81
79
  while i <= MAX_ROOM_INDEX do
82
80
  local room = level:GetRoomByIdx(i)
83
- if ((room ~= nil) and (room.Data ~= nil)) and (room.Data.Type == roomType) then
81
+ if room ~= nil and room.Data ~= nil and room.Data.Type == roomType then
84
82
  roomIndexes:add(room.SafeGridIndex)
85
83
  end
86
84
  i = i + 1
@@ -93,7 +91,7 @@ function ____exports.getRoomItemPoolType(self)
93
91
  local room = game:GetRoom()
94
92
  local roomType = room:GetType()
95
93
  local itemPoolType = ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP:get(roomType)
96
- return ((itemPoolType == nil) and DEFAULT_ITEM_POOL_TYPE) or itemPoolType
94
+ return itemPoolType == nil and DEFAULT_ITEM_POOL_TYPE or itemPoolType
97
95
  end
98
96
  function ____exports.getRoomName(self)
99
97
  local roomData = ____exports.getRoomData(nil)
@@ -134,26 +132,26 @@ function ____exports.gridToPos(self, x, y)
134
132
  local room = game:GetRoom()
135
133
  x = x + 1
136
134
  y = y + 1
137
- local gridIndex = (y * room:GetGridWidth()) + x
135
+ local gridIndex = y * room:GetGridWidth() + x
138
136
  return room:GetGridPosition(gridIndex)
139
137
  end
140
138
  function ____exports.in2x1Room(self)
141
139
  local game = Game()
142
140
  local room = game:GetRoom()
143
141
  local roomShape = room:GetRoomShape()
144
- return (roomShape == RoomShape.ROOMSHAPE_1x2) or (roomShape == RoomShape.ROOMSHAPE_2x1)
142
+ return roomShape == RoomShape.ROOMSHAPE_1x2 or roomShape == RoomShape.ROOMSHAPE_2x1
145
143
  end
146
144
  function ____exports.inAngelShop(self)
147
145
  local game = Game()
148
146
  local room = game:GetRoom()
149
147
  local roomType = room:GetType()
150
148
  local roomSubType = ____exports.getRoomSubType(nil)
151
- return (roomType == RoomType.ROOM_ANGEL) and (roomSubType == 1)
149
+ return roomType == RoomType.ROOM_ANGEL and roomSubType == 1
152
150
  end
153
151
  function ____exports.inBeastRoom(self)
154
152
  local roomIndex = ____exports.getRoomIndex(nil)
155
153
  local roomSubType = ____exports.getRoomSubType(nil)
156
- return (roomIndex == GridRooms.ROOM_DUNGEON_IDX) and (roomSubType == 4)
154
+ return roomIndex == GridRooms.ROOM_DUNGEON_IDX and roomSubType == 4
157
155
  end
158
156
  function ____exports.inBossRoomOf(self, bossID)
159
157
  local game = Game()
@@ -161,17 +159,17 @@ function ____exports.inBossRoomOf(self, bossID)
161
159
  local roomType = room:GetType()
162
160
  local roomStageID = ____exports.getRoomStageID(nil)
163
161
  local roomSubType = ____exports.getRoomSubType(nil)
164
- return ((roomType == RoomType.ROOM_BOSS) and (roomStageID == 0)) and (roomSubType == bossID)
162
+ return roomType == RoomType.ROOM_BOSS and roomStageID == 0 and roomSubType == bossID
165
163
  end
166
164
  function ____exports.inCrawlspace(self)
167
165
  local roomIndex = ____exports.getRoomIndex(nil)
168
166
  local roomSubType = ____exports.getRoomSubType(nil)
169
- return (roomIndex == GridRooms.ROOM_DUNGEON_IDX) and (roomSubType ~= 4)
167
+ return roomIndex == GridRooms.ROOM_DUNGEON_IDX and roomSubType ~= 4
170
168
  end
171
169
  function ____exports.inDeathCertificateArea(self)
172
170
  local roomStageID = ____exports.getRoomStageID(nil)
173
171
  local roomSubType = ____exports.getRoomSubType(nil)
174
- return (roomStageID == 35) and ((roomSubType == 33) or (roomSubType == 33))
172
+ return roomStageID == 35 and (roomSubType == 33 or roomSubType == 33)
175
173
  end
176
174
  function ____exports.isDevilsCrownTreasureRoom(self)
177
175
  local game = Game()
@@ -186,7 +184,7 @@ function ____exports.inLRoom(self)
186
184
  local game = Game()
187
185
  local room = game:GetRoom()
188
186
  local roomShape = room:GetRoomShape()
189
- return (((roomShape == RoomShape.ROOMSHAPE_LTL) or (roomShape == RoomShape.ROOMSHAPE_LTR)) or (roomShape == RoomShape.ROOMSHAPE_LBL)) or (roomShape == RoomShape.ROOMSHAPE_LBR)
187
+ return roomShape == RoomShape.ROOMSHAPE_LTL or roomShape == RoomShape.ROOMSHAPE_LTR or roomShape == RoomShape.ROOMSHAPE_LBL or roomShape == RoomShape.ROOMSHAPE_LBR
190
188
  end
191
189
  function ____exports.inGenesisRoom(self)
192
190
  local game = Game()
@@ -194,7 +192,7 @@ function ____exports.inGenesisRoom(self)
194
192
  local roomType = room:GetType()
195
193
  local roomVariant = ____exports.getRoomVariant(nil)
196
194
  local roomSubType = ____exports.getRoomSubType(nil)
197
- return ((roomType == RoomType.ROOM_ISAACS) and (roomVariant == GENESIS_ROOM_VARIANT)) and (roomSubType == GENESIS_ROOM_SUBTYPE)
195
+ return roomType == RoomType.ROOM_ISAACS and roomVariant == GENESIS_ROOM_VARIANT and roomSubType == GENESIS_ROOM_SUBTYPE
198
196
  end
199
197
  function ____exports.inStartingRoom(self)
200
198
  local game = Game()
@@ -222,9 +220,7 @@ function ____exports.setRoomCleared(self)
222
220
  return
223
221
  end
224
222
  room:SetClear(true)
225
- for ____, door in ipairs(
226
- getDoors(nil)
227
- ) do
223
+ for ____, door in ipairs(getDoors(nil)) do
228
224
  do
229
225
  if isHiddenSecretRoomDoor(nil, door) then
230
226
  goto __continue39
@@ -22,14 +22,22 @@ 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(EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE, position, Vector.Zero, nil, collectibleType, seed):ToPickup()
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()
26
34
  if collectible == nil then
27
35
  error("Failed to spawn a collectible.")
28
36
  end
29
37
  if options then
30
38
  collectible.OptionsPickupIndex = 1
31
39
  end
32
- if (anyPlayerIs(nil, PlayerType.PLAYER_KEEPER_B) and (not isQuestCollectible(nil, collectibleType))) and (not forceFreeItem) then
40
+ if anyPlayerIs(nil, PlayerType.PLAYER_KEEPER_B) and not isQuestCollectible(nil, collectibleType) and not forceFreeItem then
33
41
  collectible.ShopItemId = -1
34
42
  collectible.Price = 15
35
43
  end
@@ -3,12 +3,12 @@ local ____exports = {}
3
3
  function ____exports.getFinalFrameOfAnimation(self, sprite, animation)
4
4
  local currentAnimation = sprite:GetAnimation()
5
5
  local currentFrame = sprite:GetFrame()
6
- if (animation ~= nil) and (animation ~= currentAnimation) then
6
+ if animation ~= nil and animation ~= currentAnimation then
7
7
  sprite:SetAnimation(animation)
8
8
  end
9
9
  sprite:SetLastFrame()
10
10
  local finalFrame = sprite:GetFrame()
11
- if (animation ~= nil) and (animation ~= currentAnimation) then
11
+ if animation ~= nil and animation ~= currentAnimation then
12
12
  sprite:Play(currentAnimation, true)
13
13
  end
14
14
  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)