isaacscript-common 9.16.1 → 9.18.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/callbacks/subscriptions/postPurchase.d.ts.map +1 -1
- package/dist/callbacks/subscriptions/postPurchase.lua +12 -1
- package/dist/functions/charge.d.ts +2 -0
- package/dist/functions/charge.d.ts.map +1 -1
- package/dist/functions/charge.lua +12 -0
- package/dist/functions/collectibles.d.ts +6 -1
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/collectibles.lua +10 -0
- package/dist/functions/playerHealth.d.ts +8 -0
- package/dist/functions/playerHealth.d.ts.map +1 -1
- package/dist/functions/playerHealth.lua +37 -26
- package/dist/index.d.ts +18 -0
- package/package.json +1 -1
- package/src/callbacks/subscriptions/postPurchase.ts +21 -1
- package/src/functions/charge.ts +19 -1
- package/src/functions/collectibles.ts +16 -0
- package/src/functions/playerHealth.ts +15 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postPurchase.d.ts","sourceRoot":"","sources":["../../../src/callbacks/subscriptions/postPurchase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,oBAAY,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI;IAC9D,aAAa,CAAC,EAAE,aAAa;IAC7B,aAAa,CAAC,EAAE,GAAG;CACpB,CAAC;AAIF,wBAAgB,4BAA4B,IAAI,OAAO,CAEtD;AAED,wBAAgB,oBAAoB,CAClC,GAAG,IAAI,EAAE,8BAA8B,GACtC,IAAI,CAEN;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,YAAY,GACnB,IAAI,
|
|
1
|
+
{"version":3,"file":"postPurchase.d.ts","sourceRoot":"","sources":["../../../src/callbacks/subscriptions/postPurchase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,oBAAY,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI;IAC9D,aAAa,CAAC,EAAE,aAAa;IAC7B,aAAa,CAAC,EAAE,GAAG;CACpB,CAAC;AAIF,wBAAgB,4BAA4B,IAAI,OAAO,CAEtD;AAED,wBAAgB,oBAAoB,CAClC,GAAG,IAAI,EAAE,8BAA8B,GACtC,IAAI,CAEN;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,YAAY,GACnB,IAAI,CAwBN"}
|
|
@@ -10,7 +10,18 @@ end
|
|
|
10
10
|
function ____exports.postPurchaseFire(self, player, pickup)
|
|
11
11
|
for ____, ____value in ipairs(subscriptions) do
|
|
12
12
|
local callback = ____value[1]
|
|
13
|
-
|
|
13
|
+
local callbackPickupVariant = ____value[2]
|
|
14
|
+
local callbackPickupSubType = ____value[3]
|
|
15
|
+
do
|
|
16
|
+
if callbackPickupVariant ~= nil and callbackPickupVariant ~= pickup.Variant then
|
|
17
|
+
goto __continue5
|
|
18
|
+
end
|
|
19
|
+
if callbackPickupSubType ~= nil and callbackPickupSubType ~= pickup.SubType then
|
|
20
|
+
goto __continue5
|
|
21
|
+
end
|
|
22
|
+
callback(nil, player, pickup)
|
|
23
|
+
end
|
|
24
|
+
::__continue5::
|
|
14
25
|
end
|
|
15
26
|
end
|
|
16
27
|
return ____exports
|
|
@@ -27,6 +27,7 @@ export declare function addCharge(player: EntityPlayer, activeSlot: ActiveSlot,
|
|
|
27
27
|
* - 2x2 rooms and L rooms granting a double charge
|
|
28
28
|
* - The Battery
|
|
29
29
|
* - AAA Battery
|
|
30
|
+
* - Not charging active items with `chargetype="special"`
|
|
30
31
|
*
|
|
31
32
|
* @param player The player to grant the charges to.
|
|
32
33
|
* @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1
|
|
@@ -43,6 +44,7 @@ export declare function addRoomClearCharge(player: EntityPlayer, bigRoomDoubleCh
|
|
|
43
44
|
* - L rooms and 2x2 rooms granting a double charge
|
|
44
45
|
* - The Battery
|
|
45
46
|
* - AAA Battery
|
|
47
|
+
* - Not charging active items with `chargetype="special"`
|
|
46
48
|
*
|
|
47
49
|
* @param player The player to grant the charges to.
|
|
48
50
|
* @param activeSlot The active item slot to grant the charges to.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charge.d.ts","sourceRoot":"","sources":["../../src/functions/charge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,
|
|
1
|
+
{"version":3,"file":"charge.d.ts","sourceRoot":"","sources":["../../src/functions/charge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAKX,MAAM,8BAA8B,CAAC;AAStC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,UAAU,SAAI,EACd,eAAe,UAAO,GACrB,GAAG,CA2BL;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,YAAY,EACpB,mBAAmB,UAAO,EAC1B,eAAe,UAAO,GACrB,IAAI,CAaN;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,mBAAmB,UAAO,EAC1B,eAAe,UAAO,GACrB,IAAI,CAkBN;AAuED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,mBAAmB,UAAO,GAAG,IAAI,CAIpE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAKL;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,OAAO,CAMT;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,IAAI,CAYN"}
|
|
@@ -3,12 +3,14 @@ local getClampedChargesToAdd, getChargesToAddWithAAAModifier, shouldPlayFullRech
|
|
|
3
3
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
4
4
|
local ActiveSlot = ____isaac_2Dtypescript_2Ddefinitions.ActiveSlot
|
|
5
5
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
6
|
+
local ItemConfigChargeType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigChargeType
|
|
6
7
|
local SoundEffect = ____isaac_2Dtypescript_2Ddefinitions.SoundEffect
|
|
7
8
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
8
9
|
local ____cachedClasses = require("core.cachedClasses")
|
|
9
10
|
local game = ____cachedClasses.game
|
|
10
11
|
local sfxManager = ____cachedClasses.sfxManager
|
|
11
12
|
local ____collectibles = require("functions.collectibles")
|
|
13
|
+
local getCollectibleChargeType = ____collectibles.getCollectibleChargeType
|
|
12
14
|
local getCollectibleMaxCharges = ____collectibles.getCollectibleMaxCharges
|
|
13
15
|
local ____playerIndex = require("functions.playerIndex")
|
|
14
16
|
local getPlayers = ____playerIndex.getPlayers
|
|
@@ -60,6 +62,7 @@ end
|
|
|
60
62
|
-- - L rooms and 2x2 rooms granting a double charge
|
|
61
63
|
-- - The Battery
|
|
62
64
|
-- - AAA Battery
|
|
65
|
+
-- - Not charging active items with `chargetype="special"`
|
|
63
66
|
--
|
|
64
67
|
-- @param player The player to grant the charges to.
|
|
65
68
|
-- @param activeSlot The active item slot to grant the charges to.
|
|
@@ -74,6 +77,14 @@ function ____exports.addRoomClearChargeToSlot(self, player, activeSlot, bigRoomD
|
|
|
74
77
|
if playSoundEffect == nil then
|
|
75
78
|
playSoundEffect = true
|
|
76
79
|
end
|
|
80
|
+
local activeItem = player:GetActiveItem(activeSlot)
|
|
81
|
+
if activeItem == CollectibleType.NULL then
|
|
82
|
+
return
|
|
83
|
+
end
|
|
84
|
+
local chargeType = getCollectibleChargeType(nil, activeItem)
|
|
85
|
+
if chargeType == ItemConfigChargeType.SPECIAL then
|
|
86
|
+
return
|
|
87
|
+
end
|
|
77
88
|
local room = game:GetRoom()
|
|
78
89
|
local roomShape = room:GetRoomShape()
|
|
79
90
|
local numCharges = bigRoomDoubleCharge and getRoomShapeCharges(nil, roomShape) or 1
|
|
@@ -156,6 +167,7 @@ end
|
|
|
156
167
|
-- - 2x2 rooms and L rooms granting a double charge
|
|
157
168
|
-- - The Battery
|
|
158
169
|
-- - AAA Battery
|
|
170
|
+
-- - Not charging active items with `chargetype="special"`
|
|
159
171
|
--
|
|
160
172
|
-- @param player The player to grant the charges to.
|
|
161
173
|
-- @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { CollectiblePedestalType, CollectibleType, ItemConfigTag, ItemType, PickupPrice } from "isaac-typescript-definitions";
|
|
1
|
+
import { CollectiblePedestalType, CollectibleType, ItemConfigChargeType, ItemConfigTag, ItemType, PickupPrice } from "isaac-typescript-definitions";
|
|
2
2
|
import { CollectibleIndex } from "../types/CollectibleIndex";
|
|
3
3
|
export declare function clearCollectibleSprite(collectible: EntityPickup): void;
|
|
4
4
|
/** Helper function to check if two collectible sprites have the same sprite sheet loaded. */
|
|
5
5
|
export declare function collectibleSpriteEquals(sprite1: Sprite, sprite2: Sprite): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to get the charge type that a collectible has. Returns
|
|
8
|
+
* `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCollectibleChargeType(collectibleType: CollectibleType): ItemConfigChargeType;
|
|
6
11
|
/**
|
|
7
12
|
* Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
8
13
|
* provided collectible type was not valid.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectibles.d.ts","sourceRoot":"","sources":["../../src/functions/collectibles.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,eAAe,EAEf,aAAa,EAEb,QAAQ,EACR,WAAW,EAGZ,MAAM,8BAA8B,CAAC;AAgBtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AA0B7D,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAEtE;AAED,6FAA6F;AAC7F,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAsBT;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,eAAe,GAC/B,MAAM,CAeR;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,eAAe,EAAE,eAAe,GAC/B,GAAG,CAYL;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,YAAY,GACnB,WAAW,CAyBb;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,eAAe,GAC/B,MAAM,CAOR;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,YAAY,GACxB,gBAAgB,CAsBlB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,eAAe,GAC/B,GAAG,CAOL;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,eAAe,GAC/B,QAAQ,CAOV;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,eAAe,GAC/B,GAAG,CAOL;AAED;;;;;GAKG;AACH,wBAAgB,kBA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, COLLECTIBLE_SPRITE_LAYER, COLLECTIBLE_SHADOW_LAYER
|
|
|
3
3
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
4
4
|
local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
|
|
5
5
|
local EntityType = ____isaac_2Dtypescript_2Ddefinitions.EntityType
|
|
6
|
+
local ItemConfigChargeType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigChargeType
|
|
6
7
|
local ItemConfigTagZero = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTagZero
|
|
7
8
|
local ItemType = ____isaac_2Dtypescript_2Ddefinitions.ItemType
|
|
8
9
|
local PickupPrice = ____isaac_2Dtypescript_2Ddefinitions.PickupPrice
|
|
@@ -131,6 +132,15 @@ function ____exports.collectibleSpriteEquals(self, sprite1, sprite2)
|
|
|
131
132
|
yIncrement
|
|
132
133
|
)
|
|
133
134
|
end
|
|
135
|
+
--- Helper function to get the charge type that a collectible has. Returns
|
|
136
|
+
-- `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
|
|
137
|
+
function ____exports.getCollectibleChargeType(self, collectibleType)
|
|
138
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
139
|
+
if itemConfigItem == nil then
|
|
140
|
+
return ItemConfigChargeType.NORMAL
|
|
141
|
+
end
|
|
142
|
+
return itemConfigItem.ChargeType
|
|
143
|
+
end
|
|
134
144
|
--- Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
135
145
|
-- provided collectible type was not valid.
|
|
136
146
|
function ____exports.getCollectibleDescription(self, collectibleType)
|
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
import { HealthType } from "../enums/HealthType";
|
|
4
4
|
import { PlayerHealth } from "../interfaces/PlayerHealth";
|
|
5
5
|
export declare function addPlayerHealthType(player: EntityPlayer, healthType: HealthType, numHearts: int): void;
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to see if the provided player can pick up an eternal heart. (If a player already
|
|
8
|
+
* has an eternal heart and full heart containers, they are not able to pick up any additional
|
|
9
|
+
* eternal hearts.)
|
|
10
|
+
*
|
|
11
|
+
* This function's name matches the existing `EntityPlayer` methods.
|
|
12
|
+
*/
|
|
13
|
+
export declare function canPickEternalHearts(player: EntityPlayer): boolean;
|
|
6
14
|
/**
|
|
7
15
|
* Returns whether or not all of the player's soul-heart-type hearts are black hearts.
|
|
8
16
|
*
|
|
@@ -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,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAQzE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,GACb,IAAI,CA+CN;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,CAsHN;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,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAQzE,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;AAC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AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,YAAY,GACzB,IAAI,CAsHN;AAED;;;;;;;;;GASG;AACH,wBAAgB,sDAAsD,CACpE,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,KAAK,GAClB,OAAO,CAyBT"}
|
|
@@ -135,25 +135,25 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
|
|
|
135
135
|
addAmount = 1
|
|
136
136
|
end
|
|
137
137
|
repeat
|
|
138
|
-
local
|
|
139
|
-
local
|
|
140
|
-
if
|
|
138
|
+
local ____switch72 = soulHeartType
|
|
139
|
+
local ____cond72 = ____switch72 == HeartSubType.SOUL
|
|
140
|
+
if ____cond72 then
|
|
141
141
|
do
|
|
142
142
|
player:AddSoulHearts(addAmount)
|
|
143
143
|
soulHeartsRemaining = soulHeartsRemaining - addAmount
|
|
144
144
|
break
|
|
145
145
|
end
|
|
146
146
|
end
|
|
147
|
-
|
|
148
|
-
if
|
|
147
|
+
____cond72 = ____cond72 or ____switch72 == HeartSubType.BLACK
|
|
148
|
+
if ____cond72 then
|
|
149
149
|
do
|
|
150
150
|
player:AddBlackHearts(addAmount)
|
|
151
151
|
soulHeartsRemaining = soulHeartsRemaining - addAmount
|
|
152
152
|
break
|
|
153
153
|
end
|
|
154
154
|
end
|
|
155
|
-
|
|
156
|
-
if
|
|
155
|
+
____cond72 = ____cond72 or ____switch72 == HeartSubType.BONE
|
|
156
|
+
if ____cond72 then
|
|
157
157
|
do
|
|
158
158
|
player:AddBoneHearts(addAmount)
|
|
159
159
|
break
|
|
@@ -271,6 +271,17 @@ function ____exports.addPlayerHealthType(self, player, healthType, numHearts)
|
|
|
271
271
|
end
|
|
272
272
|
until true
|
|
273
273
|
end
|
|
274
|
+
--- Helper function to see if the provided player can pick up an eternal heart. (If a player already
|
|
275
|
+
-- has an eternal heart and full heart containers, they are not able to pick up any additional
|
|
276
|
+
-- eternal hearts.)
|
|
277
|
+
--
|
|
278
|
+
-- This function's name matches the existing `EntityPlayer` methods.
|
|
279
|
+
function ____exports.canPickEternalHearts(self, player)
|
|
280
|
+
local eternalHearts = player:GetEternalHearts()
|
|
281
|
+
local maxHearts = player:GetMaxHearts()
|
|
282
|
+
local heartLimit = player:GetHeartLimit()
|
|
283
|
+
return eternalHearts == 0 or maxHearts ~= heartLimit
|
|
284
|
+
end
|
|
274
285
|
--- Returns whether or not all of the player's soul-heart-type hearts are black hearts.
|
|
275
286
|
--
|
|
276
287
|
-- Note that this function does not consider red heart containers.
|
|
@@ -385,57 +396,57 @@ function ____exports.getPlayerHealth(self, player)
|
|
|
385
396
|
end
|
|
386
397
|
function ____exports.getPlayerHealthType(self, player, healthType)
|
|
387
398
|
repeat
|
|
388
|
-
local
|
|
389
|
-
local
|
|
390
|
-
if
|
|
399
|
+
local ____switch29 = healthType
|
|
400
|
+
local ____cond29 = ____switch29 == HealthType.RED
|
|
401
|
+
if ____cond29 then
|
|
391
402
|
do
|
|
392
403
|
return ____exports.getPlayerHearts(nil, player)
|
|
393
404
|
end
|
|
394
405
|
end
|
|
395
|
-
|
|
396
|
-
if
|
|
406
|
+
____cond29 = ____cond29 or ____switch29 == HealthType.SOUL
|
|
407
|
+
if ____cond29 then
|
|
397
408
|
do
|
|
398
409
|
return ____exports.getPlayerSoulHearts(nil, player)
|
|
399
410
|
end
|
|
400
411
|
end
|
|
401
|
-
|
|
402
|
-
if
|
|
412
|
+
____cond29 = ____cond29 or ____switch29 == HealthType.ETERNAL
|
|
413
|
+
if ____cond29 then
|
|
403
414
|
do
|
|
404
415
|
return player:GetEternalHearts()
|
|
405
416
|
end
|
|
406
417
|
end
|
|
407
|
-
|
|
408
|
-
if
|
|
418
|
+
____cond29 = ____cond29 or ____switch29 == HealthType.BLACK
|
|
419
|
+
if ____cond29 then
|
|
409
420
|
do
|
|
410
421
|
return ____exports.getPlayerBlackHearts(nil, player)
|
|
411
422
|
end
|
|
412
423
|
end
|
|
413
|
-
|
|
414
|
-
if
|
|
424
|
+
____cond29 = ____cond29 or ____switch29 == HealthType.GOLDEN
|
|
425
|
+
if ____cond29 then
|
|
415
426
|
do
|
|
416
427
|
return player:GetGoldenHearts()
|
|
417
428
|
end
|
|
418
429
|
end
|
|
419
|
-
|
|
420
|
-
if
|
|
430
|
+
____cond29 = ____cond29 or ____switch29 == HealthType.BONE
|
|
431
|
+
if ____cond29 then
|
|
421
432
|
do
|
|
422
433
|
return player:GetBoneHearts()
|
|
423
434
|
end
|
|
424
435
|
end
|
|
425
|
-
|
|
426
|
-
if
|
|
436
|
+
____cond29 = ____cond29 or ____switch29 == HealthType.ROTTEN
|
|
437
|
+
if ____cond29 then
|
|
427
438
|
do
|
|
428
439
|
return player:GetRottenHearts()
|
|
429
440
|
end
|
|
430
441
|
end
|
|
431
|
-
|
|
432
|
-
if
|
|
442
|
+
____cond29 = ____cond29 or ____switch29 == HealthType.BROKEN
|
|
443
|
+
if ____cond29 then
|
|
433
444
|
do
|
|
434
445
|
return player:GetBrokenHearts()
|
|
435
446
|
end
|
|
436
447
|
end
|
|
437
|
-
|
|
438
|
-
if
|
|
448
|
+
____cond29 = ____cond29 or ____switch29 == HealthType.MAX_HEARTS
|
|
449
|
+
if ____cond29 then
|
|
439
450
|
do
|
|
440
451
|
return player:GetMaxHearts()
|
|
441
452
|
end
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ import { GridEntityType } from 'isaac-typescript-definitions';
|
|
|
35
35
|
import { GridEntityXMLType } from 'isaac-typescript-definitions';
|
|
36
36
|
import { HeartSubType } from 'isaac-typescript-definitions';
|
|
37
37
|
import { ItemConfigCardType } from 'isaac-typescript-definitions';
|
|
38
|
+
import { ItemConfigChargeType } from 'isaac-typescript-definitions';
|
|
38
39
|
import { ItemConfigPillEffectClass } from 'isaac-typescript-definitions';
|
|
39
40
|
import { ItemConfigPillEffectType } from 'isaac-typescript-definitions';
|
|
40
41
|
import { ItemConfigTag } from 'isaac-typescript-definitions';
|
|
@@ -245,6 +246,7 @@ export declare function addPlayerHealthType(player: EntityPlayer, healthType: He
|
|
|
245
246
|
* - 2x2 rooms and L rooms granting a double charge
|
|
246
247
|
* - The Battery
|
|
247
248
|
* - AAA Battery
|
|
249
|
+
* - Not charging active items with `chargetype="special"`
|
|
248
250
|
*
|
|
249
251
|
* @param player The player to grant the charges to.
|
|
250
252
|
* @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1
|
|
@@ -277,6 +279,7 @@ export declare function addRoomClearCharges(bigRoomDoubleCharge?: boolean): void
|
|
|
277
279
|
* - L rooms and 2x2 rooms granting a double charge
|
|
278
280
|
* - The Battery
|
|
279
281
|
* - AAA Battery
|
|
282
|
+
* - Not charging active items with `chargetype="special"`
|
|
280
283
|
*
|
|
281
284
|
* @param player The player to grant the charges to.
|
|
282
285
|
* @param activeSlot The active item slot to grant the charges to.
|
|
@@ -607,6 +610,15 @@ export declare function calculateStageType(stage: LevelStage): StageType;
|
|
|
607
610
|
*/
|
|
608
611
|
export declare function calculateStageTypeRepentance(stage: LevelStage): StageType;
|
|
609
612
|
|
|
613
|
+
/**
|
|
614
|
+
* Helper function to see if the provided player can pick up an eternal heart. (If a player already
|
|
615
|
+
* has an eternal heart and full heart containers, they are not able to pick up any additional
|
|
616
|
+
* eternal hearts.)
|
|
617
|
+
*
|
|
618
|
+
* This function's name matches the existing `EntityPlayer` methods.
|
|
619
|
+
*/
|
|
620
|
+
export declare function canPickEternalHearts(player: EntityPlayer): boolean;
|
|
621
|
+
|
|
610
622
|
/**
|
|
611
623
|
* Helper function to determine if a player will destroy a rock/pot/skull if they walk over it.
|
|
612
624
|
*
|
|
@@ -2613,6 +2625,12 @@ export declare function getCoinValue(coinSubType: CoinSubType): int;
|
|
|
2613
2625
|
*/
|
|
2614
2626
|
export declare function getCollectibleArray(): readonly CollectibleType[];
|
|
2615
2627
|
|
|
2628
|
+
/**
|
|
2629
|
+
* Helper function to get the charge type that a collectible has. Returns
|
|
2630
|
+
* `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
|
|
2631
|
+
*/
|
|
2632
|
+
export declare function getCollectibleChargeType(collectibleType: CollectibleType): ItemConfigChargeType;
|
|
2633
|
+
|
|
2616
2634
|
/**
|
|
2617
2635
|
* Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
2618
2636
|
* provided collectible type was not valid.
|
package/package.json
CHANGED
|
@@ -22,7 +22,27 @@ export function postPurchaseFire(
|
|
|
22
22
|
player: EntityPlayer,
|
|
23
23
|
pickup: EntityPickup,
|
|
24
24
|
): void {
|
|
25
|
-
for (const [
|
|
25
|
+
for (const [
|
|
26
|
+
callback,
|
|
27
|
+
callbackPickupVariant,
|
|
28
|
+
callbackPickupSubType,
|
|
29
|
+
] of subscriptions) {
|
|
30
|
+
// Handle the optional 2nd callback argument.
|
|
31
|
+
if (
|
|
32
|
+
callbackPickupVariant !== undefined &&
|
|
33
|
+
callbackPickupVariant !== pickup.Variant
|
|
34
|
+
) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Handle the optional 3rd callback argument.
|
|
39
|
+
if (
|
|
40
|
+
callbackPickupSubType !== undefined &&
|
|
41
|
+
callbackPickupSubType !== pickup.SubType
|
|
42
|
+
) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
|
|
26
46
|
callback(player, pickup);
|
|
27
47
|
}
|
|
28
48
|
}
|
package/src/functions/charge.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActiveSlot,
|
|
3
3
|
CollectibleType,
|
|
4
|
+
ItemConfigChargeType,
|
|
4
5
|
SoundEffect,
|
|
5
6
|
TrinketType,
|
|
6
7
|
} from "isaac-typescript-definitions";
|
|
7
8
|
import { game, sfxManager } from "../core/cachedClasses";
|
|
8
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getCollectibleChargeType,
|
|
11
|
+
getCollectibleMaxCharges,
|
|
12
|
+
} from "./collectibles";
|
|
9
13
|
import { getPlayers } from "./playerIndex";
|
|
10
14
|
import { getRoomShapeCharges } from "./roomShape";
|
|
11
15
|
|
|
@@ -70,6 +74,7 @@ export function addCharge(
|
|
|
70
74
|
* - 2x2 rooms and L rooms granting a double charge
|
|
71
75
|
* - The Battery
|
|
72
76
|
* - AAA Battery
|
|
77
|
+
* - Not charging active items with `chargetype="special"`
|
|
73
78
|
*
|
|
74
79
|
* @param player The player to grant the charges to.
|
|
75
80
|
* @param bigRoomDoubleCharge Optional. If set to false, it will treat the current room as a 1x1
|
|
@@ -104,6 +109,7 @@ export function addRoomClearCharge(
|
|
|
104
109
|
* - L rooms and 2x2 rooms granting a double charge
|
|
105
110
|
* - The Battery
|
|
106
111
|
* - AAA Battery
|
|
112
|
+
* - Not charging active items with `chargetype="special"`
|
|
107
113
|
*
|
|
108
114
|
* @param player The player to grant the charges to.
|
|
109
115
|
* @param activeSlot The active item slot to grant the charges to.
|
|
@@ -118,6 +124,18 @@ export function addRoomClearChargeToSlot(
|
|
|
118
124
|
bigRoomDoubleCharge = true,
|
|
119
125
|
playSoundEffect = true,
|
|
120
126
|
): void {
|
|
127
|
+
const activeItem = player.GetActiveItem(activeSlot);
|
|
128
|
+
if (activeItem === CollectibleType.NULL) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Certain collectibles have special charge mechanisms and are not charged upon a room being
|
|
133
|
+
// cleared.
|
|
134
|
+
const chargeType = getCollectibleChargeType(activeItem);
|
|
135
|
+
if (chargeType === ItemConfigChargeType.SPECIAL) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
121
139
|
const room = game.GetRoom();
|
|
122
140
|
const roomShape = room.GetRoomShape();
|
|
123
141
|
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
CollectiblePedestalType,
|
|
3
3
|
CollectibleType,
|
|
4
4
|
EntityType,
|
|
5
|
+
ItemConfigChargeType,
|
|
5
6
|
ItemConfigTag,
|
|
6
7
|
ItemConfigTagZero,
|
|
7
8
|
ItemType,
|
|
@@ -82,6 +83,21 @@ export function collectibleSpriteEquals(
|
|
|
82
83
|
);
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Helper function to get the charge type that a collectible has. Returns
|
|
88
|
+
* `ItemConfigChargeType.NORMAL` if the provided collectible type was not valid.
|
|
89
|
+
*/
|
|
90
|
+
export function getCollectibleChargeType(
|
|
91
|
+
collectibleType: CollectibleType,
|
|
92
|
+
): ItemConfigChargeType {
|
|
93
|
+
const itemConfigItem = itemConfig.GetCollectible(collectibleType);
|
|
94
|
+
if (itemConfigItem === undefined) {
|
|
95
|
+
return ItemConfigChargeType.NORMAL;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return itemConfigItem.ChargeType;
|
|
99
|
+
}
|
|
100
|
+
|
|
85
101
|
/**
|
|
86
102
|
* Helper function to get the in-game description for a collectible. Returns "Unknown" if the
|
|
87
103
|
* provided collectible type was not valid.
|
|
@@ -68,6 +68,21 @@ export function addPlayerHealthType(
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Helper function to see if the provided player can pick up an eternal heart. (If a player already
|
|
73
|
+
* has an eternal heart and full heart containers, they are not able to pick up any additional
|
|
74
|
+
* eternal hearts.)
|
|
75
|
+
*
|
|
76
|
+
* This function's name matches the existing `EntityPlayer` methods.
|
|
77
|
+
*/
|
|
78
|
+
export function canPickEternalHearts(player: EntityPlayer): boolean {
|
|
79
|
+
const eternalHearts = player.GetEternalHearts();
|
|
80
|
+
const maxHearts = player.GetMaxHearts();
|
|
81
|
+
const heartLimit = player.GetHeartLimit();
|
|
82
|
+
|
|
83
|
+
return eternalHearts === 0 || maxHearts !== heartLimit;
|
|
84
|
+
}
|
|
85
|
+
|
|
71
86
|
/**
|
|
72
87
|
* Returns whether or not all of the player's soul-heart-type hearts are black hearts.
|
|
73
88
|
*
|