isaacscript-common 1.2.95 → 1.2.96
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.
- package/dist/callbacks/postPlayerChangeHealth.lua +9 -4
- package/dist/functions/bitwise.d.ts +1 -0
- package/dist/functions/bitwise.lua +8 -0
- package/dist/functions/math.d.ts +0 -1
- package/dist/functions/math.lua +11 -19
- package/dist/functions/player.d.ts +9 -0
- package/dist/functions/player.lua +33 -29
- package/dist/functions/rooms.lua +2 -2
- package/package.json +5 -5
|
@@ -6,8 +6,8 @@ local ____exports = {}
|
|
|
6
6
|
local hasSubscriptions, postPEffectUpdateReordered, getCurrentHealthValue, v
|
|
7
7
|
local ____exports = require("features.saveDataManager.exports")
|
|
8
8
|
local saveDataManager = ____exports.saveDataManager
|
|
9
|
-
local
|
|
10
|
-
local countSetBits =
|
|
9
|
+
local ____bitwise = require("functions.bitwise")
|
|
10
|
+
local countSetBits = ____bitwise.countSetBits
|
|
11
11
|
local ____player = require("functions.player")
|
|
12
12
|
local getPlayerIndex = ____player.getPlayerIndex
|
|
13
13
|
local ____utils = require("functions.utils")
|
|
@@ -47,13 +47,18 @@ function getCurrentHealthValue(self, player, healthType)
|
|
|
47
47
|
local ____cond11 = ____switch11 == HealthType.RED
|
|
48
48
|
if ____cond11 then
|
|
49
49
|
do
|
|
50
|
-
|
|
50
|
+
local rottenHearts = player:GetRottenHearts()
|
|
51
|
+
local hearts = player:GetHearts()
|
|
52
|
+
return hearts - rottenHearts * 2
|
|
51
53
|
end
|
|
52
54
|
end
|
|
53
55
|
____cond11 = ____cond11 or ____switch11 == HealthType.SOUL
|
|
54
56
|
if ____cond11 then
|
|
55
57
|
do
|
|
56
|
-
|
|
58
|
+
local soulHearts = player:GetSoulHearts()
|
|
59
|
+
local blackHeartsBitmask = player:GetBlackHearts()
|
|
60
|
+
local blackHearts = countSetBits(nil, blackHeartsBitmask)
|
|
61
|
+
return soulHearts - blackHearts
|
|
57
62
|
end
|
|
58
63
|
end
|
|
59
64
|
____cond11 = ____cond11 or ____switch11 == HealthType.ETERNAL
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____exports = {}
|
|
3
|
+
function ____exports.countSetBits(self, n)
|
|
4
|
+
local count = 0
|
|
5
|
+
while n > 0 do
|
|
6
|
+
n = n & n - 1
|
|
7
|
+
count = count + 1
|
|
8
|
+
end
|
|
9
|
+
return count
|
|
10
|
+
end
|
|
3
11
|
function ____exports.getKBitOfN(self, k, n)
|
|
4
12
|
return n >> k & 1
|
|
5
13
|
end
|
package/dist/functions/math.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
export declare function countSetBits(n: int): int;
|
|
3
2
|
export declare function getAngleDifference(angle1: float, angle2: float): float;
|
|
4
3
|
/**
|
|
5
4
|
* Helper function to get an array of equidistant points on the circumference around a circle.
|
package/dist/functions/math.lua
CHANGED
|
@@ -7,33 +7,33 @@ local ____utils = require("functions.utils")
|
|
|
7
7
|
local ensureAllCases = ____utils.ensureAllCases
|
|
8
8
|
function getCircleInitialPosition(self, direction, radius)
|
|
9
9
|
repeat
|
|
10
|
-
local
|
|
11
|
-
local
|
|
12
|
-
if
|
|
10
|
+
local ____switch6 = direction
|
|
11
|
+
local ____cond6 = ____switch6 == Direction.NO_DIRECTION
|
|
12
|
+
if ____cond6 then
|
|
13
13
|
do
|
|
14
14
|
return Vector.Zero
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
|
-
|
|
18
|
-
if
|
|
17
|
+
____cond6 = ____cond6 or ____switch6 == Direction.LEFT
|
|
18
|
+
if ____cond6 then
|
|
19
19
|
do
|
|
20
20
|
return Vector(-radius, 0)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
|
-
|
|
24
|
-
if
|
|
23
|
+
____cond6 = ____cond6 or ____switch6 == Direction.UP
|
|
24
|
+
if ____cond6 then
|
|
25
25
|
do
|
|
26
26
|
return Vector(0, -radius)
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
|
-
|
|
30
|
-
if
|
|
29
|
+
____cond6 = ____cond6 or ____switch6 == Direction.RIGHT
|
|
30
|
+
if ____cond6 then
|
|
31
31
|
do
|
|
32
32
|
return Vector(radius, 0)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
|
-
|
|
36
|
-
if
|
|
35
|
+
____cond6 = ____cond6 or ____switch6 == Direction.DOWN
|
|
36
|
+
if ____cond6 then
|
|
37
37
|
do
|
|
38
38
|
return Vector(0, radius)
|
|
39
39
|
end
|
|
@@ -45,14 +45,6 @@ function getCircleInitialPosition(self, direction, radius)
|
|
|
45
45
|
end
|
|
46
46
|
until true
|
|
47
47
|
end
|
|
48
|
-
function ____exports.countSetBits(self, n)
|
|
49
|
-
local count = 0
|
|
50
|
-
while n > 0 do
|
|
51
|
-
n = n & n - 1
|
|
52
|
-
count = count + 1
|
|
53
|
-
end
|
|
54
|
-
return count
|
|
55
|
-
end
|
|
56
48
|
function ____exports.getAngleDifference(self, angle1, angle2)
|
|
57
49
|
local subtractedAngle = angle1 - angle2
|
|
58
50
|
return (subtractedAngle + 180) % 360 - 180
|
|
@@ -81,6 +81,15 @@ export declare function getEffectsList(player: EntityPlayer): TemporaryEffect[];
|
|
|
81
81
|
* method.
|
|
82
82
|
*/
|
|
83
83
|
export declare function getFinalPlayer(): EntityPlayer;
|
|
84
|
+
/**
|
|
85
|
+
* Returns the number of red hearts that the player has, excluding any rotten hearts. For example,
|
|
86
|
+
* if the player has one full black heart, one full soul heart, and one half black heart, this
|
|
87
|
+
* function returns 3.
|
|
88
|
+
*
|
|
89
|
+
* This is different from the `EntityPlayer.GetHearts` method, since that returns a value that
|
|
90
|
+
* includes rotten hearts.
|
|
91
|
+
*/
|
|
92
|
+
export declare function getHearts(player: EntityPlayer): int;
|
|
84
93
|
/**
|
|
85
94
|
* Helper function that returns the type of the rightmost heart, not including golden hearts since
|
|
86
95
|
* they can't be damaged directly.
|
|
@@ -25,14 +25,13 @@ local ____array = require("functions.array")
|
|
|
25
25
|
local getLastElement = ____array.getLastElement
|
|
26
26
|
local sumArray = ____array.sumArray
|
|
27
27
|
local ____bitwise = require("functions.bitwise")
|
|
28
|
+
local countSetBits = ____bitwise.countSetBits
|
|
28
29
|
local getKBitOfN = ____bitwise.getKBitOfN
|
|
29
30
|
local getNumBitsOfN = ____bitwise.getNumBitsOfN
|
|
30
31
|
local ____collectibles = require("functions.collectibles")
|
|
31
32
|
local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
|
|
32
33
|
local ____collectibleSet = require("functions.collectibleSet")
|
|
33
34
|
local getCollectibleSet = ____collectibleSet.getCollectibleSet
|
|
34
|
-
local ____math = require("functions.math")
|
|
35
|
-
local countSetBits = ____math.countSetBits
|
|
36
35
|
local ____string = require("functions.string")
|
|
37
36
|
local stringContains = ____string.stringContains
|
|
38
37
|
local trimPrefix = ____string.trimPrefix
|
|
@@ -92,15 +91,15 @@ end
|
|
|
92
91
|
function getPlayerIndexCollectibleType(self, player, differentiateForgottenAndSoul)
|
|
93
92
|
local character = player:GetPlayerType()
|
|
94
93
|
repeat
|
|
95
|
-
local
|
|
96
|
-
local
|
|
97
|
-
if
|
|
94
|
+
local ____switch66 = character
|
|
95
|
+
local ____cond66 = ____switch66 == PlayerType.PLAYER_THESOUL
|
|
96
|
+
if ____cond66 then
|
|
98
97
|
do
|
|
99
98
|
return differentiateForgottenAndSoul and CollectibleType.COLLECTIBLE_SPOON_BENDER or DEFAULT_COLLECTIBLE_TYPE
|
|
100
99
|
end
|
|
101
100
|
end
|
|
102
|
-
|
|
103
|
-
if
|
|
101
|
+
____cond66 = ____cond66 or ____switch66 == PlayerType.PLAYER_LAZARUS2_B
|
|
102
|
+
if ____cond66 then
|
|
104
103
|
do
|
|
105
104
|
return CollectibleType.COLLECTIBLE_INNER_EYE
|
|
106
105
|
end
|
|
@@ -128,39 +127,39 @@ end
|
|
|
128
127
|
function getAdjustedPlayerName(self, player)
|
|
129
128
|
local character = player:GetPlayerType()
|
|
130
129
|
repeat
|
|
131
|
-
local
|
|
132
|
-
local
|
|
133
|
-
if
|
|
130
|
+
local ____switch79 = character
|
|
131
|
+
local ____cond79 = ____switch79 == PlayerType.PLAYER_BLUEBABY or ____switch79 == PlayerType.PLAYER_BLUEBABY_B
|
|
132
|
+
if ____cond79 then
|
|
134
133
|
do
|
|
135
134
|
return "Blue Baby"
|
|
136
135
|
end
|
|
137
136
|
end
|
|
138
|
-
|
|
139
|
-
if
|
|
137
|
+
____cond79 = ____cond79 or ____switch79 == PlayerType.PLAYER_LAZARUS2
|
|
138
|
+
if ____cond79 then
|
|
140
139
|
do
|
|
141
140
|
return "Lazarus II"
|
|
142
141
|
end
|
|
143
142
|
end
|
|
144
|
-
|
|
145
|
-
if
|
|
143
|
+
____cond79 = ____cond79 or ____switch79 == PlayerType.PLAYER_BLACKJUDAS
|
|
144
|
+
if ____cond79 then
|
|
146
145
|
do
|
|
147
146
|
return "Dark Judas"
|
|
148
147
|
end
|
|
149
148
|
end
|
|
150
|
-
|
|
151
|
-
if
|
|
149
|
+
____cond79 = ____cond79 or ____switch79 == PlayerType.PLAYER_JACOB
|
|
150
|
+
if ____cond79 then
|
|
152
151
|
do
|
|
153
152
|
return "Jacob & Esau"
|
|
154
153
|
end
|
|
155
154
|
end
|
|
156
|
-
|
|
157
|
-
if
|
|
155
|
+
____cond79 = ____cond79 or ____switch79 == PlayerType.PLAYER_LAZARUS2_B
|
|
156
|
+
if ____cond79 then
|
|
158
157
|
do
|
|
159
158
|
return "Dead Tainted Lazarus"
|
|
160
159
|
end
|
|
161
160
|
end
|
|
162
|
-
|
|
163
|
-
if
|
|
161
|
+
____cond79 = ____cond79 or ____switch79 == PlayerType.PLAYER_JACOB2_B
|
|
162
|
+
if ____cond79 then
|
|
164
163
|
do
|
|
165
164
|
return "Dead Tainted Jacob"
|
|
166
165
|
end
|
|
@@ -345,6 +344,11 @@ function ____exports.getFinalPlayer(self)
|
|
|
345
344
|
local players = ____exports.getPlayers(nil)
|
|
346
345
|
return getLastElement(nil, players)
|
|
347
346
|
end
|
|
347
|
+
function ____exports.getHearts(self, player)
|
|
348
|
+
local rottenHearts = player:GetRottenHearts()
|
|
349
|
+
local hearts = player:GetHearts()
|
|
350
|
+
return hearts - rottenHearts * 2
|
|
351
|
+
end
|
|
348
352
|
function ____exports.getLastHeart(self, player)
|
|
349
353
|
local hearts = player:GetHearts()
|
|
350
354
|
local effectiveMaxHearts = player:GetEffectiveMaxHearts()
|
|
@@ -584,9 +588,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
584
588
|
itemPool:RemoveCollectible(collectibleType)
|
|
585
589
|
end
|
|
586
590
|
repeat
|
|
587
|
-
local
|
|
588
|
-
local
|
|
589
|
-
if
|
|
591
|
+
local ____switch125 = activeSlot
|
|
592
|
+
local ____cond125 = ____switch125 == ActiveSlot.SLOT_PRIMARY
|
|
593
|
+
if ____cond125 then
|
|
590
594
|
do
|
|
591
595
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
592
596
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -595,8 +599,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
595
599
|
break
|
|
596
600
|
end
|
|
597
601
|
end
|
|
598
|
-
|
|
599
|
-
if
|
|
602
|
+
____cond125 = ____cond125 or ____switch125 == ActiveSlot.SLOT_SECONDARY
|
|
603
|
+
if ____cond125 then
|
|
600
604
|
do
|
|
601
605
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
602
606
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -611,16 +615,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
611
615
|
break
|
|
612
616
|
end
|
|
613
617
|
end
|
|
614
|
-
|
|
615
|
-
if
|
|
618
|
+
____cond125 = ____cond125 or ____switch125 == ActiveSlot.SLOT_POCKET
|
|
619
|
+
if ____cond125 then
|
|
616
620
|
do
|
|
617
621
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
618
622
|
player:SetActiveCharge(charge, activeSlot)
|
|
619
623
|
break
|
|
620
624
|
end
|
|
621
625
|
end
|
|
622
|
-
|
|
623
|
-
if
|
|
626
|
+
____cond125 = ____cond125 or ____switch125 == ActiveSlot.SLOT_POCKET2
|
|
627
|
+
if ____cond125 then
|
|
624
628
|
do
|
|
625
629
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
626
630
|
break
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -92,7 +92,7 @@ end
|
|
|
92
92
|
function ____exports.inDeathCertificateArea(self)
|
|
93
93
|
local roomStageID = ____exports.getRoomStageID(nil)
|
|
94
94
|
local roomSubType = ____exports.getRoomSubType(nil)
|
|
95
|
-
return roomStageID == 35 and (roomSubType == 33 or roomSubType ==
|
|
95
|
+
return roomStageID == 35 and (roomSubType == 33 or roomSubType == 33)
|
|
96
96
|
end
|
|
97
97
|
function ____exports.changeRoom(self, roomGridIndex)
|
|
98
98
|
local game = Game()
|
|
@@ -214,7 +214,7 @@ function ____exports.inCrawlspace(self)
|
|
|
214
214
|
local room = game:GetRoom()
|
|
215
215
|
local roomType = room:GetType()
|
|
216
216
|
local roomSubType = ____exports.getRoomSubType(nil)
|
|
217
|
-
return roomType == RoomType.ROOM_DUNGEON and roomSubType
|
|
217
|
+
return roomType == RoomType.ROOM_DUNGEON and roomSubType == 0
|
|
218
218
|
end
|
|
219
219
|
function ____exports.inDevilsCrownTreasureRoom(self)
|
|
220
220
|
local roomDescriptor = ____exports.getCurrentRoomDescriptorReadOnly(nil)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.96",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@zamiell/typescript-to-lua": "
|
|
29
|
-
"isaac-typescript-definitions": "
|
|
30
|
-
"isaacscript-lint": "
|
|
31
|
-
"isaacscript-tsconfig": "
|
|
28
|
+
"@zamiell/typescript-to-lua": "1.4.0",
|
|
29
|
+
"isaac-typescript-definitions": "1.0.354",
|
|
30
|
+
"isaacscript-lint": "1.0.81",
|
|
31
|
+
"isaacscript-tsconfig": "1.1.8",
|
|
32
32
|
"typedoc": "^0.22.12",
|
|
33
33
|
"typescript": "4.5.5"
|
|
34
34
|
}
|