isaacscript-common 33.0.2 → 33.2.0
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/index.rollup.d.ts +25 -0
- package/dist/isaacscript-common.lua +38 -14
- package/dist/src/functions/playerHealth.d.ts +8 -0
- package/dist/src/functions/playerHealth.d.ts.map +1 -1
- package/dist/src/functions/playerHealth.lua +4 -0
- package/dist/src/functions/players.d.ts +12 -0
- package/dist/src/functions/players.d.ts.map +1 -1
- package/dist/src/functions/players.lua +28 -13
- package/dist/src/functions/trinkets.d.ts +2 -0
- package/dist/src/functions/trinkets.d.ts.map +1 -1
- package/dist/src/functions/trinkets.lua +16 -0
- package/package.json +1 -1
- package/src/functions/playerHealth.ts +8 -0
- package/src/functions/players.ts +20 -0
- package/src/functions/trinkets.ts +11 -0
package/dist/index.rollup.d.ts
CHANGED
|
@@ -7396,6 +7396,9 @@ export declare function gridIndexToGridPosition(gridIndex: int, roomShape: RoomS
|
|
|
7396
7396
|
*/
|
|
7397
7397
|
export declare function gridPositionToWorldPosition(gridPosition: Vector): Readonly<Vector>;
|
|
7398
7398
|
|
|
7399
|
+
/** Helper function to check to see if the player is holding one or more trinkets. */
|
|
7400
|
+
export declare function hasAnyTrinket(player: EntityPlayer): boolean;
|
|
7401
|
+
|
|
7399
7402
|
/**
|
|
7400
7403
|
* Helper function to see if a particular entity has armor. In this context, armor refers to the
|
|
7401
7404
|
* damage scaling mechanic. For example, Ultra Greed has armor, but a Gaper does not.
|
|
@@ -7501,6 +7504,20 @@ export declare function hasOpenPocketItemSlot(player: EntityPlayer): boolean;
|
|
|
7501
7504
|
*/
|
|
7502
7505
|
export declare function hasOpenTrinketSlot(player: EntityPlayer): boolean;
|
|
7503
7506
|
|
|
7507
|
+
/**
|
|
7508
|
+
* Helper function to check if a player has piercing tears.
|
|
7509
|
+
*
|
|
7510
|
+
* Under the hood, this checks the `EntityPlayer.TearFlags` variable.
|
|
7511
|
+
*/
|
|
7512
|
+
export declare function hasPiercing(player: EntityPlayer): boolean;
|
|
7513
|
+
|
|
7514
|
+
/**
|
|
7515
|
+
* Helper function to check if a player has spectral tears.
|
|
7516
|
+
*
|
|
7517
|
+
* Under the hood, this checks the `EntityPlayer.TearFlags` variable.
|
|
7518
|
+
*/
|
|
7519
|
+
export declare function hasSpectral(player: EntityPlayer): boolean;
|
|
7520
|
+
|
|
7504
7521
|
/**
|
|
7505
7522
|
* Helper function to check if the current room has one or more open door slots that can be used to
|
|
7506
7523
|
* make custom doors.
|
|
@@ -13886,8 +13903,16 @@ declare class PlayerCollectibleDetection extends Feature {
|
|
|
13886
13903
|
private checkActiveItemsChanged;
|
|
13887
13904
|
}
|
|
13888
13905
|
|
|
13906
|
+
/**
|
|
13907
|
+
* Helper function to remove all of a player's black hearts and add the corresponding amount of soul
|
|
13908
|
+
* hearts.
|
|
13909
|
+
*/
|
|
13889
13910
|
export declare function playerConvertBlackHeartsToSoulHearts(player: EntityPlayer): void;
|
|
13890
13911
|
|
|
13912
|
+
/**
|
|
13913
|
+
* Helper function to remove all of a player's soul hearts and add the corresponding amount of black
|
|
13914
|
+
* hearts.
|
|
13915
|
+
*/
|
|
13891
13916
|
export declare function playerConvertSoulHeartsToBlackHearts(player: EntityPlayer): void;
|
|
13892
13917
|
|
|
13893
13918
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 33.0
|
|
3
|
+
isaacscript-common 33.2.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -21811,6 +21811,7 @@ local ControllerIndex = ____isaac_2Dtypescript_2Ddefinitions.ControllerIndex
|
|
|
21811
21811
|
local NullItemID = ____isaac_2Dtypescript_2Ddefinitions.NullItemID
|
|
21812
21812
|
local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
|
|
21813
21813
|
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
21814
|
+
local TearFlag = ____isaac_2Dtypescript_2Ddefinitions.TearFlag
|
|
21814
21815
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
21815
21816
|
local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
|
|
21816
21817
|
local ACTIVE_SLOT_VALUES = ____cachedEnumValues.ACTIVE_SLOT_VALUES
|
|
@@ -21828,6 +21829,8 @@ local getCharacterName = ____characters.getCharacterName
|
|
|
21828
21829
|
local isVanillaCharacter = ____characters.isVanillaCharacter
|
|
21829
21830
|
local ____collectibles = require("src.functions.collectibles")
|
|
21830
21831
|
local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
|
|
21832
|
+
local ____flag = require("src.functions.flag")
|
|
21833
|
+
local hasFlag = ____flag.hasFlag
|
|
21831
21834
|
local ____playerIndex = require("src.functions.playerIndex")
|
|
21832
21835
|
local getAllPlayers = ____playerIndex.getAllPlayers
|
|
21833
21836
|
local getPlayerIndexVanilla = ____playerIndex.getPlayerIndexVanilla
|
|
@@ -22132,6 +22135,12 @@ function ____exports.hasOpenActiveItemSlot(self, player)
|
|
|
22132
22135
|
end
|
|
22133
22136
|
return activeItemPrimary == CollectibleType.NULL
|
|
22134
22137
|
end
|
|
22138
|
+
function ____exports.hasPiercing(self, player)
|
|
22139
|
+
return hasFlag(nil, player.TearFlags, TearFlag.PIERCING)
|
|
22140
|
+
end
|
|
22141
|
+
function ____exports.hasSpectral(self, player)
|
|
22142
|
+
return hasFlag(nil, player.TearFlags, TearFlag.SPECTRAL)
|
|
22143
|
+
end
|
|
22135
22144
|
function ____exports.isActiveSlotEmpty(self, player, activeSlot)
|
|
22136
22145
|
if activeSlot == nil then
|
|
22137
22146
|
activeSlot = ActiveSlot.PRIMARY
|
|
@@ -22198,7 +22207,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
22198
22207
|
do
|
|
22199
22208
|
local collectibleType = player:GetActiveItem(activeSlot)
|
|
22200
22209
|
if collectibleType == CollectibleType.NULL then
|
|
22201
|
-
goto
|
|
22210
|
+
goto __continue96
|
|
22202
22211
|
end
|
|
22203
22212
|
local stillHasCollectible
|
|
22204
22213
|
repeat
|
|
@@ -22208,7 +22217,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
22208
22217
|
end
|
|
22209
22218
|
until not stillHasCollectible
|
|
22210
22219
|
end
|
|
22211
|
-
::
|
|
22220
|
+
::__continue96::
|
|
22212
22221
|
end
|
|
22213
22222
|
end
|
|
22214
22223
|
function ____exports.removeAllPlayerTrinkets(self, player)
|
|
@@ -22216,7 +22225,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
22216
22225
|
do
|
|
22217
22226
|
local trinketType = player:GetTrinket(trinketSlot)
|
|
22218
22227
|
if trinketType == TrinketType.NULL then
|
|
22219
|
-
goto
|
|
22228
|
+
goto __continue101
|
|
22220
22229
|
end
|
|
22221
22230
|
local hasTrinket
|
|
22222
22231
|
repeat
|
|
@@ -22226,7 +22235,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
22226
22235
|
end
|
|
22227
22236
|
until not hasTrinket
|
|
22228
22237
|
end
|
|
22229
|
-
::
|
|
22238
|
+
::__continue101::
|
|
22230
22239
|
end
|
|
22231
22240
|
end
|
|
22232
22241
|
function ____exports.removeCollectible(self, player, ...)
|
|
@@ -22286,9 +22295,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
22286
22295
|
itemPool:RemoveCollectible(collectibleType)
|
|
22287
22296
|
end
|
|
22288
22297
|
repeat
|
|
22289
|
-
local
|
|
22290
|
-
local
|
|
22291
|
-
if
|
|
22298
|
+
local ____switch123 = activeSlot
|
|
22299
|
+
local ____cond123 = ____switch123 == ActiveSlot.PRIMARY
|
|
22300
|
+
if ____cond123 then
|
|
22292
22301
|
do
|
|
22293
22302
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
22294
22303
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -22297,8 +22306,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
22297
22306
|
break
|
|
22298
22307
|
end
|
|
22299
22308
|
end
|
|
22300
|
-
|
|
22301
|
-
if
|
|
22309
|
+
____cond123 = ____cond123 or ____switch123 == ActiveSlot.SECONDARY
|
|
22310
|
+
if ____cond123 then
|
|
22302
22311
|
do
|
|
22303
22312
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
22304
22313
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -22313,16 +22322,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
22313
22322
|
break
|
|
22314
22323
|
end
|
|
22315
22324
|
end
|
|
22316
|
-
|
|
22317
|
-
if
|
|
22325
|
+
____cond123 = ____cond123 or ____switch123 == ActiveSlot.POCKET
|
|
22326
|
+
if ____cond123 then
|
|
22318
22327
|
do
|
|
22319
22328
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
22320
22329
|
player:SetActiveCharge(charge, activeSlot)
|
|
22321
22330
|
break
|
|
22322
22331
|
end
|
|
22323
22332
|
end
|
|
22324
|
-
|
|
22325
|
-
if
|
|
22333
|
+
____cond123 = ____cond123 or ____switch123 == ActiveSlot.POCKET_SINGLE_USE
|
|
22334
|
+
if ____cond123 then
|
|
22326
22335
|
do
|
|
22327
22336
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
22328
22337
|
break
|
|
@@ -29366,11 +29375,16 @@ ____exports.TRINKET_TYPE_TO_NAME_MAP = __TS__New(ReadonlyMap, {
|
|
|
29366
29375
|
return ____exports
|
|
29367
29376
|
end,
|
|
29368
29377
|
["src.functions.trinkets"] = function(...)
|
|
29378
|
+
local ____lualib = require("lualib_bundle")
|
|
29379
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
29380
|
+
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
29369
29381
|
local ____exports = {}
|
|
29370
29382
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
29371
29383
|
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
29372
29384
|
local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
|
|
29373
29385
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
29386
|
+
local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
|
|
29387
|
+
local TRINKET_SLOT_VALUES = ____cachedEnumValues.TRINKET_SLOT_VALUES
|
|
29374
29388
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
29375
29389
|
local itemConfig = ____cachedClasses.itemConfig
|
|
29376
29390
|
local ____constants = require("src.core.constants")
|
|
@@ -29468,6 +29482,16 @@ end
|
|
|
29468
29482
|
function ____exports.getVanillaTrinketTypeRange(self)
|
|
29469
29483
|
return iRange(nil, FIRST_TRINKET_TYPE, LAST_VANILLA_TRINKET_TYPE)
|
|
29470
29484
|
end
|
|
29485
|
+
function ____exports.hasAnyTrinket(self, player)
|
|
29486
|
+
local playerTrinketTypes = __TS__ArrayMap(
|
|
29487
|
+
TRINKET_SLOT_VALUES,
|
|
29488
|
+
function(____, trinketSlot) return player:GetTrinket(trinketSlot) end
|
|
29489
|
+
)
|
|
29490
|
+
return __TS__ArrayEvery(
|
|
29491
|
+
playerTrinketTypes,
|
|
29492
|
+
function(____, trinketType) return trinketType == TrinketType.NULL end
|
|
29493
|
+
)
|
|
29494
|
+
end
|
|
29471
29495
|
function ____exports.hasOpenTrinketSlot(self, player)
|
|
29472
29496
|
if isCharacter(nil, player, PlayerType.SOUL_B) then
|
|
29473
29497
|
return false
|
|
@@ -104,7 +104,15 @@ export declare function getPlayerSoulHearts(player: EntityPlayer): int;
|
|
|
104
104
|
export declare function getTaintedMagdaleneNonTemporaryMaxHearts(player: EntityPlayer): int;
|
|
105
105
|
/** Returns a `PlayerHealth` object with all zeros. */
|
|
106
106
|
export declare function newPlayerHealth(): PlayerHealth;
|
|
107
|
+
/**
|
|
108
|
+
* Helper function to remove all of a player's black hearts and add the corresponding amount of soul
|
|
109
|
+
* hearts.
|
|
110
|
+
*/
|
|
107
111
|
export declare function playerConvertBlackHeartsToSoulHearts(player: EntityPlayer): void;
|
|
112
|
+
/**
|
|
113
|
+
* Helper function to remove all of a player's soul hearts and add the corresponding amount of black
|
|
114
|
+
* hearts.
|
|
115
|
+
*/
|
|
108
116
|
export declare function playerConvertSoulHeartsToBlackHearts(player: EntityPlayer): void;
|
|
109
117
|
/**
|
|
110
118
|
* Helper function to see if the player is out of health.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAY9E,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,GACb,IAAI,CA+CN;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAMlE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAK1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAKzE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAYtE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAK9D;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;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAKzD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAoDnE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAqCrE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAK7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,wCAAwC,CACtD,MAAM,EAAE,YAAY,GACnB,GAAG,CAML;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,CAyHN;AAED;;;;;;;;;GASG;AACH,wBAAgB,sDAAsD,CACpE,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,KAAK,GAClB,OAAO,CAyBT"}
|
|
1
|
+
{"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM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YAAY,GACnB,IAAI,CAQN;AAED;;;GAGG;AACH,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,CAyHN;AAED;;;;;;;;;GASG;AACH,wBAAgB,sDAAsD,CACpE,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,KAAK,GAClB,OAAO,CAyBT"}
|
|
@@ -520,6 +520,8 @@ function ____exports.newPlayerHealth(self)
|
|
|
520
520
|
soulHeartTypes = {}
|
|
521
521
|
}
|
|
522
522
|
end
|
|
523
|
+
--- Helper function to remove all of a player's black hearts and add the corresponding amount of soul
|
|
524
|
+
-- hearts.
|
|
523
525
|
function ____exports.playerConvertBlackHeartsToSoulHearts(self, player)
|
|
524
526
|
local playerHealth = ____exports.getPlayerHealth(nil, player)
|
|
525
527
|
____exports.removeAllPlayerHealth(nil, player)
|
|
@@ -529,6 +531,8 @@ function ____exports.playerConvertBlackHeartsToSoulHearts(self, player)
|
|
|
529
531
|
)
|
|
530
532
|
____exports.setPlayerHealth(nil, player, playerHealth)
|
|
531
533
|
end
|
|
534
|
+
--- Helper function to remove all of a player's soul hearts and add the corresponding amount of black
|
|
535
|
+
-- hearts.
|
|
532
536
|
function ____exports.playerConvertSoulHeartsToBlackHearts(self, player)
|
|
533
537
|
local playerHealth = ____exports.getPlayerHealth(nil, player)
|
|
534
538
|
____exports.removeAllPlayerHealth(nil, player)
|
|
@@ -217,6 +217,18 @@ export declare function hasLostCurse(player: EntityPlayer): boolean;
|
|
|
217
217
|
* items. (Only Tainted Forgotten can pick up items.)
|
|
218
218
|
*/
|
|
219
219
|
export declare function hasOpenActiveItemSlot(player: EntityPlayer): boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Helper function to check if a player has piercing tears.
|
|
222
|
+
*
|
|
223
|
+
* Under the hood, this checks the `EntityPlayer.TearFlags` variable.
|
|
224
|
+
*/
|
|
225
|
+
export declare function hasPiercing(player: EntityPlayer): boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Helper function to check if a player has spectral tears.
|
|
228
|
+
*
|
|
229
|
+
* Under the hood, this checks the `EntityPlayer.TearFlags` variable.
|
|
230
|
+
*/
|
|
231
|
+
export declare function hasSpectral(player: EntityPlayer): boolean;
|
|
220
232
|
/**
|
|
221
233
|
* Helper function to check if the active slot of a particular player is empty.
|
|
222
234
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,eAAe,EACf,eAAe,EAEf,UAAU,EACV,UAAU,
|
|
1
|
+
{"version":3,"file":"players.d.ts","sourceRoot":"","sources":["../../../src/functions/players.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAEV,eAAe,EACf,eAAe,EAEf,UAAU,EACV,UAAU,EAEV,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAmBtC;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAIN;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,eAAe,GAC/B,IAAI,CAON;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,eAAe,EAAE,eAAe,EAChC,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAMT;AAED;;;;;;GAMG;AAC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14,6 +14,7 @@ local ControllerIndex = ____isaac_2Dtypescript_2Ddefinitions.ControllerIndex
|
|
|
14
14
|
local NullItemID = ____isaac_2Dtypescript_2Ddefinitions.NullItemID
|
|
15
15
|
local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
|
|
16
16
|
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
17
|
+
local TearFlag = ____isaac_2Dtypescript_2Ddefinitions.TearFlag
|
|
17
18
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
18
19
|
local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
|
|
19
20
|
local ACTIVE_SLOT_VALUES = ____cachedEnumValues.ACTIVE_SLOT_VALUES
|
|
@@ -31,6 +32,8 @@ local getCharacterName = ____characters.getCharacterName
|
|
|
31
32
|
local isVanillaCharacter = ____characters.isVanillaCharacter
|
|
32
33
|
local ____collectibles = require("src.functions.collectibles")
|
|
33
34
|
local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
|
|
35
|
+
local ____flag = require("src.functions.flag")
|
|
36
|
+
local hasFlag = ____flag.hasFlag
|
|
34
37
|
local ____playerIndex = require("src.functions.playerIndex")
|
|
35
38
|
local getAllPlayers = ____playerIndex.getAllPlayers
|
|
36
39
|
local getPlayerIndexVanilla = ____playerIndex.getPlayerIndexVanilla
|
|
@@ -466,6 +469,18 @@ function ____exports.hasOpenActiveItemSlot(self, player)
|
|
|
466
469
|
end
|
|
467
470
|
return activeItemPrimary == CollectibleType.NULL
|
|
468
471
|
end
|
|
472
|
+
--- Helper function to check if a player has piercing tears.
|
|
473
|
+
--
|
|
474
|
+
-- Under the hood, this checks the `EntityPlayer.TearFlags` variable.
|
|
475
|
+
function ____exports.hasPiercing(self, player)
|
|
476
|
+
return hasFlag(nil, player.TearFlags, TearFlag.PIERCING)
|
|
477
|
+
end
|
|
478
|
+
--- Helper function to check if a player has spectral tears.
|
|
479
|
+
--
|
|
480
|
+
-- Under the hood, this checks the `EntityPlayer.TearFlags` variable.
|
|
481
|
+
function ____exports.hasSpectral(self, player)
|
|
482
|
+
return hasFlag(nil, player.TearFlags, TearFlag.SPECTRAL)
|
|
483
|
+
end
|
|
469
484
|
--- Helper function to check if the active slot of a particular player is empty.
|
|
470
485
|
--
|
|
471
486
|
-- @param player The player to check.
|
|
@@ -556,7 +571,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
556
571
|
do
|
|
557
572
|
local collectibleType = player:GetActiveItem(activeSlot)
|
|
558
573
|
if collectibleType == CollectibleType.NULL then
|
|
559
|
-
goto
|
|
574
|
+
goto __continue96
|
|
560
575
|
end
|
|
561
576
|
local stillHasCollectible
|
|
562
577
|
repeat
|
|
@@ -566,7 +581,7 @@ function ____exports.removeAllActiveItems(self, player)
|
|
|
566
581
|
end
|
|
567
582
|
until not stillHasCollectible
|
|
568
583
|
end
|
|
569
|
-
::
|
|
584
|
+
::__continue96::
|
|
570
585
|
end
|
|
571
586
|
end
|
|
572
587
|
--- Helper function to remove all of the held trinkets from a player.
|
|
@@ -578,7 +593,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
578
593
|
do
|
|
579
594
|
local trinketType = player:GetTrinket(trinketSlot)
|
|
580
595
|
if trinketType == TrinketType.NULL then
|
|
581
|
-
goto
|
|
596
|
+
goto __continue101
|
|
582
597
|
end
|
|
583
598
|
local hasTrinket
|
|
584
599
|
repeat
|
|
@@ -588,7 +603,7 @@ function ____exports.removeAllPlayerTrinkets(self, player)
|
|
|
588
603
|
end
|
|
589
604
|
until not hasTrinket
|
|
590
605
|
end
|
|
591
|
-
::
|
|
606
|
+
::__continue101::
|
|
592
607
|
end
|
|
593
608
|
end
|
|
594
609
|
--- Helper function to remove one or more collectibles to a player.
|
|
@@ -679,9 +694,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
679
694
|
itemPool:RemoveCollectible(collectibleType)
|
|
680
695
|
end
|
|
681
696
|
repeat
|
|
682
|
-
local
|
|
683
|
-
local
|
|
684
|
-
if
|
|
697
|
+
local ____switch123 = activeSlot
|
|
698
|
+
local ____cond123 = ____switch123 == ActiveSlot.PRIMARY
|
|
699
|
+
if ____cond123 then
|
|
685
700
|
do
|
|
686
701
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
687
702
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -690,8 +705,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
690
705
|
break
|
|
691
706
|
end
|
|
692
707
|
end
|
|
693
|
-
|
|
694
|
-
if
|
|
708
|
+
____cond123 = ____cond123 or ____switch123 == ActiveSlot.SECONDARY
|
|
709
|
+
if ____cond123 then
|
|
695
710
|
do
|
|
696
711
|
if primaryCollectibleType ~= CollectibleType.NULL then
|
|
697
712
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -706,16 +721,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
706
721
|
break
|
|
707
722
|
end
|
|
708
723
|
end
|
|
709
|
-
|
|
710
|
-
if
|
|
724
|
+
____cond123 = ____cond123 or ____switch123 == ActiveSlot.POCKET
|
|
725
|
+
if ____cond123 then
|
|
711
726
|
do
|
|
712
727
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
713
728
|
player:SetActiveCharge(charge, activeSlot)
|
|
714
729
|
break
|
|
715
730
|
end
|
|
716
731
|
end
|
|
717
|
-
|
|
718
|
-
if
|
|
732
|
+
____cond123 = ____cond123 or ____switch123 == ActiveSlot.POCKET_SINGLE_USE
|
|
733
|
+
if ____cond123 then
|
|
719
734
|
do
|
|
720
735
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
721
736
|
break
|
|
@@ -78,6 +78,8 @@ export declare function getTrinketName(trinketType: TrinketType): string;
|
|
|
78
78
|
* are part of `ISCFeature.MODDED_ELEMENT_SETS`).
|
|
79
79
|
*/
|
|
80
80
|
export declare function getVanillaTrinketTypeRange(): TrinketType[];
|
|
81
|
+
/** Helper function to check to see if the player is holding one or more trinkets. */
|
|
82
|
+
export declare function hasAnyTrinket(player: EntityPlayer): boolean;
|
|
81
83
|
/**
|
|
82
84
|
* Returns whether the player can hold an additional trinket, beyond what they are currently
|
|
83
85
|
* carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trinkets.d.ts","sourceRoot":"","sources":["../../../src/functions/trinkets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAGL,WAAW,EACZ,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"trinkets.d.ts","sourceRoot":"","sources":["../../../src/functions/trinkets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAGL,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAQtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAgCvE;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAE1E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,YAAY,EACpB,UAAU,CAAC,EAAE,GAAG,GACf,qBAAqB,GAAG,SAAS,CAUnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,GAAG,SAAS,CAkBxE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CActE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAOtE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAc/D;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,IAAI,WAAW,EAAE,CAE1D;AAED,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAO3D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAOhE;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAErE;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAErE;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAEtE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAYjE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAiBN;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,GACnB,OAAO,CAOT"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
3
|
+
local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
|
|
1
4
|
local ____exports = {}
|
|
2
5
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
6
|
local PlayerType = ____isaac_2Dtypescript_2Ddefinitions.PlayerType
|
|
4
7
|
local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
|
|
5
8
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
9
|
+
local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
|
|
10
|
+
local TRINKET_SLOT_VALUES = ____cachedEnumValues.TRINKET_SLOT_VALUES
|
|
6
11
|
local ____cachedClasses = require("src.core.cachedClasses")
|
|
7
12
|
local itemConfig = ____cachedClasses.itemConfig
|
|
8
13
|
local ____constants = require("src.core.constants")
|
|
@@ -161,6 +166,17 @@ end
|
|
|
161
166
|
function ____exports.getVanillaTrinketTypeRange(self)
|
|
162
167
|
return iRange(nil, FIRST_TRINKET_TYPE, LAST_VANILLA_TRINKET_TYPE)
|
|
163
168
|
end
|
|
169
|
+
--- Helper function to check to see if the player is holding one or more trinkets.
|
|
170
|
+
function ____exports.hasAnyTrinket(self, player)
|
|
171
|
+
local playerTrinketTypes = __TS__ArrayMap(
|
|
172
|
+
TRINKET_SLOT_VALUES,
|
|
173
|
+
function(____, trinketSlot) return player:GetTrinket(trinketSlot) end
|
|
174
|
+
)
|
|
175
|
+
return __TS__ArrayEvery(
|
|
176
|
+
playerTrinketTypes,
|
|
177
|
+
function(____, trinketType) return trinketType == TrinketType.NULL end
|
|
178
|
+
)
|
|
179
|
+
end
|
|
164
180
|
--- Returns whether the player can hold an additional trinket, beyond what they are currently
|
|
165
181
|
-- carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
|
|
166
182
|
--
|
package/package.json
CHANGED
|
@@ -469,6 +469,10 @@ export function newPlayerHealth(): PlayerHealth {
|
|
|
469
469
|
};
|
|
470
470
|
}
|
|
471
471
|
|
|
472
|
+
/**
|
|
473
|
+
* Helper function to remove all of a player's black hearts and add the corresponding amount of soul
|
|
474
|
+
* hearts.
|
|
475
|
+
*/
|
|
472
476
|
export function playerConvertBlackHeartsToSoulHearts(
|
|
473
477
|
player: EntityPlayer,
|
|
474
478
|
): void {
|
|
@@ -481,6 +485,10 @@ export function playerConvertBlackHeartsToSoulHearts(
|
|
|
481
485
|
setPlayerHealth(player, playerHealth);
|
|
482
486
|
}
|
|
483
487
|
|
|
488
|
+
/**
|
|
489
|
+
* Helper function to remove all of a player's soul hearts and add the corresponding amount of black
|
|
490
|
+
* hearts.
|
|
491
|
+
*/
|
|
484
492
|
export function playerConvertSoulHeartsToBlackHearts(
|
|
485
493
|
player: EntityPlayer,
|
|
486
494
|
): void {
|
package/src/functions/players.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
NullItemID,
|
|
7
7
|
PlayerForm,
|
|
8
8
|
PlayerType,
|
|
9
|
+
TearFlag,
|
|
9
10
|
TrinketType,
|
|
10
11
|
} from "isaac-typescript-definitions";
|
|
11
12
|
import {
|
|
@@ -17,6 +18,7 @@ import { ReadonlySet } from "../types/ReadonlySet";
|
|
|
17
18
|
import { getLastElement, sumArray } from "./array";
|
|
18
19
|
import { getCharacterName, isVanillaCharacter } from "./characters";
|
|
19
20
|
import { getCollectibleMaxCharges } from "./collectibles";
|
|
21
|
+
import { hasFlag } from "./flag";
|
|
20
22
|
import {
|
|
21
23
|
getAllPlayers,
|
|
22
24
|
getPlayerIndexVanilla,
|
|
@@ -579,6 +581,24 @@ export function hasOpenActiveItemSlot(player: EntityPlayer): boolean {
|
|
|
579
581
|
return activeItemPrimary === CollectibleType.NULL;
|
|
580
582
|
}
|
|
581
583
|
|
|
584
|
+
/**
|
|
585
|
+
* Helper function to check if a player has piercing tears.
|
|
586
|
+
*
|
|
587
|
+
* Under the hood, this checks the `EntityPlayer.TearFlags` variable.
|
|
588
|
+
*/
|
|
589
|
+
export function hasPiercing(player: EntityPlayer): boolean {
|
|
590
|
+
return hasFlag(player.TearFlags, TearFlag.PIERCING);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Helper function to check if a player has spectral tears.
|
|
595
|
+
*
|
|
596
|
+
* Under the hood, this checks the `EntityPlayer.TearFlags` variable.
|
|
597
|
+
*/
|
|
598
|
+
export function hasSpectral(player: EntityPlayer): boolean {
|
|
599
|
+
return hasFlag(player.TearFlags, TearFlag.SPECTRAL);
|
|
600
|
+
}
|
|
601
|
+
|
|
582
602
|
/**
|
|
583
603
|
* Helper function to check if the active slot of a particular player is empty.
|
|
584
604
|
*
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
TrinketSlot,
|
|
5
5
|
TrinketType,
|
|
6
6
|
} from "isaac-typescript-definitions";
|
|
7
|
+
import { TRINKET_SLOT_VALUES } from "../arrays/cachedEnumValues";
|
|
7
8
|
import { itemConfig } from "../core/cachedClasses";
|
|
8
9
|
import { BLIND_ITEM_PNG_PATH } from "../core/constants";
|
|
9
10
|
import {
|
|
@@ -196,6 +197,16 @@ export function getVanillaTrinketTypeRange(): TrinketType[] {
|
|
|
196
197
|
return iRange(FIRST_TRINKET_TYPE, LAST_VANILLA_TRINKET_TYPE);
|
|
197
198
|
}
|
|
198
199
|
|
|
200
|
+
/** Helper function to check to see if the player is holding one or more trinkets. */
|
|
201
|
+
export function hasAnyTrinket(player: EntityPlayer): boolean {
|
|
202
|
+
const playerTrinketTypes = TRINKET_SLOT_VALUES.map((trinketSlot) =>
|
|
203
|
+
player.GetTrinket(trinketSlot),
|
|
204
|
+
);
|
|
205
|
+
return playerTrinketTypes.every(
|
|
206
|
+
(trinketType) => trinketType === TrinketType.NULL,
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
|
|
199
210
|
/**
|
|
200
211
|
* Returns whether the player can hold an additional trinket, beyond what they are currently
|
|
201
212
|
* carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
|