isaacscript-common 1.0.574 → 1.0.578

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 (137) hide show
  1. package/dist/callbacks/itemPickup.lua +2 -6
  2. package/dist/callbacks/postBombInitLate.lua +1 -5
  3. package/dist/callbacks/postCursedTeleport.lua +8 -10
  4. package/dist/callbacks/postEffectInitLate.lua +1 -5
  5. package/dist/callbacks/postEsauJr.lua +2 -4
  6. package/dist/callbacks/postFamiliarInitLate.lua +1 -5
  7. package/dist/callbacks/postFlip.lua +2 -4
  8. package/dist/callbacks/postGridEntity.lua +8 -20
  9. package/dist/callbacks/postKnifeInitLate.lua +1 -5
  10. package/dist/callbacks/postLaserInitLate.lua +1 -5
  11. package/dist/callbacks/postNPCInitLate.lua +1 -5
  12. package/dist/callbacks/postPickupCollect.lua +1 -5
  13. package/dist/callbacks/postPickupInitLate.lua +1 -5
  14. package/dist/callbacks/postPlayerChangeHealth.lua +19 -23
  15. package/dist/callbacks/postPlayerChangeType.lua +1 -5
  16. package/dist/callbacks/postPlayerFatalDamage.lua +5 -9
  17. package/dist/callbacks/postPlayerInitLate.lua +1 -5
  18. package/dist/callbacks/postPlayerReordered.lua +8 -2
  19. package/dist/callbacks/postProjectileInitLate.lua +1 -5
  20. package/dist/callbacks/postPurchase.lua +19 -19
  21. package/dist/callbacks/postSacrifice.lua +3 -3
  22. package/dist/callbacks/postSlotInitUpdate.lua +3 -11
  23. package/dist/callbacks/postSlotRenderBroken.lua +2 -8
  24. package/dist/callbacks/postTearInitLate.lua +1 -5
  25. package/dist/callbacks/postTearInitVeryLate.lua +1 -5
  26. package/dist/callbacks/postTransformation.lua +1 -5
  27. package/dist/callbacks/postTrinketBreak.lua +5 -9
  28. package/dist/callbacks/preNewLevel.lua +1 -1
  29. package/dist/callbacks/reorderedCallbacks.lua +4 -4
  30. package/dist/callbacks/subscriptions/PreNewLevel.lua +1 -2
  31. package/dist/callbacks/subscriptions/postBombInitLate.lua +3 -5
  32. package/dist/callbacks/subscriptions/postCursedTeleport.lua +1 -2
  33. package/dist/callbacks/subscriptions/postCustomRevive.lua +3 -5
  34. package/dist/callbacks/subscriptions/postEffectInitLate.lua +3 -5
  35. package/dist/callbacks/subscriptions/postEsauJr.lua +1 -2
  36. package/dist/callbacks/subscriptions/postFamiliarInitLate.lua +3 -5
  37. package/dist/callbacks/subscriptions/postFirstEsauJr.lua +1 -2
  38. package/dist/callbacks/subscriptions/postFirstFlip.lua +1 -2
  39. package/dist/callbacks/subscriptions/postFlip.lua +1 -2
  40. package/dist/callbacks/subscriptions/postGameStartedReordered.lua +1 -2
  41. package/dist/callbacks/subscriptions/postGridEntityInit.lua +3 -5
  42. package/dist/callbacks/subscriptions/postGridEntityRemove.lua +3 -5
  43. package/dist/callbacks/subscriptions/postGridEntityUpdate.lua +3 -5
  44. package/dist/callbacks/subscriptions/postItemPickup.lua +5 -8
  45. package/dist/callbacks/subscriptions/postKnifeInitLate.lua +3 -5
  46. package/dist/callbacks/subscriptions/postLaserInitLate.lua +3 -5
  47. package/dist/callbacks/subscriptions/postNPCInitLate.lua +3 -5
  48. package/dist/callbacks/subscriptions/postNewLevelReordered.lua +1 -2
  49. package/dist/callbacks/subscriptions/postNewRoomEarly.lua +1 -2
  50. package/dist/callbacks/subscriptions/postNewRoomReordered.lua +1 -2
  51. package/dist/callbacks/subscriptions/postPEffectUpdateReordered.lua +3 -5
  52. package/dist/callbacks/subscriptions/postPickupCollect.lua +3 -5
  53. package/dist/callbacks/subscriptions/postPickupInitLate.lua +3 -5
  54. package/dist/callbacks/subscriptions/postPlayerChangeHealth.lua +3 -5
  55. package/dist/callbacks/subscriptions/postPlayerChangeType.lua +1 -2
  56. package/dist/callbacks/subscriptions/postPlayerFatalDamage.lua +3 -5
  57. package/dist/callbacks/subscriptions/postPlayerInitLate.lua +3 -5
  58. package/dist/callbacks/subscriptions/postPlayerInitReordered.lua +3 -5
  59. package/dist/callbacks/subscriptions/postPlayerRenderReordered.lua +3 -5
  60. package/dist/callbacks/subscriptions/postPlayerUpdateReordered.lua +3 -5
  61. package/dist/callbacks/subscriptions/postProjectileInitLate.lua +3 -5
  62. package/dist/callbacks/subscriptions/postPurchase.lua +8 -3
  63. package/dist/callbacks/subscriptions/postSacrifice.lua +1 -2
  64. package/dist/callbacks/subscriptions/postSlotDestroyed.lua +3 -5
  65. package/dist/callbacks/subscriptions/postSlotInit.lua +3 -5
  66. package/dist/callbacks/subscriptions/postSlotRender.lua +3 -5
  67. package/dist/callbacks/subscriptions/postSlotUpdate.lua +3 -5
  68. package/dist/callbacks/subscriptions/postTearInitLate.lua +3 -5
  69. package/dist/callbacks/subscriptions/postTearInitVeryLate.lua +3 -5
  70. package/dist/callbacks/subscriptions/postTransformation.lua +3 -5
  71. package/dist/callbacks/subscriptions/postTrinketBreak.lua +3 -5
  72. package/dist/callbacks/subscriptions/preCustomRevive.lua +1 -2
  73. package/dist/callbacks/subscriptions/preItemPickup.lua +5 -8
  74. package/dist/constants.lua +57 -6
  75. package/dist/features/deployJSONRoom.lua +95 -68
  76. package/dist/features/disableInputs.lua +9 -3
  77. package/dist/features/forgottenSwitch.lua +1 -1
  78. package/dist/features/getCollectibleItemPoolType.lua +4 -10
  79. package/dist/features/preventCollectibleRotate.lua +3 -9
  80. package/dist/features/saveDataManager/load.lua +2 -6
  81. package/dist/features/saveDataManager/main.lua +1 -1
  82. package/dist/features/saveDataManager/merge.lua +2 -4
  83. package/dist/features/sirenHelpers.lua +5 -7
  84. package/dist/functions/array.lua +6 -10
  85. package/dist/functions/bitwise.lua +1 -1
  86. package/dist/functions/challenges.lua +1 -1
  87. package/dist/functions/charge.lua +10 -12
  88. package/dist/functions/collectibles.lua +18 -23
  89. package/dist/functions/color.lua +9 -1
  90. package/dist/functions/deepCopy.lua +46 -28
  91. package/dist/functions/deepCopyTests.lua +12 -20
  92. package/dist/functions/doors.d.ts +10 -0
  93. package/dist/functions/doors.lua +19 -21
  94. package/dist/functions/entity.lua +8 -2
  95. package/dist/functions/flag.lua +1 -1
  96. package/dist/functions/gridEntity.lua +14 -9
  97. package/dist/functions/input.lua +17 -27
  98. package/dist/functions/jsonRoom.lua +3 -9
  99. package/dist/functions/language.lua +9 -1
  100. package/dist/functions/log.lua +33 -85
  101. package/dist/functions/math.lua +15 -17
  102. package/dist/functions/npc.lua +15 -17
  103. package/dist/functions/pickups.lua +14 -1
  104. package/dist/functions/player.lua +38 -60
  105. package/dist/functions/playerHealth.lua +19 -9
  106. package/dist/functions/pocketItems.lua +4 -4
  107. package/dist/functions/random.lua +2 -2
  108. package/dist/functions/revive.lua +4 -4
  109. package/dist/functions/rooms.d.ts +14 -2
  110. package/dist/functions/rooms.lua +58 -43
  111. package/dist/functions/spawnCollectible.lua +10 -2
  112. package/dist/functions/sprite.lua +2 -2
  113. package/dist/functions/stage.lua +11 -11
  114. package/dist/functions/tears.lua +1 -1
  115. package/dist/functions/transformations.lua +4 -10
  116. package/dist/functions/trinketGive.lua +3 -3
  117. package/dist/functions/trinkets.lua +10 -6
  118. package/dist/functions/ui.lua +3 -3
  119. package/dist/functions/util.d.ts +0 -11
  120. package/dist/functions/util.lua +6 -26
  121. package/dist/functions/vector.lua +8 -8
  122. package/dist/lualib_bundle.lua +795 -735
  123. package/dist/maps/cardDescriptionMap.lua +99 -1
  124. package/dist/maps/cardNameMap.lua +99 -1
  125. package/dist/maps/challengeNameMap.lua +47 -1
  126. package/dist/maps/collectibleDescriptionMap.lua +722 -1
  127. package/dist/maps/collectibleNameMap.lua +722 -1
  128. package/dist/maps/gridEntityXMLMap.lua +36 -1
  129. package/dist/maps/pillEffectNameMap.lua +52 -1
  130. package/dist/maps/roomShapeToTopLeftWallGridIndexMap.lua +7 -1
  131. package/dist/maps/transformationMaps.lua +21 -16
  132. package/dist/maps/transformationNameMap.lua +17 -1
  133. package/dist/maps/trinketDescriptionMap.lua +190 -1
  134. package/dist/maps/trinketNameMap.lua +190 -1
  135. package/dist/sets/cards.lua +98 -2
  136. package/dist/types/ModUpgraded.lua +95 -105
  137. package/package.json +5 -5
@@ -30,7 +30,7 @@ function ____exports.getCharacterMaxHeartContainers(self, character)
30
30
  end
31
31
  function ____exports.getPlayerIndex(self, player)
32
32
  local character = player:GetPlayerType()
33
- local collectibleToUse = ((character == PlayerType.PLAYER_LAZARUS2_B) and CollectibleType.COLLECTIBLE_INNER_EYE) or CollectibleType.COLLECTIBLE_SAD_ONION
33
+ local collectibleToUse = character == PlayerType.PLAYER_LAZARUS2_B and CollectibleType.COLLECTIBLE_INNER_EYE or CollectibleType.COLLECTIBLE_SAD_ONION
34
34
  local collectibleRNG = player:GetCollectibleRNG(collectibleToUse)
35
35
  local seed = collectibleRNG:GetSeed()
36
36
  return seed
@@ -38,7 +38,7 @@ end
38
38
  function ____exports.getPlayerMaxHeartContainers(self, player)
39
39
  local character = player:GetPlayerType()
40
40
  local maxHeartContainers = ____exports.getCharacterMaxHeartContainers(nil, character)
41
- if (character == PlayerType.PLAYER_MAGDALENE) and player:HasCollectible(CollectibleType.COLLECTIBLE_BIRTHRIGHT) then
41
+ if character == PlayerType.PLAYER_MAGDALENE and player:HasCollectible(CollectibleType.COLLECTIBLE_BIRTHRIGHT) then
42
42
  maxHeartContainers = maxHeartContainers + 6
43
43
  end
44
44
  local numMothersKisses = player:GetTrinketMultiplier(TrinketType.TRINKET_MOTHERS_KISS)
@@ -60,18 +60,18 @@ function ____exports.getPlayers(self, performExclusions)
60
60
  do
61
61
  local player = Isaac.GetPlayer(i)
62
62
  if player == nil then
63
- goto __continue67
63
+ goto __continue76
64
64
  end
65
65
  if ____exports.isChildPlayer(nil, player) then
66
- goto __continue67
66
+ goto __continue76
67
67
  end
68
68
  local character = player:GetPlayerType()
69
69
  if performExclusions and EXCLUDED_CHARACTERS:has(character) then
70
- goto __continue67
70
+ goto __continue76
71
71
  end
72
72
  __TS__ArrayPush(players, player)
73
73
  end
74
- ::__continue67::
74
+ ::__continue76::
75
75
  i = i + 1
76
76
  end
77
77
  end
@@ -98,9 +98,7 @@ function ____exports.addTrinketCostume(self, player, trinketType)
98
98
  player:AddCostume(itemConfigTrinket, false)
99
99
  end
100
100
  function ____exports.anyPlayerCloserThan(self, position, distance)
101
- for ____, player in ipairs(
102
- ____exports.getPlayers(nil)
103
- ) do
101
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
104
102
  if player.Position:Distance(position) <= distance then
105
103
  return true
106
104
  end
@@ -108,9 +106,7 @@ function ____exports.anyPlayerCloserThan(self, position, distance)
108
106
  return false
109
107
  end
110
108
  function ____exports.anyPlayerHasCollectible(self, collectibleType)
111
- for ____, player in ipairs(
112
- ____exports.getPlayers(nil)
113
- ) do
109
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
114
110
  if player:HasCollectible(collectibleType) then
115
111
  return true
116
112
  end
@@ -118,9 +114,7 @@ function ____exports.anyPlayerHasCollectible(self, collectibleType)
118
114
  return false
119
115
  end
120
116
  function ____exports.anyPlayerHasTrinket(self, trinketType)
121
- for ____, player in ipairs(
122
- ____exports.getPlayers(nil)
123
- ) do
117
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
124
118
  if player:HasTrinket(trinketType) then
125
119
  return true
126
120
  end
@@ -130,9 +124,7 @@ end
130
124
  function ____exports.anyPlayerIs(self, ...)
131
125
  local characters = {...}
132
126
  local characterSet = __TS__New(Set, characters)
133
- for ____, player in ipairs(
134
- ____exports.getPlayers(nil)
135
- ) do
127
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
136
128
  local character = player:GetPlayerType()
137
129
  if characterSet:has(character) then
138
130
  return true
@@ -155,14 +147,12 @@ function ____exports.getAzazelBrimstoneDistance(self, playerOrTearHeight)
155
147
  local player = playerOrTearHeight
156
148
  tearHeight = player.TearHeight
157
149
  end
158
- return 32 - (2.5 * tearHeight)
150
+ return 32 - 2.5 * tearHeight
159
151
  end
160
152
  function ____exports.getClosestPlayer(self, position)
161
153
  local closestPlayer = nil
162
154
  local closestDistance = math.huge
163
- for ____, player in ipairs(
164
- ____exports.getPlayers(nil)
165
- ) do
155
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
166
156
  local distance = position:Distance(player.Position)
167
157
  if distance < closestDistance then
168
158
  closestPlayer = player
@@ -197,10 +187,10 @@ function ____exports.getLastHeart(self, player)
197
187
  local boneHearts = player:GetBoneHearts()
198
188
  local rottenHearts = player:GetRottenHearts()
199
189
  local soulHeartSlots = soulHearts / 2
200
- local lastHeartIndex = (boneHearts + soulHeartSlots) - 1
190
+ local lastHeartIndex = boneHearts + soulHeartSlots - 1
201
191
  local isLastHeartBone = player:IsBoneHeart(lastHeartIndex)
202
192
  if isLastHeartBone then
203
- local isLastContainerEmpty = hearts <= (effectiveMaxHearts - 2)
193
+ local isLastContainerEmpty = hearts <= effectiveMaxHearts - 2
204
194
  if isLastContainerEmpty then
205
195
  return HealthType.BONE
206
196
  end
@@ -232,9 +222,7 @@ end
232
222
  function ____exports.getNewestPlayer(self)
233
223
  local newestPlayer = nil
234
224
  local lowestFrame = math.huge
235
- for ____, player in ipairs(
236
- ____exports.getPlayers(nil)
237
- ) do
225
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
238
226
  if player.FrameCount < lowestFrame then
239
227
  newestPlayer = player
240
228
  lowestFrame = player.FrameCount
@@ -257,9 +245,7 @@ function ____exports.getPlayerAvailableHeartSlots(self, player)
257
245
  return maxHeartContainers - totalOccupiedHeartSlots
258
246
  end
259
247
  function ____exports.getPlayerCloserThan(self, position, distance)
260
- for ____, player in ipairs(
261
- ____exports.getPlayers(nil)
262
- ) do
248
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
263
249
  if player.Position:Distance(position) <= distance then
264
250
  return player
265
251
  end
@@ -269,9 +255,7 @@ end
269
255
  function ____exports.getPlayerCollectibleMap(self, player)
270
256
  local collectibleSet = getCollectibleSet(nil)
271
257
  local collectibleMap = __TS__New(Map)
272
- for ____, collectibleType in __TS__Iterator(
273
- collectibleSet:values()
274
- ) do
258
+ for ____, collectibleType in __TS__Iterator(collectibleSet:values()) do
275
259
  local collectibleNum = player:GetCollectibleNum(collectibleType, true)
276
260
  if collectibleNum > 0 then
277
261
  collectibleMap:set(collectibleType, collectibleNum)
@@ -280,9 +264,7 @@ function ____exports.getPlayerCollectibleMap(self, player)
280
264
  return collectibleMap
281
265
  end
282
266
  function ____exports.getPlayerFromIndex(self, playerIndex)
283
- for ____, player in ipairs(
284
- ____exports.getPlayers(nil)
285
- ) do
267
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
286
268
  local existingPlayerIndex = ____exports.getPlayerIndex(nil, player)
287
269
  if existingPlayerIndex == playerIndex then
288
270
  return player
@@ -299,14 +281,14 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
299
281
  do
300
282
  local player = Isaac.GetPlayer(i)
301
283
  if player == nil then
302
- goto __continue59
284
+ goto __continue68
303
285
  end
304
286
  local playerHash = GetPtrHash(player)
305
287
  if playerHash == playerToFindHash then
306
288
  return i
307
289
  end
308
290
  end
309
- ::__continue59::
291
+ ::__continue68::
310
292
  i = i + 1
311
293
  end
312
294
  end
@@ -318,13 +300,11 @@ function ____exports.getPlayerNumAllHearts(self, player)
318
300
  local boneHearts = player:GetBoneHearts()
319
301
  local eternalHearts = player:GetEternalHearts()
320
302
  local rottenHearts = player:GetRottenHearts()
321
- return (((hearts + soulHearts) + boneHearts) + eternalHearts) - rottenHearts
303
+ return hearts + soulHearts + boneHearts + eternalHearts - rottenHearts
322
304
  end
323
305
  function ____exports.getPlayersOfType(self, playerType)
324
306
  local players = {}
325
- for ____, player in ipairs(
326
- ____exports.getPlayers(nil)
327
- ) do
307
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
328
308
  local character = player:GetPlayerType()
329
309
  if character == playerType then
330
310
  __TS__ArrayPush(players, player)
@@ -339,9 +319,7 @@ function ____exports.getTotalCharge(self, player, activeSlot)
339
319
  end
340
320
  function ____exports.getTotalPlayerCollectibles(self, collectibleType)
341
321
  local numCollectibles = 0
342
- for ____, player in ipairs(
343
- ____exports.getPlayers(nil)
344
- ) do
322
+ for ____, player in ipairs(____exports.getPlayers(nil)) do
345
323
  numCollectibles = numCollectibles + player:GetCollectibleNum(collectibleType)
346
324
  end
347
325
  return numCollectibles
@@ -359,32 +337,32 @@ function ____exports.hasOpenActiveItemSlot(self, player)
359
337
  local activeItemSecondary = player:GetActiveItem(ActiveSlot.SLOT_SECONDARY)
360
338
  local hasSchoolbag = player:HasCollectible(CollectibleType.COLLECTIBLE_SCHOOLBAG)
361
339
  if hasSchoolbag then
362
- return (activeItemPrimary == CollectibleType.COLLECTIBLE_NULL) or (activeItemSecondary == CollectibleType.COLLECTIBLE_NULL)
340
+ return activeItemPrimary == CollectibleType.COLLECTIBLE_NULL or activeItemSecondary == CollectibleType.COLLECTIBLE_NULL
363
341
  end
364
342
  return activeItemPrimary == CollectibleType.COLLECTIBLE_NULL
365
343
  end
366
344
  function ____exports.isBethany(self, player)
367
345
  local character = player:GetPlayerType()
368
- return (character == PlayerType.PLAYER_BETHANY) or (character == PlayerType.PLAYER_BETHANY_B)
346
+ return character == PlayerType.PLAYER_BETHANY or character == PlayerType.PLAYER_BETHANY_B
369
347
  end
370
348
  function ____exports.isFirstPlayer(self, player)
371
349
  return ____exports.getPlayerIndexVanilla(nil, player) == 0
372
350
  end
373
351
  function ____exports.isJacobOrEsau(self, player)
374
352
  local character = player:GetPlayerType()
375
- return (character == PlayerType.PLAYER_JACOB) or (character == PlayerType.PLAYER_ESAU)
353
+ return character == PlayerType.PLAYER_JACOB or character == PlayerType.PLAYER_ESAU
376
354
  end
377
355
  function ____exports.isKeeper(self, player)
378
356
  local character = player:GetPlayerType()
379
- return (character == PlayerType.PLAYER_KEEPER) or (character == PlayerType.PLAYER_KEEPER_B)
357
+ return character == PlayerType.PLAYER_KEEPER or character == PlayerType.PLAYER_KEEPER_B
380
358
  end
381
359
  function ____exports.isLost(self, player)
382
360
  local character = player:GetPlayerType()
383
- return (character == PlayerType.PLAYER_THELOST) or (character == PlayerType.PLAYER_THELOST_B)
361
+ return character == PlayerType.PLAYER_THELOST or character == PlayerType.PLAYER_THELOST_B
384
362
  end
385
363
  function ____exports.isTaintedLazarus(self, player)
386
364
  local character = player:GetPlayerType()
387
- return (character == PlayerType.PLAYER_LAZARUS_B) or (character == PlayerType.PLAYER_LAZARUS2_B)
365
+ return character == PlayerType.PLAYER_LAZARUS_B or character == PlayerType.PLAYER_LAZARUS2_B
388
366
  end
389
367
  function ____exports.removeCollectibleCostume(self, player, collectibleType)
390
368
  local itemConfig = Isaac.GetItemConfig()
@@ -427,9 +405,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
427
405
  itemPool:RemoveCollectible(collectibleType)
428
406
  end
429
407
  repeat
430
- local ____switch97 = activeSlot
431
- local ____cond97 = ____switch97 == ActiveSlot.SLOT_PRIMARY
432
- if ____cond97 then
408
+ local ____switch108 = activeSlot
409
+ local ____cond108 = ____switch108 == ActiveSlot.SLOT_PRIMARY
410
+ if ____cond108 then
433
411
  do
434
412
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
435
413
  player:RemoveCollectible(primaryCollectibleType)
@@ -438,8 +416,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
438
416
  break
439
417
  end
440
418
  end
441
- ____cond97 = ____cond97 or (____switch97 == ActiveSlot.SLOT_SECONDARY)
442
- if ____cond97 then
419
+ ____cond108 = ____cond108 or ____switch108 == ActiveSlot.SLOT_SECONDARY
420
+ if ____cond108 then
443
421
  do
444
422
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
445
423
  player:RemoveCollectible(primaryCollectibleType)
@@ -454,16 +432,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
454
432
  break
455
433
  end
456
434
  end
457
- ____cond97 = ____cond97 or (____switch97 == ActiveSlot.SLOT_POCKET)
458
- if ____cond97 then
435
+ ____cond108 = ____cond108 or ____switch108 == ActiveSlot.SLOT_POCKET
436
+ if ____cond108 then
459
437
  do
460
438
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
461
439
  player:SetActiveCharge(charge, activeSlot)
462
440
  break
463
441
  end
464
442
  end
465
- ____cond97 = ____cond97 or (____switch97 == ActiveSlot.SLOT_POCKET2)
466
- if ____cond97 then
443
+ ____cond108 = ____cond108 or ____switch108 == ActiveSlot.SLOT_POCKET2
444
+ if ____cond108 then
467
445
  do
468
446
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
469
447
  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
@@ -23,10 +23,10 @@ function ____exports.getPocketItems(self, player)
23
23
  __TS__ArrayPush(pocketItems, {type = PocketItemType.CARD, id = card, slot = slot})
24
24
  elseif pill ~= PillColor.PILL_NULL then
25
25
  __TS__ArrayPush(pocketItems, {type = PocketItemType.PILL, id = pill, slot = slot})
26
- elseif (hasPocketItem and (not hasPocketItem2)) and (not pocketItemIdentified) then
26
+ elseif hasPocketItem and not hasPocketItem2 and not pocketItemIdentified then
27
27
  pocketItemIdentified = true
28
28
  __TS__ArrayPush(pocketItems, {type = PocketItemType.ACTIVE_ITEM, id = pocketItem, slot = slot})
29
- elseif ((not hasPocketItem) and hasPocketItem2) and (not pocketItem2Identified) then
29
+ elseif not hasPocketItem and hasPocketItem2 and not pocketItem2Identified then
30
30
  pocketItem2Identified = true
31
31
  __TS__ArrayPush(pocketItems, {type = PocketItemType.DICE_BAG_DICE, id = pocketItem2, slot = slot})
32
32
  elseif hasPocketItem and hasPocketItem2 then
@@ -34,7 +34,7 @@ function ____exports.getPocketItems(self, player)
34
34
  else
35
35
  __TS__ArrayPush(pocketItems, {type = PocketItemType.EMPTY, id = 0, slot = slot})
36
36
  end
37
- if (slot + 1) == maxPocketItems then
37
+ if slot + 1 == maxPocketItems then
38
38
  break
39
39
  end
40
40
  slot = slot + 1
@@ -45,7 +45,7 @@ end
45
45
  function ____exports.getFirstCardOrPill(self, player)
46
46
  local pocketItems = ____exports.getPocketItems(nil, player)
47
47
  for ____, pocketItem in ipairs(pocketItems) do
48
- if (pocketItem.type == PocketItemType.CARD) or (pocketItem.type == PocketItemType.PILL) then
48
+ if pocketItem.type == PocketItemType.CARD or pocketItem.type == PocketItemType.PILL then
49
49
  return pocketItem
50
50
  end
51
51
  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 = temporarilyRemoveTrinket(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
@@ -1,8 +1,8 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  /**
3
3
  * Helper function for quickly switching to a new room without playing a particular animation.
4
- * Always use this helper function over invoking `Game().ChangeRoom()` directly to ensure that you
5
- * do not forget to set the LeaveDoor property.
4
+ * Use this helper function over invoking `Game().ChangeRoom()` directly to ensure that you do not
5
+ * forget to set the LeaveDoor property and to prevent crashing on invalid room grid indexes.
6
6
  */
7
7
  export declare function changeRoom(roomGridIndex: int): void;
8
8
  export declare function getAllRoomGridIndexes(): int[];
@@ -220,3 +220,15 @@ export declare function setRoomCleared(): void;
220
220
  * spawns an NPC.
221
221
  */
222
222
  export declare function setRoomUncleared(): void;
223
+ /**
224
+ * Helper function to change the current room. It can be used for both teleportation and "normal"
225
+ * room transitions, depending on what is passed for the `direction` and `roomTransitionAnim`
226
+ * arguments. Use this function instead of invoking `Game.StartRoomTransition()` directly so that
227
+ * you do not forget to set `Level.LeaveDoor` property and to prevent crashing on invalid room grid
228
+ * indexes.
229
+ *
230
+ * @param roomGridIndex The room grid index of the destination room.
231
+ * @param direction Optional. Default is `Direction.NO_DIRECTION`.
232
+ * @param roomTransitionAnim Optional. Default is `RoomTransitionAnim.TELEPORT`.
233
+ */
234
+ export declare function teleport(roomGridIndex: int, direction?: Direction, roomTransitionAnim?: RoomTransitionAnim): void;