isaacscript-common 1.0.607 → 1.0.608

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.
@@ -8,7 +8,7 @@ local ____flag = require("functions.flag")
8
8
  local hasFlag = ____flag.hasFlag
9
9
  local ____player = require("functions.player")
10
10
  local getPlayerIndex = ____player.getPlayerIndex
11
- local getPlayerNumAllHearts = ____player.getPlayerNumAllHearts
11
+ local getPlayerNumHitsRemaining = ____player.getPlayerNumHitsRemaining
12
12
  local ____postCursedTeleport = require("callbacks.subscriptions.postCursedTeleport")
13
13
  local postCursedTeleportFire = ____postCursedTeleport.postCursedTeleportFire
14
14
  local postCursedTeleportHasSubscriptions = ____postCursedTeleport.postCursedTeleportHasSubscriptions
@@ -93,8 +93,8 @@ function playerIsTeleportingFromCursedTeleport(self, player, lastDamageFrame)
93
93
  if player:HasCollectible(CollectibleType.COLLECTIBLE_CURSED_EYE) then
94
94
  return true
95
95
  end
96
- local numHitsLeft = getPlayerNumAllHearts(nil, player)
97
- if player:HasTrinket(TrinketType.TRINKET_CURSED_SKULL) and numHitsLeft == 1 then
96
+ local numHitsRemaining = getPlayerNumHitsRemaining(nil, player)
97
+ if player:HasTrinket(TrinketType.TRINKET_CURSED_SKULL) and numHitsRemaining == 1 then
98
98
  return true
99
99
  end
100
100
  return false
@@ -2,7 +2,7 @@
2
2
  local ____exports = {}
3
3
  local hasSubscriptions, postPEffectUpdateReordered
4
4
  local ____player = require("functions.player")
5
- local getPlayerNumAllHearts = ____player.getPlayerNumAllHearts
5
+ local getPlayerNumHitsRemaining = ____player.getPlayerNumHitsRemaining
6
6
  local isChildPlayer = ____player.isChildPlayer
7
7
  local ____revive = require("functions.revive")
8
8
  local willPlayerRevive = ____revive.willPlayerRevive
@@ -23,8 +23,8 @@ function postPEffectUpdateReordered(self, player)
23
23
  end
24
24
  local effects = player:GetEffects()
25
25
  local berserkEffect = effects:GetCollectibleEffect(CollectibleType.COLLECTIBLE_BERSERK)
26
- local playerNumAllHearts = getPlayerNumAllHearts(nil, player)
27
- if berserkEffect ~= nil and berserkEffect.Cooldown == 1 and playerNumAllHearts == 0 and not willPlayerRevive(nil, player) then
26
+ local numHitsRemaining = getPlayerNumHitsRemaining(nil, player)
27
+ if berserkEffect ~= nil and berserkEffect.Cooldown == 1 and numHitsRemaining == 0 and not willPlayerRevive(nil, player) then
28
28
  preBerserkDeathFire(nil, player)
29
29
  end
30
30
  end
@@ -132,10 +132,15 @@ export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int |
132
132
  */
133
133
  export declare function getPlayerMaxHeartContainers(player: EntityPlayer): int;
134
134
  /**
135
- * Returns the combined value of all of the player's red hearts, soul/black hearts, and bone hearts.
136
- * This is equivalent to the number of hits that the player can currently take.
135
+ * Returns the combined value of all of the player's red hearts, soul/black hearts, and bone hearts,
136
+ * minus the value of the player's rotten hearts.
137
+ *
138
+ * This is equivalent to the number of hits that the player can currently take, but does not take
139
+ * into account double damage from champion enemies and/or being on later floors. (For example, on
140
+ * Womb 1, players who have 1 soul heart remaining would die in 1 hit to anything, even though this
141
+ * function would report that they have 2 hits remaining.)
137
142
  */
138
- export declare function getPlayerNumAllHearts(player: EntityPlayer): int;
143
+ export declare function getPlayerNumHitsRemaining(player: EntityPlayer): int;
139
144
  /**
140
145
  * This function always excludes players with a non-undefined parent, since they are not real
141
146
  * players. (e.g. the Strawman Keeper)
@@ -299,7 +299,7 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
299
299
  end
300
300
  return nil
301
301
  end
302
- function ____exports.getPlayerNumAllHearts(self, player)
302
+ function ____exports.getPlayerNumHitsRemaining(self, player)
303
303
  local hearts = player:GetHearts()
304
304
  local soulHearts = player:GetSoulHearts()
305
305
  local boneHearts = player:GetBoneHearts()
@@ -371,7 +371,7 @@ function ____exports.isDamageToPlayerFatal(self, player, damageAmount, damageSou
371
371
  if ____exports.hasLostCurse(nil, player) then
372
372
  return true
373
373
  end
374
- local playerNumAllHearts = ____exports.getPlayerNumAllHearts(nil, player)
374
+ local playerNumAllHearts = ____exports.getPlayerNumHitsRemaining(nil, player)
375
375
  if damageAmount < playerNumAllHearts then
376
376
  return false
377
377
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.607",
3
+ "version": "1.0.608",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",