isaacscript-common 1.0.491 → 1.0.492

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.
@@ -7,7 +7,15 @@ export declare const AZAZEL_DEFAULT_BRIMSTONE_DISTANCE = 75.125;
7
7
  /** Bombs explode when their frame count is equal to this value. */
8
8
  export declare const BOMB_EXPLODE_FRAME = 45;
9
9
  export declare const CHARACTERS_WITH_AN_ACTIVE_ITEM: Set<PlayerType>;
10
+ /**
11
+ * The set of characters where red heart containers will be turned into soul hearts (e.g. Blue
12
+ * Baby). This set includes The Lost and Tainted Lost.
13
+ */
10
14
  export declare const CHARACTERS_WITH_NO_RED_HEARTS: Set<PlayerType>;
15
+ /**
16
+ * The set of characters where soul hearts will be automatically stripped away (e.g. Bethany). This
17
+ * set includes The Lost and Tainted Lost.
18
+ */
11
19
  export declare const CHARACTERS_WITH_NO_SOUL_HEARTS: Set<PlayerType>;
12
20
  export declare const DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE;
13
21
  /** This is also the distance that a player spawns from the door that they enter a room from. */
@@ -18,13 +18,15 @@ ____exports.CHARACTERS_WITH_AN_ACTIVE_ITEM = __TS__New(Set, {
18
18
  })
19
19
  ____exports.CHARACTERS_WITH_NO_RED_HEARTS = __TS__New(Set, {
20
20
  PlayerType.PLAYER_BLUEBABY,
21
+ PlayerType.PLAYER_THELOST,
21
22
  PlayerType.PLAYER_BLACKJUDAS,
22
23
  PlayerType.PLAYER_JUDAS_B,
23
24
  PlayerType.PLAYER_BLUEBABY_B,
25
+ PlayerType.PLAYER_THELOST_B,
24
26
  PlayerType.PLAYER_THEFORGOTTEN_B,
25
27
  PlayerType.PLAYER_BETHANY_B
26
28
  })
27
- ____exports.CHARACTERS_WITH_NO_SOUL_HEARTS = __TS__New(Set, {PlayerType.PLAYER_BETHANY})
29
+ ____exports.CHARACTERS_WITH_NO_SOUL_HEARTS = __TS__New(Set, {PlayerType.PLAYER_THELOST, PlayerType.PLAYER_BETHANY, PlayerType.PLAYER_THELOST_B})
28
30
  ____exports.DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE
29
31
  ____exports.DISTANCE_OF_GRID_TILE = 40
30
32
  ____exports.DOOR_HITBOX_DISTANCE = 11
@@ -20,6 +20,18 @@ export declare function anyPlayerCloserThan(position: Vector, distance: float):
20
20
  export declare function anyPlayerHasCollectible(collectibleType: CollectibleType | int): boolean;
21
21
  export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boolean;
22
22
  export declare function anyPlayerIs(matchingCharacter: PlayerType): boolean;
23
+ /**
24
+ * Helper function to see if the provided character can have red heart containers. Returns true for
25
+ * characters like Isaac, Magdalene, or Cain. Returns false for characters like Blue Baby. Returns
26
+ * false for The Lost and Tainted Lost.
27
+ */
28
+ export declare function characterCanHaveRedHearts(character: PlayerType): boolean;
29
+ /**
30
+ * Helper function to see if the provided character can have soul hearts. Returns true for
31
+ * characters like Isaac, Magdalene, or Cain. Returns false for characters like Bethany. Returns
32
+ * false for The Lost and Tainted Lost.
33
+ */
34
+ export declare function characterCanHaveSoulHearts(character: PlayerType): boolean;
23
35
  /**
24
36
  * Helper function to get how long Azazel's Brimstone laser should be. You can pass either an
25
37
  * `EntityPlayer` object or a tear height stat.
@@ -3,6 +3,8 @@ require("lualib_bundle");
3
3
  local ____exports = {}
4
4
  local EXCLUDED_CHARACTERS
5
5
  local ____constants = require("constants")
6
+ local CHARACTERS_WITH_NO_RED_HEARTS = ____constants.CHARACTERS_WITH_NO_RED_HEARTS
7
+ local CHARACTERS_WITH_NO_SOUL_HEARTS = ____constants.CHARACTERS_WITH_NO_SOUL_HEARTS
6
8
  local LOST_STYLE_PLAYER_TYPES = ____constants.LOST_STYLE_PLAYER_TYPES
7
9
  local ____HealthType = require("types.HealthType")
8
10
  local HealthType = ____HealthType.HealthType
@@ -27,18 +29,18 @@ function ____exports.getPlayers(self, performExclusions)
27
29
  do
28
30
  local player = Isaac.GetPlayer(i)
29
31
  if player == nil then
30
- goto __continue51
32
+ goto __continue53
31
33
  end
32
34
  if ____exports.isChildPlayer(nil, player) then
33
- goto __continue51
35
+ goto __continue53
34
36
  end
35
37
  local character = player:GetPlayerType()
36
38
  if performExclusions and EXCLUDED_CHARACTERS:has(character) then
37
- goto __continue51
39
+ goto __continue53
38
40
  end
39
41
  __TS__ArrayPush(players, player)
40
42
  end
41
- ::__continue51::
43
+ ::__continue53::
42
44
  i = i + 1
43
45
  end
44
46
  end
@@ -104,6 +106,12 @@ function ____exports.anyPlayerIs(self, matchingCharacter)
104
106
  end
105
107
  return false
106
108
  end
109
+ function ____exports.characterCanHaveRedHearts(self, character)
110
+ return not CHARACTERS_WITH_NO_RED_HEARTS:has(character)
111
+ end
112
+ function ____exports.characterCanHaveSoulHearts(self, character)
113
+ return not CHARACTERS_WITH_NO_SOUL_HEARTS:has(character)
114
+ end
107
115
  function ____exports.getAzazelBrimstoneDistance(self, playerOrTearHeight)
108
116
  local tearHeight = tonumber(playerOrTearHeight)
109
117
  if tearHeight == nil then
@@ -243,14 +251,14 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
243
251
  do
244
252
  local player = Isaac.GetPlayer(i)
245
253
  if player == nil then
246
- goto __continue60
254
+ goto __continue62
247
255
  end
248
256
  local playerHash = GetPtrHash(player)
249
257
  if playerHash == playerToFindHash then
250
258
  return i
251
259
  end
252
260
  end
253
- ::__continue60::
261
+ ::__continue62::
254
262
  i = i + 1
255
263
  end
256
264
  end
@@ -356,9 +364,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
356
364
  itemPool:RemoveCollectible(collectibleType)
357
365
  end
358
366
  repeat
359
- local ____switch87 = activeSlot
360
- local ____cond87 = ____switch87 == ActiveSlot.SLOT_PRIMARY
361
- if ____cond87 then
367
+ local ____switch89 = activeSlot
368
+ local ____cond89 = ____switch89 == ActiveSlot.SLOT_PRIMARY
369
+ if ____cond89 then
362
370
  do
363
371
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
364
372
  player:RemoveCollectible(primaryCollectibleType)
@@ -367,8 +375,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
367
375
  break
368
376
  end
369
377
  end
370
- ____cond87 = ____cond87 or ____switch87 == ActiveSlot.SLOT_SECONDARY
371
- if ____cond87 then
378
+ ____cond89 = ____cond89 or ____switch89 == ActiveSlot.SLOT_SECONDARY
379
+ if ____cond89 then
372
380
  do
373
381
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
374
382
  player:RemoveCollectible(primaryCollectibleType)
@@ -383,16 +391,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
383
391
  break
384
392
  end
385
393
  end
386
- ____cond87 = ____cond87 or ____switch87 == ActiveSlot.SLOT_POCKET
387
- if ____cond87 then
394
+ ____cond89 = ____cond89 or ____switch89 == ActiveSlot.SLOT_POCKET
395
+ if ____cond89 then
388
396
  do
389
397
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
390
398
  player:SetActiveCharge(charge, activeSlot)
391
399
  break
392
400
  end
393
401
  end
394
- ____cond87 = ____cond87 or ____switch87 == ActiveSlot.SLOT_POCKET2
395
- if ____cond87 then
402
+ ____cond89 = ____cond89 or ____switch89 == ActiveSlot.SLOT_POCKET2
403
+ if ____cond89 then
396
404
  do
397
405
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
398
406
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.491",
3
+ "version": "1.0.492",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",