isaacscript-common 1.0.530 → 1.0.534

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.
@@ -37,9 +37,12 @@ function queueEmpty(self, player, pickingUpItem)
37
37
  end
38
38
  function queueNotEmpty(self, player, pickingUpItem)
39
39
  local queuedItem = player.QueuedItem.Item
40
- if (queuedItem ~= nil) and (queuedItem.ID ~= pickingUpItem.id) then
41
- pickingUpItem.id = queuedItem.ID
40
+ if queuedItem == nil then
41
+ return
42
+ end
43
+ if (queuedItem.Type ~= pickingUpItem.type) or (queuedItem.ID ~= pickingUpItem.id) then
42
44
  pickingUpItem.type = queuedItem.Type
45
+ pickingUpItem.id = queuedItem.ID
43
46
  preItemPickupFire(nil, player, pickingUpItem)
44
47
  end
45
48
  end
@@ -21,6 +21,9 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
21
21
  if player == nil then
22
22
  return nil
23
23
  end
24
+ if player.Variant ~= 0 then
25
+ return nil
26
+ end
24
27
  if willPlayerRevive(nil, player) then
25
28
  return nil
26
29
  end
@@ -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,25 +306,13 @@ 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()
310
312
  local boneHearts = player:GetBoneHearts()
311
313
  local eternalHearts = player:GetEternalHearts()
312
- return ((hearts + soulHearts) + boneHearts) + eternalHearts
314
+ local rottenHearts = player:GetRottenHearts()
315
+ return (((hearts + soulHearts) + boneHearts) + eternalHearts) - rottenHearts
313
316
  end
314
317
  function ____exports.getPlayersOfType(self, playerType)
315
318
  local players = {}
@@ -81,8 +81,6 @@ local areFeaturesInitialized = ____initialized.areFeaturesInitialized
81
81
  local setFeaturesInitialized = ____initialized.setFeaturesInitialized
82
82
  local ____patchErrorFunctions = require("patchErrorFunctions")
83
83
  local patchErrorFunction = ____patchErrorFunctions.patchErrorFunction
84
- local ____patchPrintFunction = require("patchPrintFunction")
85
- local patchPrintFunction = ____patchPrintFunction.patchPrintFunction
86
84
  local ____ModUpgraded = require("types.ModUpgraded")
87
85
  local ModUpgraded = ____ModUpgraded.ModUpgraded
88
86
  function initCustomCallbacks(self, mod)
@@ -129,7 +127,6 @@ function ____exports.upgradeMod(self, modVanilla, verbose)
129
127
  verbose = false
130
128
  end
131
129
  patchErrorFunction(nil)
132
- patchPrintFunction(nil)
133
130
  local mod = __TS__New(ModUpgraded, modVanilla, verbose)
134
131
  if not areFeaturesInitialized(nil) then
135
132
  setFeaturesInitialized(nil)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.530",
3
+ "version": "1.0.534",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.297",
28
+ "isaac-typescript-definitions": "^1.0.300",
29
29
  "isaacscript-lint": "^1.0.72",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.4.4",