isaacscript-common 8.4.2 → 8.4.3
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.
|
@@ -12,7 +12,7 @@ export declare function addPlayerHealthType(player: EntityPlayer, healthType: He
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function getPlayerHealth(player: EntityPlayer): PlayerHealth;
|
|
14
14
|
export declare function getPlayerHealthType(player: EntityPlayer, healthType: HealthType): int;
|
|
15
|
-
/** Returns a `PlayerHealth` object with all
|
|
15
|
+
/** Returns a `PlayerHealth` object with all zeros. */
|
|
16
16
|
export declare function newPlayerHealth(): PlayerHealth;
|
|
17
17
|
export declare function playerConvertBlackHeartsToSoulHearts(player: EntityPlayer): void;
|
|
18
18
|
export declare function playerConvertSoulHeartsToBlackHearts(player: EntityPlayer): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAYzE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,GACb,IAAI,CA+CN;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,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"}
|
|
@@ -21,6 +21,8 @@ local getPlayerHearts = ____players.getPlayerHearts
|
|
|
21
21
|
local getPlayerSoulHearts = ____players.getPlayerSoulHearts
|
|
22
22
|
local isCharacter = ____players.isCharacter
|
|
23
23
|
local setActiveItem = ____players.setActiveItem
|
|
24
|
+
local ____utils = require("functions.utils")
|
|
25
|
+
local ____repeat = ____utils["repeat"]
|
|
24
26
|
function ____exports.removeAllPlayerHealth(self, player)
|
|
25
27
|
local goldenHearts = player:GetGoldenHearts()
|
|
26
28
|
local eternalHearts = player:GetEternalHearts()
|
|
@@ -105,8 +107,23 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
|
105
107
|
)
|
|
106
108
|
player:AddRottenHearts(playerHealth.rottenHearts)
|
|
107
109
|
if character == PlayerType.MAGDALENE_B then
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
____repeat(
|
|
111
|
+
nil,
|
|
112
|
+
playerHealth.hearts,
|
|
113
|
+
function()
|
|
114
|
+
if player:HasFullHearts() then
|
|
115
|
+
return
|
|
116
|
+
end
|
|
117
|
+
local hearts = player:GetHearts()
|
|
118
|
+
local maxHearts = player:GetMaxHearts()
|
|
119
|
+
if hearts == maxHearts - 1 then
|
|
120
|
+
player:AddHearts(1)
|
|
121
|
+
return
|
|
122
|
+
end
|
|
123
|
+
player:AddHearts(1)
|
|
124
|
+
player:AddHearts(-1)
|
|
125
|
+
end
|
|
126
|
+
)
|
|
110
127
|
else
|
|
111
128
|
player:AddHearts(playerHealth.hearts)
|
|
112
129
|
end
|
|
@@ -323,7 +340,7 @@ function ____exports.getPlayerHealthType(self, player, healthType)
|
|
|
323
340
|
end
|
|
324
341
|
until true
|
|
325
342
|
end
|
|
326
|
-
--- Returns a `PlayerHealth` object with all
|
|
343
|
+
--- Returns a `PlayerHealth` object with all zeros.
|
|
327
344
|
function ____exports.newPlayerHealth(self)
|
|
328
345
|
return {
|
|
329
346
|
maxHearts = 0,
|
package/dist/index.d.ts
CHANGED
|
@@ -8143,7 +8143,7 @@ export declare function newChargeBarSprites(maxCharges: int): ChargeBarSprites;
|
|
|
8143
8143
|
|
|
8144
8144
|
export declare function newPickingUpItem(): PickingUpItem;
|
|
8145
8145
|
|
|
8146
|
-
/** Returns a `PlayerHealth` object with all
|
|
8146
|
+
/** Returns a `PlayerHealth` object with all zeros. */
|
|
8147
8147
|
export declare function newPlayerHealth(): PlayerHealth;
|
|
8148
8148
|
|
|
8149
8149
|
/**
|
package/package.json
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
isCharacter,
|
|
17
17
|
setActiveItem,
|
|
18
18
|
} from "./players";
|
|
19
|
+
import { repeat } from "./utils";
|
|
19
20
|
|
|
20
21
|
export function addPlayerHealthType(
|
|
21
22
|
player: EntityPlayer,
|
|
@@ -210,7 +211,7 @@ export function getPlayerHealthType(
|
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
213
|
|
|
213
|
-
/** Returns a `PlayerHealth` object with all
|
|
214
|
+
/** Returns a `PlayerHealth` object with all zeros. */
|
|
214
215
|
export function newPlayerHealth(): PlayerHealth {
|
|
215
216
|
return {
|
|
216
217
|
maxHearts: 0,
|
|
@@ -381,8 +382,21 @@ export function setPlayerHealth(
|
|
|
381
382
|
|
|
382
383
|
if (character === PlayerType.MAGDALENE_B) {
|
|
383
384
|
// Adding 1 heart to Tainted Magdalene will actually add two hearts.
|
|
384
|
-
|
|
385
|
-
|
|
385
|
+
repeat(playerHealth.hearts, () => {
|
|
386
|
+
if (player.HasFullHearts()) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const hearts = player.GetHearts();
|
|
391
|
+
const maxHearts = player.GetMaxHearts();
|
|
392
|
+
if (hearts === maxHearts - 1) {
|
|
393
|
+
player.AddHearts(1);
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
player.AddHearts(1);
|
|
398
|
+
player.AddHearts(-1);
|
|
399
|
+
});
|
|
386
400
|
} else {
|
|
387
401
|
player.AddHearts(playerHealth.hearts);
|
|
388
402
|
}
|