isaacscript-common 1.2.133 → 1.2.136

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.
@@ -3,6 +3,8 @@ local ____exports = {}
3
3
  local hasSubscriptions, postRender, postPEffectUpdateReordered, checkWaitingForItemAnimation, postPlayerFatalDamage, preBerserkDeath, playerIsAboutToDie, CustomReviveState, v
4
4
  local ____cachedClasses = require("cachedClasses")
5
5
  local sfxManager = ____cachedClasses.sfxManager
6
+ local ____runInNFrames = require("features.runInNFrames")
7
+ local runNextGameFrame = ____runInNFrames.runNextGameFrame
6
8
  local ____exports = require("features.saveDataManager.exports")
7
9
  local saveDataManager = ____exports.saveDataManager
8
10
  local ____collectibles = require("functions.collectibles")
@@ -10,6 +12,7 @@ local removeCollectibleFromItemTracker = ____collectibles.removeCollectibleFromI
10
12
  local ____familiars = require("functions.familiars")
11
13
  local removeAllFamiliars = ____familiars.removeAllFamiliars
12
14
  local ____player = require("functions.player")
15
+ local getPlayerFromIndex = ____player.getPlayerFromIndex
13
16
  local getPlayerIndex = ____player.getPlayerIndex
14
17
  local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
15
18
  local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
@@ -83,6 +86,27 @@ function playerIsAboutToDie(self, player)
83
86
  player:AddCollectible(CollectibleType.COLLECTIBLE_1UP, 0, false)
84
87
  removeAllFamiliars(nil, FamiliarVariant.ONE_UP)
85
88
  removeCollectibleFromItemTracker(nil, CollectibleType.COLLECTIBLE_1UP)
89
+ local character = player:GetPlayerType()
90
+ if character ~= PlayerType.PLAYER_SAMSON_B then
91
+ return
92
+ end
93
+ local playerIndex = getPlayerIndex(nil, player)
94
+ runNextGameFrame(
95
+ nil,
96
+ function()
97
+ local taintedSamson = getPlayerFromIndex(nil, playerIndex)
98
+ if taintedSamson == nil then
99
+ return
100
+ end
101
+ local effects = player:GetEffects()
102
+ local isBerserk = effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK)
103
+ if not isBerserk then
104
+ return
105
+ end
106
+ effects:RemoveCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK, -1)
107
+ removeAllFamiliars(nil, FamiliarVariant.ONE_UP)
108
+ end
109
+ )
86
110
  end
87
111
  CustomReviveState = CustomReviveState or ({})
88
112
  CustomReviveState.DISABLED = 0
@@ -14,6 +14,16 @@ export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boo
14
14
  * for. Returns true if any of the characters supplied are present.
15
15
  */
16
16
  export declare function anyPlayerIs(...matchingCharacters: Array<PlayerType | int>): boolean;
17
+ /**
18
+ * Helper function to determine if a player will destroy a rock/pot/skull/etc. if they walk over it.
19
+ *
20
+ * The following situations allow for this to be true:
21
+ * - the player has Leo (collectible 302)
22
+ * - the player has Thunder Thighs (collectible 314)
23
+ * - the player is under the effects of Mega Mush (collectible 625)
24
+ * - the player has Stompy (transformation 13)
25
+ */
26
+ export declare function canPlayerCrushRocks(player: EntityPlayer): boolean;
17
27
  /**
18
28
  * Helper function to determine if the provided character can have red heart containers. Returns
19
29
  * true for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper,
@@ -100,15 +100,15 @@ end
100
100
  function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
101
101
  local character = player:GetPlayerType()
102
102
  repeat
103
- local ____switch68 = character
104
- local ____cond68 = ____switch68 == PlayerType.PLAYER_THESOUL
105
- if ____cond68 then
103
+ local ____switch69 = character
104
+ local ____cond69 = ____switch69 == PlayerType.PLAYER_THESOUL
105
+ if ____cond69 then
106
106
  do
107
107
  return differentiateForgottenAndSoul and CollectibleType.COLLECTIBLE_SPOON_BENDER or DEFAULT_COLLECTIBLE_TYPE
108
108
  end
109
109
  end
110
- ____cond68 = ____cond68 or ____switch68 == PlayerType.PLAYER_LAZARUS2_B
111
- if ____cond68 then
110
+ ____cond69 = ____cond69 or ____switch69 == PlayerType.PLAYER_LAZARUS2_B
111
+ if ____cond69 then
112
112
  do
113
113
  return CollectibleType.COLLECTIBLE_INNER_EYE
114
114
  end
@@ -139,39 +139,39 @@ end
139
139
  function getAdjustedPlayerName(self, player)
140
140
  local character = player:GetPlayerType()
141
141
  repeat
142
- local ____switch81 = character
143
- local ____cond81 = ____switch81 == PlayerType.PLAYER_BLUEBABY or ____switch81 == PlayerType.PLAYER_BLUEBABY_B
144
- if ____cond81 then
142
+ local ____switch82 = character
143
+ local ____cond82 = ____switch82 == PlayerType.PLAYER_BLUEBABY or ____switch82 == PlayerType.PLAYER_BLUEBABY_B
144
+ if ____cond82 then
145
145
  do
146
146
  return "Blue Baby"
147
147
  end
148
148
  end
149
- ____cond81 = ____cond81 or ____switch81 == PlayerType.PLAYER_LAZARUS2
150
- if ____cond81 then
149
+ ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_LAZARUS2
150
+ if ____cond82 then
151
151
  do
152
152
  return "Lazarus II"
153
153
  end
154
154
  end
155
- ____cond81 = ____cond81 or ____switch81 == PlayerType.PLAYER_BLACKJUDAS
156
- if ____cond81 then
155
+ ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_BLACKJUDAS
156
+ if ____cond82 then
157
157
  do
158
158
  return "Dark Judas"
159
159
  end
160
160
  end
161
- ____cond81 = ____cond81 or ____switch81 == PlayerType.PLAYER_JACOB
162
- if ____cond81 then
161
+ ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_JACOB
162
+ if ____cond82 then
163
163
  do
164
164
  return "Jacob & Esau"
165
165
  end
166
166
  end
167
- ____cond81 = ____cond81 or ____switch81 == PlayerType.PLAYER_LAZARUS2_B
168
- if ____cond81 then
167
+ ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_LAZARUS2_B
168
+ if ____cond82 then
169
169
  do
170
170
  return "Dead Tainted Lazarus"
171
171
  end
172
172
  end
173
- ____cond81 = ____cond81 or ____switch81 == PlayerType.PLAYER_JACOB2_B
174
- if ____cond81 then
173
+ ____cond82 = ____cond82 or ____switch82 == PlayerType.PLAYER_JACOB2_B
174
+ if ____cond82 then
175
175
  do
176
176
  return "Dead Tainted Jacob"
177
177
  end
@@ -292,6 +292,10 @@ function ____exports.anyPlayerIs(self, ...)
292
292
  function(____, character) return matchingCharacterSet:has(character) end
293
293
  )
294
294
  end
295
+ function ____exports.canPlayerCrushRocks(self, player)
296
+ local effects = player:GetEffects()
297
+ return player:HasCollectible(CollectibleType.COLLECTIBLE_LEO) or player:HasCollectible(CollectibleType.COLLECTIBLE_THUNDER_THIGHS) or effects:HasCollectibleEffect(CollectibleType.COLLECTIBLE_MEGA_MUSH) or player:HasPlayerForm(PlayerForm.PLAYERFORM_STOMPY)
298
+ end
295
299
  function ____exports.characterCanHaveRedHearts(self, character)
296
300
  return not CHARACTERS_WITH_NO_RED_HEARTS:has(character)
297
301
  end
@@ -616,9 +620,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
616
620
  itemPool:RemoveCollectible(collectibleType)
617
621
  end
618
622
  repeat
619
- local ____switch132 = activeSlot
620
- local ____cond132 = ____switch132 == ActiveSlot.SLOT_PRIMARY
621
- if ____cond132 then
623
+ local ____switch133 = activeSlot
624
+ local ____cond133 = ____switch133 == ActiveSlot.SLOT_PRIMARY
625
+ if ____cond133 then
622
626
  do
623
627
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
624
628
  player:RemoveCollectible(primaryCollectibleType)
@@ -627,8 +631,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
627
631
  break
628
632
  end
629
633
  end
630
- ____cond132 = ____cond132 or ____switch132 == ActiveSlot.SLOT_SECONDARY
631
- if ____cond132 then
634
+ ____cond133 = ____cond133 or ____switch133 == ActiveSlot.SLOT_SECONDARY
635
+ if ____cond133 then
632
636
  do
633
637
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
634
638
  player:RemoveCollectible(primaryCollectibleType)
@@ -643,16 +647,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
643
647
  break
644
648
  end
645
649
  end
646
- ____cond132 = ____cond132 or ____switch132 == ActiveSlot.SLOT_POCKET
647
- if ____cond132 then
650
+ ____cond133 = ____cond133 or ____switch133 == ActiveSlot.SLOT_POCKET
651
+ if ____cond133 then
648
652
  do
649
653
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
650
654
  player:SetActiveCharge(charge, activeSlot)
651
655
  break
652
656
  end
653
657
  end
654
- ____cond132 = ____cond132 or ____switch132 == ActiveSlot.SLOT_POCKET2
655
- if ____cond132 then
658
+ ____cond133 = ____cond133 or ____switch133 == ActiveSlot.SLOT_POCKET2
659
+ if ____cond133 then
656
660
  do
657
661
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
658
662
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.133",
3
+ "version": "1.2.136",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",