isaacscript-common 1.2.114 → 1.2.115

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.
@@ -137,17 +137,17 @@ function ____exports.logPlayerHealth(player)
137
137
  local playerName = getPlayerName(nil, player)
138
138
  local playerHealth = getPlayerHealth(nil, player)
139
139
  ____exports.log(("Player health for " .. playerName) .. ":")
140
- ____exports.log("- Max hearts: " .. tostring(playerHealth.maxHearts))
141
- ____exports.log("- Hearts: " .. tostring(playerHealth.hearts))
142
- ____exports.log("- Eternal hearts: " .. tostring(playerHealth.eternalHearts))
143
- ____exports.log("- Soul hearts: " .. tostring(playerHealth.soulHearts))
144
- ____exports.log("- Bone hearts: " .. tostring(playerHealth.boneHearts))
145
- ____exports.log("- Golden hearts: " .. tostring(playerHealth.goldenHearts))
146
- ____exports.log("- Rotten hearts: " .. tostring(playerHealth.rottenHearts))
147
- ____exports.log("- Broken hearts: " .. tostring(playerHealth.brokenHearts))
148
- ____exports.log("- Soul charges: " .. tostring(playerHealth.soulCharges))
149
- ____exports.log("- Blood charges: " .. tostring(playerHealth.bloodCharges))
150
- ____exports.log(("- Soul heart types: [" .. table.concat(playerHealth.soulHeartTypes, "," or ",")) .. "]")
140
+ ____exports.log(" Max hearts: " .. tostring(playerHealth.maxHearts))
141
+ ____exports.log(" Hearts: " .. tostring(playerHealth.hearts))
142
+ ____exports.log(" Eternal hearts: " .. tostring(playerHealth.eternalHearts))
143
+ ____exports.log(" Soul hearts: " .. tostring(playerHealth.soulHearts))
144
+ ____exports.log(" Bone hearts: " .. tostring(playerHealth.boneHearts))
145
+ ____exports.log(" Golden hearts: " .. tostring(playerHealth.goldenHearts))
146
+ ____exports.log(" Rotten hearts: " .. tostring(playerHealth.rottenHearts))
147
+ ____exports.log(" Broken hearts: " .. tostring(playerHealth.brokenHearts))
148
+ ____exports.log(" Soul charges: " .. tostring(playerHealth.soulCharges))
149
+ ____exports.log(" Blood charges: " .. tostring(playerHealth.bloodCharges))
150
+ ____exports.log((" Soul heart types: [" .. table.concat(playerHealth.soulHeartTypes, "," or ",")) .. "]")
151
151
  end
152
152
  function ____exports.logRoom()
153
153
  local roomGridIndex = getRoomGridIndex(nil)
@@ -5,6 +5,10 @@ local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
5
5
  local ____exports = {}
6
6
  local ____constants = require("constants")
7
7
  local MAX_PLAYER_HEART_CONTAINERS = ____constants.MAX_PLAYER_HEART_CONTAINERS
8
+ local ____player = require("functions.player")
9
+ local getHearts = ____player.getHearts
10
+ local ____utils = require("functions.utils")
11
+ local ____repeat = ____utils["repeat"]
8
12
  function ____exports.removeAllPlayerHealth(self, player)
9
13
  local character = player:GetPlayerType()
10
14
  local goldenHearts = player:GetGoldenHearts()
@@ -29,7 +33,7 @@ function ____exports.getPlayerHealth(self, player)
29
33
  local character = player:GetPlayerType()
30
34
  local soulHeartTypes = {}
31
35
  local maxHearts = player:GetMaxHearts()
32
- local hearts = player:GetHearts()
36
+ local hearts = getHearts(nil, player)
33
37
  local soulHearts = player:GetSoulHearts()
34
38
  local boneHearts = player:GetBoneHearts()
35
39
  local goldenHearts = player:GetGoldenHearts()
@@ -47,7 +51,6 @@ function ____exports.getPlayerHealth(self, player)
47
51
  maxHearts = subPlayer:GetBoneHearts() * 2
48
52
  hearts = subPlayer:GetHearts()
49
53
  end
50
- hearts = hearts - rottenHearts * 2
51
54
  local extraHearts = math.ceil(soulHearts / 2) + boneHearts
52
55
  local currentSoulHeart = 0
53
56
  do
@@ -91,6 +94,7 @@ end
91
94
  function ____exports.setPlayerHealth(self, player, playerHealth)
92
95
  local character = player:GetPlayerType()
93
96
  local subPlayer = player:GetSubPlayer()
97
+ local isTaintedMagdalene = character == PlayerType.PLAYER_MAGDALENE_B
94
98
  ____exports.removeAllPlayerHealth(nil, player)
95
99
  if character == PlayerType.PLAYER_THESOUL and subPlayer ~= nil then
96
100
  subPlayer:AddMaxHearts(playerHealth.maxHearts, false)
@@ -119,7 +123,16 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
119
123
  end
120
124
  )
121
125
  player:AddRottenHearts(playerHealth.rottenHearts)
122
- player:AddHearts(playerHealth.hearts)
126
+ ____repeat(
127
+ nil,
128
+ playerHealth.hearts,
129
+ function()
130
+ player:AddHearts(1)
131
+ if isTaintedMagdalene then
132
+ player:AddHearts(-1)
133
+ end
134
+ end
135
+ )
123
136
  player:AddGoldenHearts(playerHealth.goldenHearts)
124
137
  player:AddBrokenHearts(playerHealth.brokenHearts)
125
138
  if character == PlayerType.PLAYER_BETHANY then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.114",
3
+ "version": "1.2.115",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",