isaacscript-common 1.2.23 → 1.2.24
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/functions/collectibleCacheFlag.d.ts +16 -0
- package/dist/functions/collectibleCacheFlag.lua +17 -0
- package/dist/functions/player.d.ts +0 -16
- package/dist/functions/player.lua +30 -47
- package/dist/functions/transformations.d.ts +1 -1
- package/dist/functions/transformations.lua +4 -4
- package/dist/functions/trinketCacheFlag.d.ts +5 -0
- package/dist/functions/trinketCacheFlag.lua +12 -0
- package/package.json +1 -1
|
@@ -4,3 +4,19 @@
|
|
|
4
4
|
* collectibles.
|
|
5
5
|
*/
|
|
6
6
|
export declare function getCollectiblesForCacheFlag(cacheFlag: CacheFlag): Set<CollectibleType | int>;
|
|
7
|
+
/**
|
|
8
|
+
* Returns an array containing every collectible type that the player has that matches the provided
|
|
9
|
+
* CacheFlag.
|
|
10
|
+
*
|
|
11
|
+
* For example, if a player has one Lord of the Pit and two Transcendences, then this function would
|
|
12
|
+
* return:
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* [
|
|
16
|
+
* CollectibleType.COLLECTIBLE_LORD_OF_THE_PIT,
|
|
17
|
+
* CollectibleType.COLLECTIBLE_TRANSCENDENCE,
|
|
18
|
+
* CollectibleType.COLLECTIBLE_TRANSCENDENCE,
|
|
19
|
+
* ]
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function getPlayerCollectiblesForCacheFlag(player: EntityPlayer, cacheFlag: CacheFlag): Array<CollectibleType | int>;
|
|
@@ -3,6 +3,8 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local Map = ____lualib.Map
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local Set = ____lualib.Set
|
|
6
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
7
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
8
|
local ____exports = {}
|
|
7
9
|
local ____collectibles = require("functions.collectibles")
|
|
8
10
|
local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
|
|
@@ -38,4 +40,19 @@ function ____exports.getCollectiblesForCacheFlag(self, cacheFlag)
|
|
|
38
40
|
end
|
|
39
41
|
return copySet(nil, collectiblesSet)
|
|
40
42
|
end
|
|
43
|
+
function ____exports.getPlayerCollectiblesForCacheFlag(self, player, cacheFlag)
|
|
44
|
+
local collectiblesForCacheFlag = ____exports.getCollectiblesForCacheFlag(nil, cacheFlag)
|
|
45
|
+
local playerCollectibles = {}
|
|
46
|
+
for ____, collectibleType in __TS__Iterator(collectiblesForCacheFlag:values()) do
|
|
47
|
+
local numCollectibles = player:GetCollectibleNum(collectibleType)
|
|
48
|
+
do
|
|
49
|
+
local i = 0
|
|
50
|
+
while i < numCollectibles do
|
|
51
|
+
__TS__ArrayPush(playerCollectibles, collectibleType)
|
|
52
|
+
i = i + 1
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
return playerCollectibles
|
|
57
|
+
end
|
|
41
58
|
return ____exports
|
|
@@ -81,22 +81,6 @@ export declare function getNewestPlayer(): EntityPlayer;
|
|
|
81
81
|
* hearts and 3 broken hearts, then this function would return 6 (i.e. 12 - 1 - 2 - 3).
|
|
82
82
|
*/
|
|
83
83
|
export declare function getPlayerAvailableHeartSlots(player: EntityPlayer): int;
|
|
84
|
-
/**
|
|
85
|
-
* Returns an array containing every collectible type that the player has that matches the provided
|
|
86
|
-
* CacheFlag.
|
|
87
|
-
*
|
|
88
|
-
* For example, if a player has one Lord of the Pit and two Transcendences, then this function would
|
|
89
|
-
* return:
|
|
90
|
-
*
|
|
91
|
-
* ```ts
|
|
92
|
-
* [
|
|
93
|
-
* CollectibleType.COLLECTIBLE_LORD_OF_THE_PIT,
|
|
94
|
-
* CollectibleType.COLLECTIBLE_TRANSCENDENCE,
|
|
95
|
-
* CollectibleType.COLLECTIBLE_TRANSCENDENCE,
|
|
96
|
-
* ]
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
export declare function getPlayerCollectiblesForCacheFlag(player: EntityPlayer, cacheFlag: CacheFlag): Array<CollectibleType | int>;
|
|
100
84
|
/**
|
|
101
85
|
* Returns the maximum heart containers that the provided character can have. Normally, this is 12,
|
|
102
86
|
* but with Keeper it is 3, with Tainted Keeper it is 2. Does not account for Birthright or Mother's
|
|
@@ -3,10 +3,10 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local Set = ____lualib.Set
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
6
|
-
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
7
|
-
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
8
6
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
9
7
|
local Map = ____lualib.Map
|
|
8
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
9
|
+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
10
10
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
11
11
|
local ____exports = {}
|
|
12
12
|
local getAdjustedPlayerName, isTaintedModded, EXCLUDED_CHARACTERS
|
|
@@ -25,8 +25,6 @@ local arraySum = ____array.arraySum
|
|
|
25
25
|
local ____bitwise = require("functions.bitwise")
|
|
26
26
|
local getKBitOfN = ____bitwise.getKBitOfN
|
|
27
27
|
local getNumBitsOfN = ____bitwise.getNumBitsOfN
|
|
28
|
-
local ____collectibleCacheFlag = require("functions.collectibleCacheFlag")
|
|
29
|
-
local getCollectiblesForCacheFlag = ____collectibleCacheFlag.getCollectiblesForCacheFlag
|
|
30
28
|
local ____collectibles = require("functions.collectibles")
|
|
31
29
|
local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
|
|
32
30
|
local ____collectibleSet = require("functions.collectibleSet")
|
|
@@ -74,39 +72,39 @@ end
|
|
|
74
72
|
function getAdjustedPlayerName(self, player)
|
|
75
73
|
local character = player:GetPlayerType()
|
|
76
74
|
repeat
|
|
77
|
-
local
|
|
78
|
-
local
|
|
79
|
-
if
|
|
75
|
+
local ____switch71 = character
|
|
76
|
+
local ____cond71 = ____switch71 == PlayerType.PLAYER_BLUEBABY or ____switch71 == PlayerType.PLAYER_BLUEBABY_B
|
|
77
|
+
if ____cond71 then
|
|
80
78
|
do
|
|
81
79
|
return "Blue Baby"
|
|
82
80
|
end
|
|
83
81
|
end
|
|
84
|
-
|
|
85
|
-
if
|
|
82
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_LAZARUS2
|
|
83
|
+
if ____cond71 then
|
|
86
84
|
do
|
|
87
85
|
return "Lazarus II"
|
|
88
86
|
end
|
|
89
87
|
end
|
|
90
|
-
|
|
91
|
-
if
|
|
88
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_BLACKJUDAS
|
|
89
|
+
if ____cond71 then
|
|
92
90
|
do
|
|
93
91
|
return "Dark Judas"
|
|
94
92
|
end
|
|
95
93
|
end
|
|
96
|
-
|
|
97
|
-
if
|
|
94
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_JACOB
|
|
95
|
+
if ____cond71 then
|
|
98
96
|
do
|
|
99
97
|
return "Jacob & Esau"
|
|
100
98
|
end
|
|
101
99
|
end
|
|
102
|
-
|
|
103
|
-
if
|
|
100
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_LAZARUS2_B
|
|
101
|
+
if ____cond71 then
|
|
104
102
|
do
|
|
105
103
|
return "Dead Tainted Lazarus"
|
|
106
104
|
end
|
|
107
105
|
end
|
|
108
|
-
|
|
109
|
-
if
|
|
106
|
+
____cond71 = ____cond71 or ____switch71 == PlayerType.PLAYER_JACOB2_B
|
|
107
|
+
if ____cond71 then
|
|
110
108
|
do
|
|
111
109
|
return "Dead Tainted Jacob"
|
|
112
110
|
end
|
|
@@ -130,18 +128,18 @@ function ____exports.getPlayers(self, performExclusions)
|
|
|
130
128
|
do
|
|
131
129
|
local player = Isaac.GetPlayer(i)
|
|
132
130
|
if player == nil then
|
|
133
|
-
goto
|
|
131
|
+
goto __continue81
|
|
134
132
|
end
|
|
135
133
|
if ____exports.isChildPlayer(nil, player) then
|
|
136
|
-
goto
|
|
134
|
+
goto __continue81
|
|
137
135
|
end
|
|
138
136
|
local character = player:GetPlayerType()
|
|
139
137
|
if performExclusions and EXCLUDED_CHARACTERS:has(character) then
|
|
140
|
-
goto
|
|
138
|
+
goto __continue81
|
|
141
139
|
end
|
|
142
140
|
__TS__ArrayPush(players, player)
|
|
143
141
|
end
|
|
144
|
-
::
|
|
142
|
+
::__continue81::
|
|
145
143
|
i = i + 1
|
|
146
144
|
end
|
|
147
145
|
end
|
|
@@ -332,21 +330,6 @@ function ____exports.getPlayerAvailableHeartSlots(self, player)
|
|
|
332
330
|
local totalOccupiedHeartSlots = totalHeartContainers + brokenHearts
|
|
333
331
|
return maxHeartContainers - totalOccupiedHeartSlots
|
|
334
332
|
end
|
|
335
|
-
function ____exports.getPlayerCollectiblesForCacheFlag(self, player, cacheFlag)
|
|
336
|
-
local collectiblesForCacheFlag = getCollectiblesForCacheFlag(nil, cacheFlag)
|
|
337
|
-
local playerCollectibles = {}
|
|
338
|
-
for ____, collectibleType in __TS__Iterator(collectiblesForCacheFlag:values()) do
|
|
339
|
-
local numCollectibles = player:GetCollectibleNum(collectibleType)
|
|
340
|
-
do
|
|
341
|
-
local i = 0
|
|
342
|
-
while i < numCollectibles do
|
|
343
|
-
__TS__ArrayPush(playerCollectibles, collectibleType)
|
|
344
|
-
i = i + 1
|
|
345
|
-
end
|
|
346
|
-
end
|
|
347
|
-
end
|
|
348
|
-
return playerCollectibles
|
|
349
|
-
end
|
|
350
333
|
function ____exports.getPlayerCloserThan(self, position, distance)
|
|
351
334
|
for ____, player in ipairs(____exports.getPlayers(nil)) do
|
|
352
335
|
if player.Position:Distance(position) <= distance then
|
|
@@ -384,14 +367,14 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
|
|
|
384
367
|
do
|
|
385
368
|
local player = Isaac.GetPlayer(i)
|
|
386
369
|
if player == nil then
|
|
387
|
-
goto
|
|
370
|
+
goto __continue62
|
|
388
371
|
end
|
|
389
372
|
local playerHash = GetPtrHash(player)
|
|
390
373
|
if playerHash == playerToFindHash then
|
|
391
374
|
return i
|
|
392
375
|
end
|
|
393
376
|
end
|
|
394
|
-
::
|
|
377
|
+
::__continue62::
|
|
395
378
|
i = i + 1
|
|
396
379
|
end
|
|
397
380
|
end
|
|
@@ -561,9 +544,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
561
544
|
itemPool:RemoveCollectible(collectibleType)
|
|
562
545
|
end
|
|
563
546
|
repeat
|
|
564
|
-
local
|
|
565
|
-
local
|
|
566
|
-
if
|
|
547
|
+
local ____switch124 = activeSlot
|
|
548
|
+
local ____cond124 = ____switch124 == ActiveSlot.SLOT_PRIMARY
|
|
549
|
+
if ____cond124 then
|
|
567
550
|
do
|
|
568
551
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
569
552
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -572,8 +555,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
572
555
|
break
|
|
573
556
|
end
|
|
574
557
|
end
|
|
575
|
-
|
|
576
|
-
if
|
|
558
|
+
____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_SECONDARY
|
|
559
|
+
if ____cond124 then
|
|
577
560
|
do
|
|
578
561
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
579
562
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -588,16 +571,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
588
571
|
break
|
|
589
572
|
end
|
|
590
573
|
end
|
|
591
|
-
|
|
592
|
-
if
|
|
574
|
+
____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_POCKET
|
|
575
|
+
if ____cond124 then
|
|
593
576
|
do
|
|
594
577
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
595
578
|
player:SetActiveCharge(charge, activeSlot)
|
|
596
579
|
break
|
|
597
580
|
end
|
|
598
581
|
end
|
|
599
|
-
|
|
600
|
-
if
|
|
582
|
+
____cond124 = ____cond124 or ____switch124 == ActiveSlot.SLOT_POCKET2
|
|
583
|
+
if ____cond124 then
|
|
601
584
|
do
|
|
602
585
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
603
586
|
break
|
|
@@ -13,5 +13,5 @@ export declare function getPlayerNumTransformationCollectibles(player: EntityPla
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function getTransformationName(playerForm: PlayerForm): string;
|
|
15
15
|
export declare function getTransformationsForCollectibleType(collectibleType: CollectibleType | int): Set<PlayerForm>;
|
|
16
|
+
export declare function hasFlyingTransformation(player: EntityPlayer): boolean;
|
|
16
17
|
export declare function isTransformationFlying(playerForm: PlayerForm): boolean;
|
|
17
|
-
export declare function playerHasFlyingTransformation(player: EntityPlayer): boolean;
|
|
@@ -102,10 +102,7 @@ function ____exports.getTransformationsForCollectibleType(self, collectibleType)
|
|
|
102
102
|
local transformations = COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP:get(collectibleType)
|
|
103
103
|
return transformations == nil and __TS__New(Set) or copySet(nil, transformations)
|
|
104
104
|
end
|
|
105
|
-
function ____exports.
|
|
106
|
-
return TRANSFORMATIONS_THAT_GRANT_FLYING:has(playerForm)
|
|
107
|
-
end
|
|
108
|
-
function ____exports.playerHasFlyingTransformation(self, player)
|
|
105
|
+
function ____exports.hasFlyingTransformation(self, player)
|
|
109
106
|
for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING:values()) do
|
|
110
107
|
if player:HasPlayerForm(playerForm) then
|
|
111
108
|
return true
|
|
@@ -113,4 +110,7 @@ function ____exports.playerHasFlyingTransformation(self, player)
|
|
|
113
110
|
end
|
|
114
111
|
return false
|
|
115
112
|
end
|
|
113
|
+
function ____exports.isTransformationFlying(self, playerForm)
|
|
114
|
+
return TRANSFORMATIONS_THAT_GRANT_FLYING:has(playerForm)
|
|
115
|
+
end
|
|
116
116
|
return ____exports
|
|
@@ -3,3 +3,8 @@
|
|
|
3
3
|
* Returns a set containing every trinket type with the given cache flag, including modded trinkets.
|
|
4
4
|
*/
|
|
5
5
|
export declare function getTrinketsForCacheFlag(cacheFlag: CacheFlag): Set<TrinketType | int>;
|
|
6
|
+
/**
|
|
7
|
+
* Returns a map containing every trinket type that the player has that matches the provided
|
|
8
|
+
* CacheFlag. The values of the map correspond to the multiplier for that trinket.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getPlayerTrinketsForCacheFlag(player: EntityPlayer, cacheFlag: CacheFlag): Map<TrinketType | int, int>;
|
|
@@ -3,6 +3,7 @@ local ____lualib = require("lualib_bundle")
|
|
|
3
3
|
local Map = ____lualib.Map
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local Set = ____lualib.Set
|
|
6
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
7
|
local ____exports = {}
|
|
7
8
|
local ____set = require("functions.set")
|
|
8
9
|
local copySet = ____set.copySet
|
|
@@ -38,4 +39,15 @@ function ____exports.getTrinketsForCacheFlag(self, cacheFlag)
|
|
|
38
39
|
end
|
|
39
40
|
return copySet(nil, trinketsSet)
|
|
40
41
|
end
|
|
42
|
+
function ____exports.getPlayerTrinketsForCacheFlag(self, player, cacheFlag)
|
|
43
|
+
local trinketsForCacheFlag = ____exports.getTrinketsForCacheFlag(nil, cacheFlag)
|
|
44
|
+
local playerTrinkets = __TS__New(Map)
|
|
45
|
+
for ____, trinketType in __TS__Iterator(trinketsForCacheFlag:values()) do
|
|
46
|
+
local trinketMultiplier = player:GetTrinketMultiplier(trinketType)
|
|
47
|
+
if trinketMultiplier > 0 then
|
|
48
|
+
playerTrinkets:set(trinketType, trinketMultiplier)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
return playerTrinkets
|
|
52
|
+
end
|
|
41
53
|
return ____exports
|