isaacscript-common 1.0.530 → 1.0.531

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.
@@ -18,6 +18,15 @@ local ____collectibleSet = require("functions.collectibleSet")
18
18
  local getCollectibleSet = ____collectibleSet.getCollectibleSet
19
19
  local ____util = require("functions.util")
20
20
  local ensureAllCases = ____util.ensureAllCases
21
+ function ____exports.getCharacterMaxHeartContainers(self, character)
22
+ if character == PlayerType.PLAYER_KEEPER then
23
+ return 3
24
+ end
25
+ if character == PlayerType.PLAYER_KEEPER_B then
26
+ return 2
27
+ end
28
+ return 12
29
+ end
21
30
  function ____exports.getPlayerIndex(self, player)
22
31
  local character = player:GetPlayerType()
23
32
  local collectibleToUse = ((character == PlayerType.PLAYER_LAZARUS2_B) and CollectibleType.COLLECTIBLE_INNER_EYE) or CollectibleType.COLLECTIBLE_SAD_ONION
@@ -25,6 +34,19 @@ function ____exports.getPlayerIndex(self, player)
25
34
  local seed = collectibleRNG:GetSeed()
26
35
  return seed
27
36
  end
37
+ function ____exports.getPlayerMaxHeartContainers(self, player)
38
+ local character = player:GetPlayerType()
39
+ local maxHeartContainers = ____exports.getCharacterMaxHeartContainers(nil, character)
40
+ if (character == PlayerType.PLAYER_MAGDALENE) and player:HasCollectible(CollectibleType.COLLECTIBLE_BIRTHRIGHT) then
41
+ maxHeartContainers = maxHeartContainers + 6
42
+ end
43
+ local numMothersKisses = player:GetTrinketMultiplier(TrinketType.TRINKET_MOTHERS_KISS)
44
+ maxHeartContainers = maxHeartContainers + numMothersKisses
45
+ if maxHeartContainers > MAX_PLAYER_HEART_CONTAINERS then
46
+ maxHeartContainers = MAX_PLAYER_HEART_CONTAINERS
47
+ end
48
+ return maxHeartContainers
49
+ end
28
50
  function ____exports.getPlayers(self, performExclusions)
29
51
  if performExclusions == nil then
30
52
  performExclusions = false
@@ -218,22 +240,15 @@ function ____exports.getNewestPlayer(self)
218
240
  return newestPlayer
219
241
  end
220
242
  function ____exports.getPlayerAvailableHeartSlots(self, player)
243
+ local maxHeartContainers = ____exports.getPlayerMaxHeartContainers(nil, player)
221
244
  local effectiveMaxHearts = player:GetEffectiveMaxHearts()
222
245
  local normalAndBoneHeartContainers = effectiveMaxHearts / 2
223
246
  local soulHearts = player:GetSoulHearts()
224
247
  local soulHeartContainers = math.ceil(soulHearts / 2)
225
248
  local totalHeartContainers = normalAndBoneHeartContainers + soulHeartContainers
226
249
  local brokenHearts = player:GetBrokenHearts()
227
- return totalHeartContainers - brokenHearts
228
- end
229
- function ____exports.getCharacterMaxHeartContainers(self, character)
230
- if character == PlayerType.PLAYER_KEEPER then
231
- return 3
232
- end
233
- if character == PlayerType.PLAYER_KEEPER_B then
234
- return 2
235
- end
236
- return 12
250
+ local totalOccupiedHeartSlots = totalHeartContainers + brokenHearts
251
+ return maxHeartContainers - totalOccupiedHeartSlots
237
252
  end
238
253
  function ____exports.getPlayerCloserThan(self, position, distance)
239
254
  for ____, player in ipairs(
@@ -291,19 +306,6 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
291
306
  end
292
307
  return nil
293
308
  end
294
- function ____exports.getPlayerMaxHeartContainers(self, player)
295
- local character = player:GetPlayerType()
296
- local maxHeartContainers = ____exports.getCharacterMaxHeartContainers(nil, character)
297
- if (character == PlayerType.PLAYER_MAGDALENE) and player:HasCollectible(CollectibleType.COLLECTIBLE_BIRTHRIGHT) then
298
- maxHeartContainers = maxHeartContainers + 6
299
- end
300
- local numMothersKisses = player:GetTrinketMultiplier(TrinketType.TRINKET_MOTHERS_KISS)
301
- maxHeartContainers = maxHeartContainers + numMothersKisses
302
- if maxHeartContainers > MAX_PLAYER_HEART_CONTAINERS then
303
- maxHeartContainers = MAX_PLAYER_HEART_CONTAINERS
304
- end
305
- return maxHeartContainers
306
- end
307
309
  function ____exports.getPlayerNumAllHearts(self, player)
308
310
  local hearts = player:GetHearts()
309
311
  local soulHearts = player:GetSoulHearts()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.530",
3
+ "version": "1.0.531",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",