isaacscript-common 9.16.1 → 9.17.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.
@@ -3,6 +3,14 @@
3
3
  import { HealthType } from "../enums/HealthType";
4
4
  import { PlayerHealth } from "../interfaces/PlayerHealth";
5
5
  export declare function addPlayerHealthType(player: EntityPlayer, healthType: HealthType, numHearts: int): void;
6
+ /**
7
+ * Helper function to see if the provided player can pick up an eternal heart. (If a player already
8
+ * has an eternal heart and full heart containers, they are not able to pick up any additional
9
+ * eternal hearts.)
10
+ *
11
+ * This function's name matches the existing `EntityPlayer` methods.
12
+ */
13
+ export declare function canPickEternalHearts(player: EntityPlayer): boolean;
6
14
  /**
7
15
  * Returns whether or not all of the player's soul-heart-type hearts are black hearts.
8
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAQzE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,GACb,IAAI,CA+CN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAK1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAKzE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAYtE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAK9D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CA2ElE;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAmDL;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAKzD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAoDnE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAqCrE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAK7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,wCAAwC,CACtD,MAAM,EAAE,YAAY,GACnB,GAAG,CAML;AAED,sDAAsD;AACtD,wBAAgB,eAAe,IAAI,YAAY,CAc9C;AAED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,YAAY,GACnB,IAAI,CAQN;AAED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,YAAY,GACnB,IAAI,CAQN;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAMjE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAwBhE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,YAAY,GACzB,IAAI,CAsHN;AAED;;;;;;;;;GASG;AACH,wBAAgB,sDAAsD,CACpE,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,KAAK,GAClB,OAAO,CAyBT"}
1
+ {"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAQzE,wBA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AAoC,CAClD,MAAM,EAAE,YAAY,GACnB,IAAI,CAQN;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAMjE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAwBhE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,YAAY,GACzB,IAAI,CAsHN;AAED;;;;;;;;;GASG;AACH,wBAAgB,sDAAsD,CACpE,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,KAAK,GAClB,OAAO,CAyBT"}
@@ -135,25 +135,25 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
135
135
  addAmount = 1
136
136
  end
137
137
  repeat
138
- local ____switch71 = soulHeartType
139
- local ____cond71 = ____switch71 == HeartSubType.SOUL
140
- if ____cond71 then
138
+ local ____switch72 = soulHeartType
139
+ local ____cond72 = ____switch72 == HeartSubType.SOUL
140
+ if ____cond72 then
141
141
  do
142
142
  player:AddSoulHearts(addAmount)
143
143
  soulHeartsRemaining = soulHeartsRemaining - addAmount
144
144
  break
145
145
  end
146
146
  end
147
- ____cond71 = ____cond71 or ____switch71 == HeartSubType.BLACK
148
- if ____cond71 then
147
+ ____cond72 = ____cond72 or ____switch72 == HeartSubType.BLACK
148
+ if ____cond72 then
149
149
  do
150
150
  player:AddBlackHearts(addAmount)
151
151
  soulHeartsRemaining = soulHeartsRemaining - addAmount
152
152
  break
153
153
  end
154
154
  end
155
- ____cond71 = ____cond71 or ____switch71 == HeartSubType.BONE
156
- if ____cond71 then
155
+ ____cond72 = ____cond72 or ____switch72 == HeartSubType.BONE
156
+ if ____cond72 then
157
157
  do
158
158
  player:AddBoneHearts(addAmount)
159
159
  break
@@ -271,6 +271,17 @@ function ____exports.addPlayerHealthType(self, player, healthType, numHearts)
271
271
  end
272
272
  until true
273
273
  end
274
+ --- Helper function to see if the provided player can pick up an eternal heart. (If a player already
275
+ -- has an eternal heart and full heart containers, they are not able to pick up any additional
276
+ -- eternal hearts.)
277
+ --
278
+ -- This function's name matches the existing `EntityPlayer` methods.
279
+ function ____exports.canPickEternalHearts(self, player)
280
+ local eternalHearts = player:GetEternalHearts()
281
+ local maxHearts = player:GetMaxHearts()
282
+ local heartLimit = player:GetHeartLimit()
283
+ return eternalHearts == 0 or maxHearts ~= heartLimit
284
+ end
274
285
  --- Returns whether or not all of the player's soul-heart-type hearts are black hearts.
275
286
  --
276
287
  -- Note that this function does not consider red heart containers.
@@ -385,57 +396,57 @@ function ____exports.getPlayerHealth(self, player)
385
396
  end
386
397
  function ____exports.getPlayerHealthType(self, player, healthType)
387
398
  repeat
388
- local ____switch28 = healthType
389
- local ____cond28 = ____switch28 == HealthType.RED
390
- if ____cond28 then
399
+ local ____switch29 = healthType
400
+ local ____cond29 = ____switch29 == HealthType.RED
401
+ if ____cond29 then
391
402
  do
392
403
  return ____exports.getPlayerHearts(nil, player)
393
404
  end
394
405
  end
395
- ____cond28 = ____cond28 or ____switch28 == HealthType.SOUL
396
- if ____cond28 then
406
+ ____cond29 = ____cond29 or ____switch29 == HealthType.SOUL
407
+ if ____cond29 then
397
408
  do
398
409
  return ____exports.getPlayerSoulHearts(nil, player)
399
410
  end
400
411
  end
401
- ____cond28 = ____cond28 or ____switch28 == HealthType.ETERNAL
402
- if ____cond28 then
412
+ ____cond29 = ____cond29 or ____switch29 == HealthType.ETERNAL
413
+ if ____cond29 then
403
414
  do
404
415
  return player:GetEternalHearts()
405
416
  end
406
417
  end
407
- ____cond28 = ____cond28 or ____switch28 == HealthType.BLACK
408
- if ____cond28 then
418
+ ____cond29 = ____cond29 or ____switch29 == HealthType.BLACK
419
+ if ____cond29 then
409
420
  do
410
421
  return ____exports.getPlayerBlackHearts(nil, player)
411
422
  end
412
423
  end
413
- ____cond28 = ____cond28 or ____switch28 == HealthType.GOLDEN
414
- if ____cond28 then
424
+ ____cond29 = ____cond29 or ____switch29 == HealthType.GOLDEN
425
+ if ____cond29 then
415
426
  do
416
427
  return player:GetGoldenHearts()
417
428
  end
418
429
  end
419
- ____cond28 = ____cond28 or ____switch28 == HealthType.BONE
420
- if ____cond28 then
430
+ ____cond29 = ____cond29 or ____switch29 == HealthType.BONE
431
+ if ____cond29 then
421
432
  do
422
433
  return player:GetBoneHearts()
423
434
  end
424
435
  end
425
- ____cond28 = ____cond28 or ____switch28 == HealthType.ROTTEN
426
- if ____cond28 then
436
+ ____cond29 = ____cond29 or ____switch29 == HealthType.ROTTEN
437
+ if ____cond29 then
427
438
  do
428
439
  return player:GetRottenHearts()
429
440
  end
430
441
  end
431
- ____cond28 = ____cond28 or ____switch28 == HealthType.BROKEN
432
- if ____cond28 then
442
+ ____cond29 = ____cond29 or ____switch29 == HealthType.BROKEN
443
+ if ____cond29 then
433
444
  do
434
445
  return player:GetBrokenHearts()
435
446
  end
436
447
  end
437
- ____cond28 = ____cond28 or ____switch28 == HealthType.MAX_HEARTS
438
- if ____cond28 then
448
+ ____cond29 = ____cond29 or ____switch29 == HealthType.MAX_HEARTS
449
+ if ____cond29 then
439
450
  do
440
451
  return player:GetMaxHearts()
441
452
  end
package/dist/index.d.ts CHANGED
@@ -607,6 +607,15 @@ export declare function calculateStageType(stage: LevelStage): StageType;
607
607
  */
608
608
  export declare function calculateStageTypeRepentance(stage: LevelStage): StageType;
609
609
 
610
+ /**
611
+ * Helper function to see if the provided player can pick up an eternal heart. (If a player already
612
+ * has an eternal heart and full heart containers, they are not able to pick up any additional
613
+ * eternal hearts.)
614
+ *
615
+ * This function's name matches the existing `EntityPlayer` methods.
616
+ */
617
+ export declare function canPickEternalHearts(player: EntityPlayer): boolean;
618
+
610
619
  /**
611
620
  * Helper function to determine if a player will destroy a rock/pot/skull if they walk over it.
612
621
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "9.16.1",
3
+ "version": "9.17.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -68,6 +68,21 @@ export function addPlayerHealthType(
68
68
  }
69
69
  }
70
70
 
71
+ /**
72
+ * Helper function to see if the provided player can pick up an eternal heart. (If a player already
73
+ * has an eternal heart and full heart containers, they are not able to pick up any additional
74
+ * eternal hearts.)
75
+ *
76
+ * This function's name matches the existing `EntityPlayer` methods.
77
+ */
78
+ export function canPickEternalHearts(player: EntityPlayer): boolean {
79
+ const eternalHearts = player.GetEternalHearts();
80
+ const maxHearts = player.GetMaxHearts();
81
+ const heartLimit = player.GetHeartLimit();
82
+
83
+ return eternalHearts === 0 || maxHearts !== heartLimit;
84
+ }
85
+
71
86
  /**
72
87
  * Returns whether or not all of the player's soul-heart-type hearts are black hearts.
73
88
  *