isaacscript-common 1.2.21 → 1.2.25
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 +17 -1
- package/dist/functions/collectibleCacheFlag.lua +17 -0
- package/dist/functions/flying.d.ts +19 -0
- package/dist/functions/flying.lua +56 -0
- package/dist/functions/gridEntity.lua +1 -1
- package/dist/functions/player.d.ts +0 -16
- package/dist/functions/player.lua +30 -47
- package/dist/functions/set.d.ts +9 -2
- package/dist/functions/set.lua +8 -0
- package/dist/functions/transformations.d.ts +3 -1
- package/dist/functions/transformations.lua +14 -2
- package/dist/functions/trinketCacheFlag.d.ts +10 -0
- package/dist/functions/trinketCacheFlag.lua +53 -0
- package/dist/functions/trinkets.d.ts +1 -0
- package/dist/functions/trinkets.lua +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.lua +16 -0
- package/package.json +1 -1
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/**
|
|
3
3
|
* Returns a set containing every collectible type with the given cache flag, including modded
|
|
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
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Returns a set of all of the collectibles that grant flight. This is derived from collectibles
|
|
4
|
+
* that have `CacheFlag.CACHE_FLYING` set in the "items.xml" file.
|
|
5
|
+
*
|
|
6
|
+
* Collectibles that only grant flight conditionally are manually pruned. Collectibles such as Empty
|
|
7
|
+
* Vessel should be checked for via the `hasFlyingTemporaryEffect` function.
|
|
8
|
+
*
|
|
9
|
+
* @param pruneConditionalItems Whether or not collectibles that only grant flight conditionally
|
|
10
|
+
* should be included in the set (like Empty Vessel).
|
|
11
|
+
*/
|
|
12
|
+
export declare function getFlyingCollectibles(pruneConditionalItems: boolean): Set<CollectibleType | int>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns a set of all of the trinkets that grant flight. (All trinkets that grant flight do so
|
|
15
|
+
* conditionally, like Bat Wing.)
|
|
16
|
+
*/
|
|
17
|
+
export declare function getFlyingTrinkets(): Set<CollectibleType | int>;
|
|
18
|
+
export declare function hasFlyingTemporaryEffect(player: EntityPlayer): boolean;
|
|
19
|
+
export declare function isFlyingCharacter(player: EntityPlayer): boolean;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Set = ____lualib.Set
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
|
+
local ____exports = {}
|
|
7
|
+
local ____collectibleCacheFlag = require("functions.collectibleCacheFlag")
|
|
8
|
+
local getCollectiblesForCacheFlag = ____collectibleCacheFlag.getCollectiblesForCacheFlag
|
|
9
|
+
local ____set = require("functions.set")
|
|
10
|
+
local copySet = ____set.copySet
|
|
11
|
+
local deleteSetsFromSet = ____set.deleteSetsFromSet
|
|
12
|
+
local FLYING_CHARACTERS = __TS__New(Set, {
|
|
13
|
+
PlayerType.PLAYER_AZAZEL,
|
|
14
|
+
PlayerType.PLAYER_THELOST,
|
|
15
|
+
PlayerType.PLAYER_THESOUL,
|
|
16
|
+
PlayerType.PLAYER_THELOST_B,
|
|
17
|
+
PlayerType.PLAYER_JACOB2_B,
|
|
18
|
+
PlayerType.PLAYER_THESOUL_B
|
|
19
|
+
})
|
|
20
|
+
local FLYING_TRINKETS = __TS__New(Set, {TrinketType.TRINKET_BAT_WING, TrinketType.TRINKET_AZAZELS_STUMP})
|
|
21
|
+
function ____exports.getFlyingCollectibles(self, pruneConditionalItems)
|
|
22
|
+
local collectiblesWithFlyingCacheFlag = getCollectiblesForCacheFlag(nil, CacheFlag.CACHE_FLYING)
|
|
23
|
+
local collectiblesWithAllCacheFlag = getCollectiblesForCacheFlag(nil, CacheFlag.CACHE_ALL)
|
|
24
|
+
deleteSetsFromSet(nil, collectiblesWithFlyingCacheFlag, collectiblesWithAllCacheFlag)
|
|
25
|
+
if pruneConditionalItems then
|
|
26
|
+
collectiblesWithFlyingCacheFlag:delete(CollectibleType.COLLECTIBLE_BIBLE)
|
|
27
|
+
collectiblesWithFlyingCacheFlag:delete(CollectibleType.COLLECTIBLE_EMPTY_VESSEL)
|
|
28
|
+
collectiblesWithFlyingCacheFlag:delete(CollectibleType.COLLECTIBLE_ASTRAL_PROJECTION)
|
|
29
|
+
collectiblesWithFlyingCacheFlag:delete(CollectibleType.COLLECTIBLE_RECALL)
|
|
30
|
+
end
|
|
31
|
+
return collectiblesWithFlyingCacheFlag
|
|
32
|
+
end
|
|
33
|
+
function ____exports.getFlyingTrinkets(self)
|
|
34
|
+
return copySet(nil, FLYING_TRINKETS)
|
|
35
|
+
end
|
|
36
|
+
function ____exports.hasFlyingTemporaryEffect(self, player)
|
|
37
|
+
local effects = player:GetEffects()
|
|
38
|
+
local flyingCollectibles = ____exports.getFlyingCollectibles(nil, false)
|
|
39
|
+
for ____, collectibleType in __TS__Iterator(flyingCollectibles:values()) do
|
|
40
|
+
if effects:HasCollectibleEffect(collectibleType) then
|
|
41
|
+
return true
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
local flyingTrinkets = ____exports.getFlyingTrinkets(nil)
|
|
45
|
+
for ____, trinketType in __TS__Iterator(flyingTrinkets:values()) do
|
|
46
|
+
if effects:HasTrinketEffect(trinketType) then
|
|
47
|
+
return true
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
return false
|
|
51
|
+
end
|
|
52
|
+
function ____exports.isFlyingCharacter(self, player)
|
|
53
|
+
local character = player:GetPlayerType()
|
|
54
|
+
return FLYING_CHARACTERS:has(character)
|
|
55
|
+
end
|
|
56
|
+
return ____exports
|
|
@@ -86,7 +86,7 @@ function ____exports.getCollidingEntitiesWithGridEntity(self, gridEntity)
|
|
|
86
86
|
function(____, entity) return isCircleIntersectingRectangle(
|
|
87
87
|
nil,
|
|
88
88
|
entity.Position,
|
|
89
|
-
entity.Size,
|
|
89
|
+
entity.Size + 0.1,
|
|
90
90
|
gridEntityCollisionTopLeft,
|
|
91
91
|
gridEntityCollisionBottomRight
|
|
92
92
|
) end
|
|
@@ -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
|
package/dist/functions/set.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Helper function to add all of the
|
|
3
|
-
*
|
|
2
|
+
* Helper function to add all of the values in one set to another set. The first set passed will be
|
|
3
|
+
* modified in place.
|
|
4
4
|
*
|
|
5
5
|
* This function is variadic, meaning that you can specify N sets to add to the first set.
|
|
6
6
|
*/
|
|
@@ -13,3 +13,10 @@ export declare function copySet<T>(oldSet: Set<T>): Set<T>;
|
|
|
13
13
|
* This function is variadic, meaning that you can specify N sets.
|
|
14
14
|
*/
|
|
15
15
|
export declare function combineSets<T>(...sets: Array<Set<T>>): Set<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Helper function to delete all of the values in one set from another set. The first set passed
|
|
18
|
+
* will be modified in place.
|
|
19
|
+
*
|
|
20
|
+
* This function is variadic, meaning that you can specify N sets to remove from the first set.
|
|
21
|
+
*/
|
|
22
|
+
export declare function deleteSetsFromSet<T>(mainSet: Set<T>, ...setsToRemove: Array<Set<T>>): void;
|
package/dist/functions/set.lua
CHANGED
|
@@ -29,4 +29,12 @@ function ____exports.combineSets(self, ...)
|
|
|
29
29
|
end
|
|
30
30
|
return newSet
|
|
31
31
|
end
|
|
32
|
+
function ____exports.deleteSetsFromSet(self, mainSet, ...)
|
|
33
|
+
local setsToRemove = {...}
|
|
34
|
+
for ____, set in ipairs(setsToRemove) do
|
|
35
|
+
for ____, value in __TS__Iterator(set:values()) do
|
|
36
|
+
mainSet:delete(value)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
32
40
|
return ____exports
|
|
@@ -11,5 +11,7 @@ export declare function getPlayerNumTransformationCollectibles(player: EntityPla
|
|
|
11
11
|
* // transformationName is "Beelzebub"
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
-
export declare function getTransformationName(
|
|
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;
|
|
17
|
+
export declare function isTransformationFlying(playerForm: PlayerForm): boolean;
|
|
@@ -27,6 +27,7 @@ local TRANSFORMATION_TO_TAG_MAP = __TS__New(Map, {
|
|
|
27
27
|
{PlayerForm.PLAYERFORM_SPIDERBABY, 16384}
|
|
28
28
|
})
|
|
29
29
|
local TRANSFORMATIONS_NOT_BASED_ON_ITEMS = __TS__New(Set, {PlayerForm.PLAYERFORM_ADULTHOOD, PlayerForm.PLAYERFORM_STOMPY, PlayerForm.PLAYERFORM_FLIGHT})
|
|
30
|
+
local TRANSFORMATIONS_THAT_GRANT_FLYING = __TS__New(Set, {PlayerForm.PLAYERFORM_GUPPY, PlayerForm.PLAYERFORM_LORD_OF_THE_FLIES, PlayerForm.PLAYERFORM_ANGEL, PlayerForm.PLAYERFORM_EVIL_ANGEL})
|
|
30
31
|
local TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP = __TS__New(Map)
|
|
31
32
|
local COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP = __TS__New(Map)
|
|
32
33
|
local function initMaps(self)
|
|
@@ -89,9 +90,9 @@ function ____exports.getPlayerNumTransformationCollectibles(self, player, player
|
|
|
89
90
|
end
|
|
90
91
|
return numCollectibles
|
|
91
92
|
end
|
|
92
|
-
function ____exports.getTransformationName(self,
|
|
93
|
+
function ____exports.getTransformationName(self, playerForm)
|
|
93
94
|
local defaultName = "Unknown"
|
|
94
|
-
local transformationName = TRANSFORMATION_NAME_MAP:get(
|
|
95
|
+
local transformationName = TRANSFORMATION_NAME_MAP:get(playerForm)
|
|
95
96
|
return transformationName == nil and defaultName or transformationName
|
|
96
97
|
end
|
|
97
98
|
function ____exports.getTransformationsForCollectibleType(self, collectibleType)
|
|
@@ -101,4 +102,15 @@ function ____exports.getTransformationsForCollectibleType(self, collectibleType)
|
|
|
101
102
|
local transformations = COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP:get(collectibleType)
|
|
102
103
|
return transformations == nil and __TS__New(Set) or copySet(nil, transformations)
|
|
103
104
|
end
|
|
105
|
+
function ____exports.hasFlyingTransformation(self, player)
|
|
106
|
+
for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING:values()) do
|
|
107
|
+
if player:HasPlayerForm(playerForm) then
|
|
108
|
+
return true
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
return false
|
|
112
|
+
end
|
|
113
|
+
function ____exports.isTransformationFlying(self, playerForm)
|
|
114
|
+
return TRANSFORMATIONS_THAT_GRANT_FLYING:has(playerForm)
|
|
115
|
+
end
|
|
104
116
|
return ____exports
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
/**
|
|
3
|
+
* Returns a set containing every trinket type with the given cache flag, including modded trinkets.
|
|
4
|
+
*/
|
|
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>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____lualib = require("lualib_bundle")
|
|
3
|
+
local Map = ____lualib.Map
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local Set = ____lualib.Set
|
|
6
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
7
|
+
local ____exports = {}
|
|
8
|
+
local ____set = require("functions.set")
|
|
9
|
+
local copySet = ____set.copySet
|
|
10
|
+
local ____trinkets = require("functions.trinkets")
|
|
11
|
+
local getMaxTrinketID = ____trinkets.getMaxTrinketID
|
|
12
|
+
local trinketHasCacheFlag = ____trinkets.trinketHasCacheFlag
|
|
13
|
+
local ____util = require("functions.util")
|
|
14
|
+
local getEnumValues = ____util.getEnumValues
|
|
15
|
+
local CACHE_FLAG_TO_TRINKETS_MAP = __TS__New(Map)
|
|
16
|
+
local function initCacheFlagMap(self)
|
|
17
|
+
local maxTrinketID = getMaxTrinketID(nil)
|
|
18
|
+
for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
|
|
19
|
+
local trinketsSet = __TS__New(Set)
|
|
20
|
+
do
|
|
21
|
+
local trinketType = 1
|
|
22
|
+
while trinketType <= maxTrinketID do
|
|
23
|
+
if trinketHasCacheFlag(nil, trinketType, cacheFlag) then
|
|
24
|
+
trinketsSet:add(trinketType)
|
|
25
|
+
end
|
|
26
|
+
trinketType = trinketType + 1
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
CACHE_FLAG_TO_TRINKETS_MAP:set(cacheFlag, trinketsSet)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
function ____exports.getTrinketsForCacheFlag(self, cacheFlag)
|
|
33
|
+
if CACHE_FLAG_TO_TRINKETS_MAP.size == 0 then
|
|
34
|
+
initCacheFlagMap(nil)
|
|
35
|
+
end
|
|
36
|
+
local trinketsSet = CACHE_FLAG_TO_TRINKETS_MAP:get(cacheFlag)
|
|
37
|
+
if trinketsSet == nil then
|
|
38
|
+
return __TS__New(Set)
|
|
39
|
+
end
|
|
40
|
+
return copySet(nil, trinketsSet)
|
|
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
|
|
53
|
+
return ____exports
|
|
@@ -52,3 +52,4 @@ export declare function isGoldenTrinket(trinketType: TrinketType | int): boolean
|
|
|
52
52
|
* avoid calling this function multiple times. 1 by default.
|
|
53
53
|
*/
|
|
54
54
|
export declare function smeltTrinket(player: EntityPlayer, trinketType: TrinketType | int, numTrinkets?: number): void;
|
|
55
|
+
export declare function trinketHasCacheFlag(trinketType: TrinketType | int, cacheFlag: CacheFlag): boolean;
|
|
@@ -10,6 +10,8 @@ local ____trinketNameMap = require("maps.trinketNameMap")
|
|
|
10
10
|
local TRINKET_NAME_MAP = ____trinketNameMap.TRINKET_NAME_MAP
|
|
11
11
|
local ____entity = require("functions.entity")
|
|
12
12
|
local getPickups = ____entity.getPickups
|
|
13
|
+
local ____flag = require("functions.flag")
|
|
14
|
+
local hasFlag = ____flag.hasFlag
|
|
13
15
|
local ____player = require("functions.player")
|
|
14
16
|
local useActiveItemTemp = ____player.useActiveItemTemp
|
|
15
17
|
local ____trinketGive = require("functions.trinketGive")
|
|
@@ -98,4 +100,12 @@ function ____exports.smeltTrinket(self, player, trinketType, numTrinkets)
|
|
|
98
100
|
end
|
|
99
101
|
giveTrinketsBack(nil, player, trinketSituation)
|
|
100
102
|
end
|
|
103
|
+
function ____exports.trinketHasCacheFlag(self, trinketType, cacheFlag)
|
|
104
|
+
local itemConfig = Isaac.GetItemConfig()
|
|
105
|
+
local itemConfigItem = itemConfig:GetTrinket(trinketType)
|
|
106
|
+
if itemConfigItem == nil then
|
|
107
|
+
return false
|
|
108
|
+
end
|
|
109
|
+
return hasFlag(nil, itemConfigItem.CacheFlags, cacheFlag)
|
|
110
|
+
end
|
|
101
111
|
return ____exports
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from "./functions/doors";
|
|
|
24
24
|
export * from "./functions/entity";
|
|
25
25
|
export * from "./functions/familiars";
|
|
26
26
|
export * from "./functions/flag";
|
|
27
|
+
export * from "./functions/flying";
|
|
27
28
|
export * from "./functions/globals";
|
|
28
29
|
export * from "./functions/gridEntity";
|
|
29
30
|
export * from "./functions/input";
|
|
@@ -49,6 +50,7 @@ export * from "./functions/sprite";
|
|
|
49
50
|
export * from "./functions/stage";
|
|
50
51
|
export * from "./functions/tears";
|
|
51
52
|
export * from "./functions/transformations";
|
|
53
|
+
export * from "./functions/trinketCacheFlag";
|
|
52
54
|
export * from "./functions/trinketGive";
|
|
53
55
|
export * from "./functions/trinkets";
|
|
54
56
|
export * from "./functions/trinketSet";
|
package/dist/index.lua
CHANGED
|
@@ -198,6 +198,14 @@ do
|
|
|
198
198
|
end
|
|
199
199
|
end
|
|
200
200
|
end
|
|
201
|
+
do
|
|
202
|
+
local ____export = require("functions.flying")
|
|
203
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
204
|
+
if ____exportKey ~= "default" then
|
|
205
|
+
____exports[____exportKey] = ____exportValue
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
end
|
|
201
209
|
do
|
|
202
210
|
local ____export = require("functions.globals")
|
|
203
211
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
@@ -398,6 +406,14 @@ do
|
|
|
398
406
|
end
|
|
399
407
|
end
|
|
400
408
|
end
|
|
409
|
+
do
|
|
410
|
+
local ____export = require("functions.trinketCacheFlag")
|
|
411
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
412
|
+
if ____exportKey ~= "default" then
|
|
413
|
+
____exports[____exportKey] = ____exportValue
|
|
414
|
+
end
|
|
415
|
+
end
|
|
416
|
+
end
|
|
401
417
|
do
|
|
402
418
|
local ____export = require("functions.trinketGive")
|
|
403
419
|
for ____exportKey, ____exportValue in pairs(____export) do
|