isaacscript-common 8.4.6 → 8.5.0

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 (63) hide show
  1. package/dist/features/characterStats.d.ts.map +1 -1
  2. package/dist/features/characterStats.lua +1 -2
  3. package/dist/features/firstLast.d.ts +6 -3
  4. package/dist/features/firstLast.d.ts.map +1 -1
  5. package/dist/features/firstLast.lua +6 -3
  6. package/dist/functions/bosses.d.ts +5 -2
  7. package/dist/functions/bosses.d.ts.map +1 -1
  8. package/dist/functions/bosses.lua +11 -6
  9. package/dist/functions/collectibleCacheFlag.d.ts +1 -1
  10. package/dist/functions/collectibleCacheFlag.d.ts.map +1 -1
  11. package/dist/functions/collectibleCacheFlag.lua +1 -2
  12. package/dist/functions/collectibleSet.lua +32 -32
  13. package/dist/functions/collectibleTag.d.ts +1 -1
  14. package/dist/functions/collectibleTag.d.ts.map +1 -1
  15. package/dist/functions/collectibleTag.lua +1 -3
  16. package/dist/functions/eden.d.ts +1 -1
  17. package/dist/functions/eden.d.ts.map +1 -1
  18. package/dist/functions/eden.lua +1 -2
  19. package/dist/functions/flying.d.ts +1 -1
  20. package/dist/functions/flying.d.ts.map +1 -1
  21. package/dist/functions/flying.lua +5 -2
  22. package/dist/functions/input.d.ts +2 -2
  23. package/dist/functions/input.d.ts.map +1 -1
  24. package/dist/functions/input.lua +2 -4
  25. package/dist/functions/playerHealth.d.ts +93 -0
  26. package/dist/functions/playerHealth.d.ts.map +1 -1
  27. package/dist/functions/playerHealth.lua +216 -33
  28. package/dist/functions/players.d.ts +1 -111
  29. package/dist/functions/players.d.ts.map +1 -1
  30. package/dist/functions/players.lua +20 -279
  31. package/dist/functions/revive.d.ts.map +1 -1
  32. package/dist/functions/revive.lua +2 -1
  33. package/dist/functions/stats.d.ts +16 -0
  34. package/dist/functions/stats.d.ts.map +1 -1
  35. package/dist/functions/stats.lua +78 -0
  36. package/dist/functions/transformations.d.ts +1 -1
  37. package/dist/functions/transformations.d.ts.map +1 -1
  38. package/dist/functions/trinketCacheFlag.d.ts +1 -1
  39. package/dist/functions/trinketCacheFlag.d.ts.map +1 -1
  40. package/dist/functions/trinketCacheFlag.lua +1 -3
  41. package/dist/functions/trinketSet.lua +32 -32
  42. package/dist/index.d.ts +19 -30
  43. package/dist/sets/bossSets.d.ts +1 -0
  44. package/dist/sets/bossSets.d.ts.map +1 -1
  45. package/dist/sets/bossSets.lua +19 -0
  46. package/package.json +1 -1
  47. package/src/features/characterStats.ts +1 -2
  48. package/src/features/firstLast.ts +6 -3
  49. package/src/functions/bosses.ts +15 -6
  50. package/src/functions/collectibleCacheFlag.ts +3 -3
  51. package/src/functions/collectibleSet.ts +32 -32
  52. package/src/functions/collectibleTag.ts +2 -3
  53. package/src/functions/eden.ts +3 -3
  54. package/src/functions/flying.ts +4 -4
  55. package/src/functions/input.ts +4 -5
  56. package/src/functions/playerHealth.ts +269 -7
  57. package/src/functions/players.ts +1 -348
  58. package/src/functions/revive.ts +2 -6
  59. package/src/functions/stats.ts +75 -0
  60. package/src/functions/transformations.ts +1 -1
  61. package/src/functions/trinketCacheFlag.ts +2 -3
  62. package/src/functions/trinketSet.ts +32 -32
  63. package/src/sets/bossSets.ts +24 -0
@@ -1,7 +1,7 @@
1
1
  local ____lualib = require("lualib_bundle")
2
+ local __TS__ArraySome = ____lualib.__TS__ArraySome
2
3
  local Set = ____lualib.Set
3
4
  local __TS__New = ____lualib.__TS__New
4
- local __TS__ArraySome = ____lualib.__TS__ArraySome
5
5
  local __TS__ArrayFind = ____lualib.__TS__ArrayFind
6
6
  local __TS__ArrayMap = ____lualib.__TS__ArrayMap
7
7
  local Map = ____lualib.Map
@@ -11,7 +11,6 @@ local ____exports = {}
11
11
  local isTaintedModded
12
12
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
13
13
  local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
14
- local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
15
14
  local Challenge = ____isaac_2Dtypescript_2Ddefinitions.Challenge
16
15
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
17
16
  local FamiliarVariant = ____isaac_2Dtypescript_2Ddefinitions.FamiliarVariant
@@ -23,17 +22,10 @@ local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
23
22
  local ____cachedClasses = require("core.cachedClasses")
24
23
  local game = ____cachedClasses.game
25
24
  local itemConfig = ____cachedClasses.itemConfig
26
- local ____HealthType = require("enums.HealthType")
27
- local HealthType = ____HealthType.HealthType
28
25
  local ____array = require("functions.array")
29
26
  local getLastElement = ____array.getLastElement
30
27
  local sumArray = ____array.sumArray
31
- local ____bitwise = require("functions.bitwise")
32
- local countSetBits = ____bitwise.countSetBits
33
- local getKBitOfN = ____bitwise.getKBitOfN
34
- local getNumBitsOfN = ____bitwise.getNumBitsOfN
35
28
  local ____characters = require("functions.characters")
36
- local getCharacterMaxHeartContainers = ____characters.getCharacterMaxHeartContainers
37
29
  local getCharacterName = ____characters.getCharacterName
38
30
  local isVanillaCharacter = ____characters.isVanillaCharacter
39
31
  local ____collectibles = require("functions.collectibles")
@@ -46,8 +38,6 @@ local ____playerIndex = require("functions.playerIndex")
46
38
  local getAllPlayers = ____playerIndex.getAllPlayers
47
39
  local getPlayerIndexVanilla = ____playerIndex.getPlayerIndexVanilla
48
40
  local getPlayers = ____playerIndex.getPlayers
49
- local ____tears = require("functions.tears")
50
- local addTearsStat = ____tears.addTearsStat
51
41
  local ____types = require("functions.types")
52
42
  local isNumber = ____types.isNumber
53
43
  local ____utils = require("functions.utils")
@@ -60,47 +50,6 @@ function ____exports.getCharacters(self)
60
50
  function(____, player) return player:GetPlayerType() end
61
51
  )
62
52
  end
63
- --- Returns the number of black hearts that the player has, excluding any soul hearts. For example,
64
- -- if the player has one full black heart, one full soul heart, and one half black heart, this
65
- -- function returns 3.
66
- --
67
- -- This is different from the `EntityPlayer.GetBlackHearts` method, since that returns a bitmask.
68
- function ____exports.getPlayerBlackHearts(self, player)
69
- local blackHeartsBitmask = player:GetBlackHearts()
70
- local blackHeartBits = countSetBits(nil, blackHeartsBitmask)
71
- return blackHeartBits * 2
72
- end
73
- --- Returns the maximum heart containers that the provided player can have. Normally, this is 12, but
74
- -- it can change depending on the character (e.g. Keeper) and other things (e.g. Mother's Kiss).
75
- -- This function does not account for Broken Hearts; use the `getPlayerAvailableHeartSlots` helper
76
- -- function for that.
77
- function ____exports.getPlayerMaxHeartContainers(self, player)
78
- local character = player:GetPlayerType()
79
- local characterMaxHeartContainers = getCharacterMaxHeartContainers(nil, character)
80
- if character == PlayerType.MAGDALENE and player:HasCollectible(CollectibleType.BIRTHRIGHT) then
81
- local extraMaxHeartContainersFromBirthright = 6
82
- return characterMaxHeartContainers + extraMaxHeartContainersFromBirthright
83
- end
84
- if ____exports.isKeeper(nil, player) then
85
- local numMothersKisses = player:GetTrinketMultiplier(TrinketType.MOTHERS_KISS)
86
- local hasGreedsGullet = player:HasCollectible(CollectibleType.GREEDS_GULLET)
87
- local coins = player:GetNumCoins()
88
- local greedsGulletCoinContainers = hasGreedsGullet and math.floor(coins / 25) or 0
89
- return characterMaxHeartContainers + numMothersKisses + greedsGulletCoinContainers
90
- end
91
- return characterMaxHeartContainers
92
- end
93
- --- Returns the number of soul hearts that the player has, excluding any black hearts. For example,
94
- -- if the player has one full black heart, one full soul heart, and one half black heart, this
95
- -- function returns 2.
96
- --
97
- -- This is different from the `EntityPlayer.GetSoulHearts` method, since that returns the combined
98
- -- number of soul hearts and black hearts.
99
- function ____exports.getPlayerSoulHearts(self, player)
100
- local soulHearts = player:GetSoulHearts()
101
- local blackHearts = ____exports.getPlayerBlackHearts(nil, player)
102
- return soulHearts - blackHearts
103
- end
104
53
  --- Helper function to check if a player is a specific character (i.e. `PlayerType`).
105
54
  --
106
55
  -- This function is variadic, meaning that you can supply as many characters as you want to check
@@ -111,12 +60,6 @@ function ____exports.isCharacter(self, player, ...)
111
60
  local character = player:GetPlayerType()
112
61
  return characterSet:has(character)
113
62
  end
114
- --- Helper function for detecting when a player is Keeper or Tainted Keeper. Useful for situations
115
- -- where you want to know if the health is coin hearts, for example.
116
- function ____exports.isKeeper(self, player)
117
- local character = player:GetPlayerType()
118
- return character == PlayerType.KEEPER or character == PlayerType.KEEPER_B
119
- end
120
63
  function ____exports.isModdedPlayer(self, player)
121
64
  return not ____exports.isVanillaPlayer(nil, player)
122
65
  end
@@ -130,14 +73,6 @@ function ____exports.isVanillaPlayer(self, player)
130
73
  local character = player:GetPlayerType()
131
74
  return isVanillaCharacter(nil, character)
132
75
  end
133
- local STAT_CACHE_FLAGS_SET = __TS__New(Set, {
134
- CacheFlag.DAMAGE,
135
- CacheFlag.FIRE_DELAY,
136
- CacheFlag.SHOT_SPEED,
137
- CacheFlag.RANGE,
138
- CacheFlag.SPEED,
139
- CacheFlag.LUCK
140
- })
141
76
  function ____exports.addCollectibleCostume(self, player, collectibleType)
142
77
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
143
78
  if itemConfigItem == nil then
@@ -145,69 +80,6 @@ function ____exports.addCollectibleCostume(self, player, collectibleType)
145
80
  end
146
81
  player:AddCostume(itemConfigItem, false)
147
82
  end
148
- --- Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
149
- -- from the `EVALUATE_CACHE` callback.
150
- --
151
- -- Note that for `CacheFlag.FIRE_DELAY`, the "amount" argument will be interpreted as the tear stat
152
- -- to add (and not the amount to mutate `EntityPlayer.MaxFireDelay` by).
153
- --
154
- -- This function supports the following cache flags:
155
- -- - CacheFlag.DAMAGE (1 << 0)
156
- -- - CacheFlag.FIRE_DELAY (1 << 1)
157
- -- - CacheFlag.SHOT_SPEED (1 << 2)
158
- -- - CacheFlag.RANGE (1 << 3)
159
- -- - CacheFlag.SPEED (1 << 4)
160
- -- - CacheFlag.LUCK (1 << 10)
161
- function ____exports.addStat(self, player, cacheFlag, amount)
162
- if not STAT_CACHE_FLAGS_SET:has(cacheFlag) then
163
- error("You cannot add a stat to a player with the cache flag of: " .. tostring(cacheFlag))
164
- end
165
- repeat
166
- local ____switch6 = cacheFlag
167
- local ____cond6 = ____switch6 == CacheFlag.DAMAGE
168
- if ____cond6 then
169
- do
170
- player.Damage = player.Damage + amount
171
- break
172
- end
173
- end
174
- ____cond6 = ____cond6 or ____switch6 == CacheFlag.FIRE_DELAY
175
- if ____cond6 then
176
- do
177
- addTearsStat(nil, player, amount)
178
- break
179
- end
180
- end
181
- ____cond6 = ____cond6 or ____switch6 == CacheFlag.SHOT_SPEED
182
- if ____cond6 then
183
- do
184
- player.ShotSpeed = player.ShotSpeed + amount
185
- break
186
- end
187
- end
188
- ____cond6 = ____cond6 or ____switch6 == CacheFlag.RANGE
189
- if ____cond6 then
190
- do
191
- player.TearHeight = player.TearHeight + amount
192
- break
193
- end
194
- end
195
- ____cond6 = ____cond6 or ____switch6 == CacheFlag.SPEED
196
- if ____cond6 then
197
- do
198
- player.MoveSpeed = player.MoveSpeed + amount
199
- break
200
- end
201
- end
202
- ____cond6 = ____cond6 or ____switch6 == CacheFlag.LUCK
203
- if ____cond6 then
204
- do
205
- player.Luck = player.Luck + amount
206
- break
207
- end
208
- end
209
- until true
210
- end
211
83
  function ____exports.addTrinketCostume(self, player, trinketType)
212
84
  local itemConfigTrinket = itemConfig:GetTrinket(trinketType)
213
85
  if itemConfigTrinket == nil then
@@ -253,37 +125,6 @@ function ____exports.canPlayerCrushRocks(self, player)
253
125
  local effects = player:GetEffects()
254
126
  return player:HasCollectible(CollectibleType.LEO) or player:HasCollectible(CollectibleType.THUNDER_THIGHS) or effects:HasCollectibleEffect(CollectibleType.MEGA_MUSH) or player:HasPlayerForm(PlayerForm.STOMPY)
255
127
  end
256
- --- Returns whether or not all of the player's soul-heart-type hearts are black hearts.
257
- --
258
- -- Note that this function does not consider red heart containers.
259
- --
260
- -- For example:
261
- --
262
- -- - If the player has one black heart, this function would return true.
263
- -- - If the player has one soul heart and two black hearts, this function would return false.
264
- -- - If the player has no black hearts, this function will return false.
265
- -- - If the player has one red heart container and three black hearts, this function would return
266
- -- true.
267
- function ____exports.doesPlayerHaveAllBlackHearts(self, player)
268
- local soulHearts = ____exports.getPlayerSoulHearts(nil, player)
269
- local blackHearts = ____exports.getPlayerBlackHearts(nil, player)
270
- return blackHearts > 0 and soulHearts == 0
271
- end
272
- --- Returns whether or not all of the player's soul-heart-type hearts are soul hearts.
273
- --
274
- -- Note that this function does not consider red heart containers.
275
- --
276
- -- For example:
277
- --
278
- -- - If the player has two soul hearts and one black heart, this function would return false.
279
- -- - If the player has no soul hearts, this function will return false.
280
- -- - If the player has one red heart container and three soul hearts, this function would return
281
- -- true.
282
- function ____exports.doesPlayerHaveAllSoulHearts(self, player)
283
- local soulHearts = ____exports.getPlayerSoulHearts(nil, player)
284
- local blackHearts = ____exports.getPlayerBlackHearts(nil, player)
285
- return soulHearts > 0 and blackHearts == 0
286
- end
287
128
  --- Helper function to find the active slot that the player has the corresponding collectible type
288
129
  -- in. Returns undefined if the player does not have the collectible in any active slot.
289
130
  function ____exports.getActiveItemSlot(self, player, collectibleType)
@@ -364,20 +205,6 @@ function ____exports.getNewestPlayer(self)
364
205
  end
365
206
  return newestPlayer
366
207
  end
367
- --- Returns the number of slots that the player has remaining for new heart containers, accounting
368
- -- for broken hearts. For example, if the player is Judas and has 1 red heart containers and 2 full
369
- -- soul hearts and 3 broken hearts, then this function would return 6 (i.e. 12 - 1 - 2 - 3).
370
- function ____exports.getPlayerAvailableHeartSlots(self, player)
371
- local maxHeartContainers = ____exports.getPlayerMaxHeartContainers(nil, player)
372
- local effectiveMaxHearts = player:GetEffectiveMaxHearts()
373
- local normalAndBoneHeartContainers = effectiveMaxHearts / 2
374
- local soulHearts = player:GetSoulHearts()
375
- local soulHeartContainers = math.ceil(soulHearts / 2)
376
- local totalHeartContainers = normalAndBoneHeartContainers + soulHeartContainers
377
- local brokenHearts = player:GetBrokenHearts()
378
- local totalOccupiedHeartSlots = totalHeartContainers + brokenHearts
379
- return maxHeartContainers - totalOccupiedHeartSlots
380
- end
381
208
  --- Iterates over all players and checks if any are close enough to the specified position.
382
209
  --
383
210
  -- @returns The first player found when iterating upwards from index 0.
@@ -437,60 +264,6 @@ function ____exports.getPlayerFromTear(self, entity)
437
264
  end
438
265
  return nil
439
266
  end
440
- --- Returns the number of red hearts that the player has, excluding any rotten hearts. For example,
441
- -- if the player has one full black heart, one full soul heart, and one half black heart, this
442
- -- function returns 3.
443
- --
444
- -- This is different from the `EntityPlayer.GetHearts` method, since that returns a value that
445
- -- includes rotten hearts.
446
- function ____exports.getPlayerHearts(self, player)
447
- local rottenHearts = player:GetRottenHearts()
448
- local hearts = player:GetHearts()
449
- return hearts - rottenHearts * 2
450
- end
451
- --- Helper function that returns the type of the rightmost heart. This does not including golden
452
- -- hearts or broken hearts, since they cannot be damaged directly.
453
- function ____exports.getPlayerLastHeart(self, player)
454
- local hearts = player:GetHearts()
455
- local effectiveMaxHearts = player:GetEffectiveMaxHearts()
456
- local soulHearts = player:GetSoulHearts()
457
- local blackHearts = player:GetBlackHearts()
458
- local eternalHearts = player:GetEternalHearts()
459
- local boneHearts = player:GetBoneHearts()
460
- local rottenHearts = player:GetRottenHearts()
461
- local soulHeartSlots = soulHearts / 2
462
- local lastHeartIndex = boneHearts + soulHeartSlots - 1
463
- local isLastHeartBone = player:IsBoneHeart(lastHeartIndex)
464
- if isLastHeartBone then
465
- local isLastContainerEmpty = hearts <= effectiveMaxHearts - 2
466
- if isLastContainerEmpty then
467
- return HealthType.BONE
468
- end
469
- if rottenHearts > 0 then
470
- return HealthType.ROTTEN
471
- end
472
- if eternalHearts > 0 then
473
- return HealthType.ETERNAL
474
- end
475
- return HealthType.RED
476
- end
477
- if soulHearts > 0 then
478
- local numBits = getNumBitsOfN(nil, blackHearts)
479
- local finalBit = getKBitOfN(nil, numBits - 1, blackHearts)
480
- local isBlack = finalBit == 1
481
- if isBlack then
482
- return HealthType.BLACK
483
- end
484
- return HealthType.SOUL
485
- end
486
- if eternalHearts > 0 then
487
- return HealthType.ETERNAL
488
- end
489
- if rottenHearts > 0 then
490
- return HealthType.ROTTEN
491
- end
492
- return HealthType.RED
493
- end
494
267
  --- Helper function to get the proper name of the player. Use this instead of the
495
268
  -- `EntityPlayer.GetName` method because it accounts for Blue Baby, Lazarus II, and Tainted
496
269
  -- characters.
@@ -559,20 +332,6 @@ function ____exports.getPlayersWithTrinket(self, ...)
559
332
  ) end
560
333
  )
561
334
  end
562
- --- Helper function to determine how many heart containers that Tainted Magdalene has that will not
563
- -- be automatically depleted over time. By default, this is 2, but this function will return 4 so
564
- -- that it is consistent with the `player.GetHearts` and `player.GetMaxHearts` methods.
565
- --
566
- -- If Tainted Magdalene has Birthright, she will gained an additional non-temporary heart container.
567
- --
568
- -- This function does not validate whether or not the provided player is Tainted Magdalene; that
569
- -- should be accomplished before invoking this function.
570
- function ____exports.getTaintedMagdaleneNonTemporaryMaxHearts(self, player)
571
- local maxHearts = player:GetMaxHearts()
572
- local hasBirthright = player:HasCollectible(CollectibleType.BIRTHRIGHT)
573
- local maxNonTemporaryMaxHearts = hasBirthright and 6 or 4
574
- return math.min(maxHearts, maxNonTemporaryMaxHearts)
575
- end
576
335
  --- Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad
577
336
  -- Onion and player 2 has 2 Sad Onions, then this function would return 3.
578
337
  function ____exports.getTotalPlayerCollectibles(self, collectibleType)
@@ -641,6 +400,12 @@ function ____exports.isJacobOrEsau(self, player)
641
400
  local character = player:GetPlayerType()
642
401
  return character == PlayerType.JACOB or character == PlayerType.ESAU
643
402
  end
403
+ --- Helper function for detecting when a player is Keeper or Tainted Keeper. Useful for situations
404
+ -- where you want to know if the health is coin hearts, for example.
405
+ function ____exports.isKeeper(self, player)
406
+ local character = player:GetPlayerType()
407
+ return character == PlayerType.KEEPER or character == PlayerType.KEEPER_B
408
+ end
644
409
  --- Helper function for detecting when a player is The Lost or Tainted Lost.
645
410
  function ____exports.isLost(self, player)
646
411
  local character = player:GetPlayerType()
@@ -690,7 +455,7 @@ function ____exports.removeAllActiveItems(self, player)
690
455
  do
691
456
  local collectibleType = player:GetActiveItem(activeSlot)
692
457
  if collectibleType == CollectibleType.NULL then
693
- goto __continue114
458
+ goto __continue86
694
459
  end
695
460
  local hasCollectible
696
461
  repeat
@@ -700,7 +465,7 @@ function ____exports.removeAllActiveItems(self, player)
700
465
  end
701
466
  until not hasCollectible
702
467
  end
703
- ::__continue114::
468
+ ::__continue86::
704
469
  end
705
470
  end
706
471
  --- Helper function to remove all of the held trinkets from a player.
@@ -712,7 +477,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
712
477
  do
713
478
  local trinketType = player:GetTrinket(trinketSlot)
714
479
  if trinketType == TrinketType.NULL then
715
- goto __continue119
480
+ goto __continue91
716
481
  end
717
482
  local hasTrinket
718
483
  repeat
@@ -722,7 +487,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
722
487
  end
723
488
  until not hasTrinket
724
489
  end
725
- ::__continue119::
490
+ ::__continue91::
726
491
  end
727
492
  end
728
493
  --- Helper function to remove a collectible costume from a player. Use this helper function to avoid
@@ -785,9 +550,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
785
550
  itemPool:RemoveCollectible(collectibleType)
786
551
  end
787
552
  repeat
788
- local ____switch132 = activeSlot
789
- local ____cond132 = ____switch132 == ActiveSlot.PRIMARY
790
- if ____cond132 then
553
+ local ____switch104 = activeSlot
554
+ local ____cond104 = ____switch104 == ActiveSlot.PRIMARY
555
+ if ____cond104 then
791
556
  do
792
557
  if primaryCollectibleType ~= CollectibleType.NULL then
793
558
  player:RemoveCollectible(primaryCollectibleType)
@@ -796,8 +561,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
796
561
  break
797
562
  end
798
563
  end
799
- ____cond132 = ____cond132 or ____switch132 == ActiveSlot.SECONDARY
800
- if ____cond132 then
564
+ ____cond104 = ____cond104 or ____switch104 == ActiveSlot.SECONDARY
565
+ if ____cond104 then
801
566
  do
802
567
  if primaryCollectibleType ~= CollectibleType.NULL then
803
568
  player:RemoveCollectible(primaryCollectibleType)
@@ -812,16 +577,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
812
577
  break
813
578
  end
814
579
  end
815
- ____cond132 = ____cond132 or ____switch132 == ActiveSlot.POCKET
816
- if ____cond132 then
580
+ ____cond104 = ____cond104 or ____switch104 == ActiveSlot.POCKET
581
+ if ____cond104 then
817
582
  do
818
583
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
819
584
  player:SetActiveCharge(charge, activeSlot)
820
585
  break
821
586
  end
822
587
  end
823
- ____cond132 = ____cond132 or ____switch132 == ActiveSlot.POCKET_SINGLE_USE
824
- if ____cond132 then
588
+ ____cond104 = ____cond104 or ____switch104 == ActiveSlot.POCKET_SINGLE_USE
589
+ if ____cond104 then
825
590
  do
826
591
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
827
592
  break
@@ -870,28 +635,4 @@ function ____exports.useActiveItemTemp(self, player, collectibleType)
870
635
  -1
871
636
  )
872
637
  end
873
- --- Helper function to see if a certain damage amount would deal "permanent" damage to Tainted
874
- -- Magdalene.
875
- --
876
- -- Tainted Magdalene has "permanent" health and "temporary" health. When standing still and doing
877
- -- nothing, all of Tainted Magdalene's temporary health will eventually go away.
878
- --
879
- -- Before using this function, it is expected that you check to see if the player is Tainted
880
- -- Magdalene first, or else it will give a nonsensical result.
881
- function ____exports.wouldDamageTaintedMagdaleneNonTemporaryHeartContainers(self, player, damageAmount)
882
- local soulHearts = player:GetSoulHearts()
883
- if soulHearts > 0 then
884
- return false
885
- end
886
- local boneHearts = player:GetBoneHearts()
887
- if boneHearts > 0 then
888
- return false
889
- end
890
- local hearts = player:GetHearts()
891
- local rottenHearts = player:GetRottenHearts()
892
- local effectiveDamageAmount = damageAmount + math.min(rottenHearts, damageAmount)
893
- local heartsAfterDamage = hearts - effectiveDamageAmount
894
- local nonTemporaryMaxHearts = ____exports.getTaintedMagdaleneNonTemporaryMaxHearts(nil, player)
895
- return heartsAfterDamage < nonTemporaryMaxHearts
896
- end
897
638
  return ____exports
@@ -1 +1 @@
1
- {"version":3,"file":"revive.d.ts","sourceRoot":"","sources":["../../src/functions/revive.ts"],"names":[],"mappings":";;;AAsBA;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,SAAS,EACjB,mBAAmB,EAAE,GAAG,GAAG,SAAS,GACnC,OAAO,CAuFT;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAavE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAa9D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAYtE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAe1E"}
1
+ {"version":3,"file":"revive.d.ts","sourceRoot":"","sources":["../../src/functions/revive.ts"],"names":[],"mappings":";;;AAkBA;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,SAAS,EACjB,mBAAmB,EAAE,GAAG,GAAG,SAAS,GACnC,OAAO,CAuFT;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAavE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAa9D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAYtE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAe1E"}
@@ -12,8 +12,9 @@ local MAX_TAINTED_SAMSON_BERSERK_CHARGE = ____constants.MAX_TAINTED_SAMSON_BERSE
12
12
  local TAINTED_SAMSON_BERSERK_CHARGE_FROM_TAKING_DAMAGE = ____constants.TAINTED_SAMSON_BERSERK_CHARGE_FROM_TAKING_DAMAGE
13
13
  local ____characters = require("functions.characters")
14
14
  local getCharacterDeathAnimationName = ____characters.getCharacterDeathAnimationName
15
+ local ____playerHealth = require("functions.playerHealth")
16
+ local getPlayerMaxHeartContainers = ____playerHealth.getPlayerMaxHeartContainers
15
17
  local ____players = require("functions.players")
16
- local getPlayerMaxHeartContainers = ____players.getPlayerMaxHeartContainers
17
18
  local getPlayerNumHitsRemaining = ____players.getPlayerNumHitsRemaining
18
19
  local hasLostCurse = ____players.hasLostCurse
19
20
  local isKeeper = ____players.isKeeper
@@ -1,4 +1,20 @@
1
1
  import { CacheFlag } from "isaac-typescript-definitions";
2
+ /**
3
+ * Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
4
+ * from the `EVALUATE_CACHE` callback.
5
+ *
6
+ * Note that for `CacheFlag.FIRE_DELAY`, the "amount" argument will be interpreted as the tear stat
7
+ * to add (and not the amount to mutate `EntityPlayer.MaxFireDelay` by).
8
+ *
9
+ * This function supports the following cache flags:
10
+ * - CacheFlag.DAMAGE (1 << 0)
11
+ * - CacheFlag.FIRE_DELAY (1 << 1)
12
+ * - CacheFlag.SHOT_SPEED (1 << 2)
13
+ * - CacheFlag.RANGE (1 << 3)
14
+ * - CacheFlag.SPEED (1 << 4)
15
+ * - CacheFlag.LUCK (1 << 10)
16
+ */
17
+ export declare function addStat(player: EntityPlayer, cacheFlag: CacheFlag, amount: number): void;
2
18
  /**
3
19
  * Returns the starting stat that Isaac (the default character) starts with. For example, if you
4
20
  * pass this function `CacheFlag.DAMAGE`, it will return 3.5.
@@ -1 +1 @@
1
- {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/functions/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAE7E"}
1
+ {"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/functions/stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAazD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GACb,IAAI,CA4CN;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAE7E"}
@@ -1,6 +1,84 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
1
4
  local ____exports = {}
5
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
+ local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
2
7
  local ____defaultPlayerStatMap = require("maps.defaultPlayerStatMap")
3
8
  local DEFAULT_PLAYER_STAT_MAP = ____defaultPlayerStatMap.DEFAULT_PLAYER_STAT_MAP
9
+ local ____tears = require("functions.tears")
10
+ local addTearsStat = ____tears.addTearsStat
11
+ local STAT_CACHE_FLAGS_SET = __TS__New(Set, {
12
+ CacheFlag.DAMAGE,
13
+ CacheFlag.FIRE_DELAY,
14
+ CacheFlag.SHOT_SPEED,
15
+ CacheFlag.RANGE,
16
+ CacheFlag.SPEED,
17
+ CacheFlag.LUCK
18
+ })
19
+ --- Helper function to add a stat to a player based on the `CacheFlag` provided. Call this function
20
+ -- from the `EVALUATE_CACHE` callback.
21
+ --
22
+ -- Note that for `CacheFlag.FIRE_DELAY`, the "amount" argument will be interpreted as the tear stat
23
+ -- to add (and not the amount to mutate `EntityPlayer.MaxFireDelay` by).
24
+ --
25
+ -- This function supports the following cache flags:
26
+ -- - CacheFlag.DAMAGE (1 << 0)
27
+ -- - CacheFlag.FIRE_DELAY (1 << 1)
28
+ -- - CacheFlag.SHOT_SPEED (1 << 2)
29
+ -- - CacheFlag.RANGE (1 << 3)
30
+ -- - CacheFlag.SPEED (1 << 4)
31
+ -- - CacheFlag.LUCK (1 << 10)
32
+ function ____exports.addStat(self, player, cacheFlag, amount)
33
+ if not STAT_CACHE_FLAGS_SET:has(cacheFlag) then
34
+ error("You cannot add a stat to a player with the cache flag of: " .. tostring(cacheFlag))
35
+ end
36
+ repeat
37
+ local ____switch4 = cacheFlag
38
+ local ____cond4 = ____switch4 == CacheFlag.DAMAGE
39
+ if ____cond4 then
40
+ do
41
+ player.Damage = player.Damage + amount
42
+ break
43
+ end
44
+ end
45
+ ____cond4 = ____cond4 or ____switch4 == CacheFlag.FIRE_DELAY
46
+ if ____cond4 then
47
+ do
48
+ addTearsStat(nil, player, amount)
49
+ break
50
+ end
51
+ end
52
+ ____cond4 = ____cond4 or ____switch4 == CacheFlag.SHOT_SPEED
53
+ if ____cond4 then
54
+ do
55
+ player.ShotSpeed = player.ShotSpeed + amount
56
+ break
57
+ end
58
+ end
59
+ ____cond4 = ____cond4 or ____switch4 == CacheFlag.RANGE
60
+ if ____cond4 then
61
+ do
62
+ player.TearHeight = player.TearHeight + amount
63
+ break
64
+ end
65
+ end
66
+ ____cond4 = ____cond4 or ____switch4 == CacheFlag.SPEED
67
+ if ____cond4 then
68
+ do
69
+ player.MoveSpeed = player.MoveSpeed + amount
70
+ break
71
+ end
72
+ end
73
+ ____cond4 = ____cond4 or ____switch4 == CacheFlag.LUCK
74
+ if ____cond4 then
75
+ do
76
+ player.Luck = player.Luck + amount
77
+ break
78
+ end
79
+ end
80
+ until true
81
+ end
4
82
  --- Returns the starting stat that Isaac (the default character) starts with. For example, if you
5
83
  -- pass this function `CacheFlag.DAMAGE`, it will return 3.5.
6
84
  --
@@ -9,7 +9,7 @@ import { CollectibleType, PlayerForm } from "isaac-typescript-definitions";
9
9
  * const guppyCollectibleTypes = getCollectibleTypesForTransformation(PlayerForm.GUPPY);
10
10
  * ```
11
11
  */
12
- export declare function getCollectibleTypesForTransformation(playerForm: PlayerForm): Set<CollectibleType>;
12
+ export declare function getCollectibleTypesForTransformation(playerForm: PlayerForm): ReadonlySet<CollectibleType>;
13
13
  /** Returns the number of items that a player has towards a particular transformation. */
14
14
  export declare function getPlayerNumCollectiblesForTransformation(player: EntityPlayer, playerForm: PlayerForm): int;
15
15
  /** Returns a set of the player's current transformations. */
@@ -1 +1 @@
1
- {"version":3,"file":"transformations.d.ts","sourceRoot":"","sources":["../../src/functions/transformations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,UAAU,EACX,MAAM,8BAA8B,CAAC;AAiCtC;;;;;;;;;GASG;AACH,wBAAgB,oCAAoC,CAClD,UAAU,EAAE,UAAU,GACrB,GAAG,CAAC,eAAe,CAAC,CAStB;AAED,yFAAyF;AACzF,wBAAgB,yCAAyC,CACvD,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAGL;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,GACnB,GAAG,CAAC,UAAU,CAAC,CASjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEpE;AAED,wBAAgB,oCAAoC,CAClD,eAAe,EAAE,eAAe,GAC/B,GAAG,CAAC,UAAU,CAAC,CAiBjB;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAQrE;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAEtE"}
1
+ {"version":3,"file":"transformations.d.ts","sourceRoot":"","sources":["../../src/functions/transformations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,UAAU,EACX,MAAM,8BAA8B,CAAC;AAiCtC;;;;;;;;;GASG;AACH,wBAAgB,oCAAoC,CAClD,UAAU,EAAE,UAAU,GACrB,WAAW,CAAC,eAAe,CAAC,CAS9B;AAED,yFAAyF;AACzF,wBAAgB,yCAAyC,CACvD,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAGL;AAED,6DAA6D;AAC7D,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,GACnB,GAAG,CAAC,UAAU,CAAC,CASjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEpE;AAED,wBAAgB,oCAAoC,CAClD,eAAe,EAAE,eAAe,GAC/B,GAAG,CAAC,UAAU,CAAC,CAiBjB;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAQrE;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAEtE"}
@@ -13,7 +13,7 @@ export declare function getPlayerTrinketsForCacheFlag(player: EntityPlayer, cach
13
13
  * This function can only be called if at least one callback has been executed. This is because not
14
14
  * all trinkets will necessarily be present when a mod first loads (due to mod load order).
15
15
  */
16
- export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): Set<TrinketType>;
16
+ export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): ReadonlySet<TrinketType>;
17
17
  /** Helper function to check in the item config if a given trinket has a given cache flag. */
18
18
  export declare function trinketHasCacheFlag(trinketType: TrinketType, cacheFlag: CacheFlag): boolean;
19
19
  //# sourceMappingURL=trinketCacheFlag.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trinketCacheFlag.d.ts","sourceRoot":"","sources":["../../src/functions/trinketCacheFlag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AA2BtE;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,SAAS,GACnB,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAYvB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,GACnB,GAAG,CAAC,WAAW,CAAC,CASlB;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT"}
1
+ {"version":3,"file":"trinketCacheFlag.d.ts","sourceRoot":"","sources":["../../src/functions/trinketCacheFlag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AA0BtE;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,SAAS,GACnB,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAYvB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,SAAS,GACnB,WAAW,CAAC,WAAW,CAAC,CAS1B;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT"}
@@ -15,8 +15,6 @@ local ____enums = require("functions.enums")
15
15
  local getEnumValues = ____enums.getEnumValues
16
16
  local ____flag = require("functions.flag")
17
17
  local hasFlag = ____flag.hasFlag
18
- local ____set = require("functions.set")
19
- local copySet = ____set.copySet
20
18
  function lazyInitCacheFlagMap(self)
21
19
  if CACHE_FLAG_TO_TRINKETS_MAP.size > 0 then
22
20
  return
@@ -41,7 +39,7 @@ function ____exports.getTrinketsForCacheFlag(self, cacheFlag)
41
39
  if trinketsSet == nil then
42
40
  return __TS__New(Set)
43
41
  end
44
- return copySet(nil, trinketsSet)
42
+ return trinketsSet
45
43
  end
46
44
  --- Helper function to check in the item config if a given trinket has a given cache flag.
47
45
  function ____exports.trinketHasCacheFlag(self, trinketType, cacheFlag)