isaacscript-common 1.0.534 → 1.0.538

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.
@@ -1,10 +1,15 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
2
3
  local ____exports = {}
3
- local hasSubscriptions, entityTakeDmgPlayer, damageIsFatal
4
+ local hasSubscriptions, entityTakeDmgPlayer, damageIsFatal, v
5
+ local ____exports = require("features.saveDataManager.exports")
6
+ local saveDataManager = ____exports.saveDataManager
4
7
  local ____player = require("functions.player")
5
8
  local getPlayerAvailableHeartSlots = ____player.getPlayerAvailableHeartSlots
9
+ local getPlayerIndex = ____player.getPlayerIndex
6
10
  local getPlayerNumAllHearts = ____player.getPlayerNumAllHearts
7
11
  local hasLostCurse = ____player.hasLostCurse
12
+ local isChildPlayer = ____player.isChildPlayer
8
13
  local ____revive = require("functions.revive")
9
14
  local willPlayerRevive = ____revive.willPlayerRevive
10
15
  local ____postPlayerFatalDamage = require("callbacks.subscriptions.postPlayerFatalDamage")
@@ -24,10 +29,18 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
24
29
  if player.Variant ~= 0 then
25
30
  return nil
26
31
  end
32
+ if isChildPlayer(nil, player) then
33
+ return nil
34
+ end
35
+ local game = Game()
36
+ local gameFrameCount = game:GetFrameCount()
37
+ local playerIndex = getPlayerIndex(nil, player)
38
+ local lastDamageFrame = v.run.playerLastDamageFrame:get(playerIndex)
39
+ v.run.playerLastDamageFrame:set(playerIndex, gameFrameCount)
27
40
  if willPlayerRevive(nil, player) then
28
41
  return nil
29
42
  end
30
- if (not damageIsFatal(nil, player, damageAmount)) and (not hasLostCurse(nil, player)) then
43
+ if (not damageIsFatal(nil, player, damageAmount, lastDamageFrame)) and (not hasLostCurse(nil, player)) then
31
44
  return nil
32
45
  end
33
46
  local shouldSustainDeath = postPlayerFatalDamageFire(nil, player)
@@ -36,7 +49,9 @@ function entityTakeDmgPlayer(self, tookDamage, damageAmount, _damageFlags, _dama
36
49
  end
37
50
  return nil
38
51
  end
39
- function damageIsFatal(self, player, damageAmount)
52
+ function damageIsFatal(self, player, damageAmount, lastDamageFrame)
53
+ local game = Game()
54
+ local gameFrameCount = game:GetFrameCount()
40
55
  local character = player:GetPlayerType()
41
56
  if character == PlayerType.PLAYER_JACOB2_B then
42
57
  return true
@@ -49,6 +64,9 @@ function damageIsFatal(self, player, damageAmount)
49
64
  if player:HasCollectible(CollectibleType.COLLECTIBLE_HEARTBREAK) and (playerAvailableHeartSlots >= 2) then
50
65
  return false
51
66
  end
67
+ if player:HasCollectible(CollectibleType.COLLECTIBLE_BROKEN_GLASS_CANNON) and (gameFrameCount == lastDamageFrame) then
68
+ return false
69
+ end
52
70
  local hearts = player:GetHearts()
53
71
  local eternalHearts = player:GetEternalHearts()
54
72
  local soulHearts = player:GetSoulHearts()
@@ -58,7 +76,13 @@ function damageIsFatal(self, player, damageAmount)
58
76
  end
59
77
  return true
60
78
  end
79
+ v = {
80
+ run = {
81
+ playerLastDamageFrame = __TS__New(Map)
82
+ }
83
+ }
61
84
  function ____exports.postPlayerFatalDamageCallbackInit(self, mod)
85
+ saveDataManager(nil, "postPlayerFatalDamage", v)
62
86
  mod:AddCallback(ModCallbacks.MC_ENTITY_TAKE_DMG, entityTakeDmgPlayer, EntityType.ENTITY_PLAYER)
63
87
  end
64
88
  return ____exports
@@ -51,6 +51,7 @@ export declare const EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45;
51
51
  * information, see the documentation for the `clearSprite()` helper function.
52
52
  */
53
53
  export declare const EMPTY_PNG_PATH = "gfx/none.png";
54
+ export declare const FAMILIARS_THAT_SHOOT_PLAYER_TEARS: Set<FamiliarVariant>;
54
55
  /** As of Repentance, the final stage is floor 13 (which is the Home floor). */
55
56
  export declare const FINAL_STAGE: number;
56
57
  /**
@@ -22,6 +22,7 @@ ____exports.DISTANCE_OF_GRID_TILE = 40
22
22
  ____exports.DOOR_HITBOX_DISTANCE = 11
23
23
  ____exports.EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45
24
24
  ____exports.EMPTY_PNG_PATH = "gfx/none.png"
25
+ ____exports.FAMILIARS_THAT_SHOOT_PLAYER_TEARS = __TS__New(Set, {FamiliarVariant.SCISSORS, FamiliarVariant.INCUBUS, FamiliarVariant.FATES_REWARD, FamiliarVariant.SPRINKLER, FamiliarVariant.LOST_SOUL, FamiliarVariant.TWISTED_BABY, FamiliarVariant.BLOOD_BABY, FamiliarVariant.DECAP_ATTACK})
25
26
  ____exports.FINAL_STAGE = LevelStage.NUM_STAGES - 1
26
27
  ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
27
28
  ____exports.GENESIS_ROOM_VARIANT = 1000
@@ -19,7 +19,13 @@ export declare function addTrinketCostume(player: EntityPlayer, trinketType: Tri
19
19
  export declare function anyPlayerCloserThan(position: Vector, distance: float): boolean;
20
20
  export declare function anyPlayerHasCollectible(collectibleType: CollectibleType | int): boolean;
21
21
  export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boolean;
22
- export declare function anyPlayerIs(matchingCharacter: PlayerType): boolean;
22
+ /**
23
+ * Helper function to determine if the given character is present.
24
+ *
25
+ * This function is variadic, meaning that you can supply as many characters as you want to check
26
+ * for. Returns true if any of the characters supplied are present.
27
+ */
28
+ export declare function anyPlayerIs(...characters: PlayerType[]): boolean;
23
29
  /**
24
30
  * Helper function to determine if the provided character can have red heart containers. Returns
25
31
  * true for characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper,
@@ -126,12 +126,14 @@ function ____exports.anyPlayerHasTrinket(self, trinketType)
126
126
  end
127
127
  return false
128
128
  end
129
- function ____exports.anyPlayerIs(self, matchingCharacter)
129
+ function ____exports.anyPlayerIs(self, ...)
130
+ local characters = {...}
131
+ local characterSet = __TS__New(Set, characters)
130
132
  for ____, player in ipairs(
131
133
  ____exports.getPlayers(nil)
132
134
  ) do
133
135
  local character = player:GetPlayerType()
134
- if character == matchingCharacter then
136
+ if characterSet:has(character) then
135
137
  return true
136
138
  end
137
139
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.534",
3
+ "version": "1.0.538",
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.300",
28
+ "isaac-typescript-definitions": "^1.0.302",
29
29
  "isaacscript-lint": "^1.0.72",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.4.4",