isaacscript-common 1.2.281 → 1.2.284
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/enums/ItemConfigTag.d.ts +278 -0
- package/dist/enums/ItemConfigTag.lua +70 -0
- package/dist/features/characterHealthConversion.d.ts +10 -0
- package/dist/features/characterHealthConversion.lua +81 -0
- package/dist/functions/collectibleTag.d.ts +17 -0
- package/dist/functions/collectibleTag.lua +74 -0
- package/dist/functions/collectibles.d.ts +11 -2
- package/dist/functions/collectibles.lua +4 -10
- package/dist/functions/player.d.ts +7 -0
- package/dist/functions/player.lua +17 -9
- package/dist/functions/spawnCollectible.lua +2 -1
- package/dist/functions/transformations.d.ts +12 -2
- package/dist/functions/transformations.lua +47 -76
- package/dist/index.d.ts +4 -1
- package/dist/index.lua +24 -6
- package/dist/upgradeMod.lua +3 -0
- package/package.json +2 -2
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Matches the ItemConfig.TAG_* members of the ItemConfig class.
|
|
3
|
+
*
|
|
4
|
+
* In IsaacScript, we re-implement this as an enum, since it is cleaner.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ItemConfigTag {
|
|
7
|
+
/**
|
|
8
|
+
* Dead things (for the Parasite unlock).
|
|
9
|
+
*
|
|
10
|
+
* Equal to "dead" in "items_metadata.xml".
|
|
11
|
+
*
|
|
12
|
+
* 1 << 0
|
|
13
|
+
*/
|
|
14
|
+
DEAD = 1,
|
|
15
|
+
/**
|
|
16
|
+
* Syringes (for Little Baggy and the Spun! transformation).
|
|
17
|
+
*
|
|
18
|
+
* Equal to "syringe" in "items_metadata.xml".
|
|
19
|
+
* 1 << 1
|
|
20
|
+
*/
|
|
21
|
+
SYRINGE = 2,
|
|
22
|
+
/**
|
|
23
|
+
* Mom's things (for Mom's Contact and the Yes Mother? transformation).
|
|
24
|
+
*
|
|
25
|
+
* Equal to "mom" in "items_metadata.xml".
|
|
26
|
+
*
|
|
27
|
+
* 1 << 2
|
|
28
|
+
*/
|
|
29
|
+
MOM = 4,
|
|
30
|
+
/**
|
|
31
|
+
* Technology items (for the Technology Zero unlock).
|
|
32
|
+
*
|
|
33
|
+
* Equal to "tech" in "items_metadata.xml".
|
|
34
|
+
*
|
|
35
|
+
* 1 << 3
|
|
36
|
+
*/
|
|
37
|
+
TECH = 8,
|
|
38
|
+
/**
|
|
39
|
+
* Battery items (for the Jumper Cables unlock).
|
|
40
|
+
*
|
|
41
|
+
* Equal to "battery" in "items_metadata.xml".
|
|
42
|
+
*
|
|
43
|
+
* 1 << 4
|
|
44
|
+
*/
|
|
45
|
+
BATTERY = 16,
|
|
46
|
+
/**
|
|
47
|
+
* Guppy items (Guppy transformation).
|
|
48
|
+
*
|
|
49
|
+
* Equal to "guppy" in "items_metadata.xml".
|
|
50
|
+
*
|
|
51
|
+
* 1 << 5
|
|
52
|
+
*/
|
|
53
|
+
GUPPY = 32,
|
|
54
|
+
/**
|
|
55
|
+
* Fly items (Beelzebub transformation).
|
|
56
|
+
*
|
|
57
|
+
* Equal to "fly" in "items_metadata.xml".
|
|
58
|
+
*
|
|
59
|
+
* 1 << 6
|
|
60
|
+
*/
|
|
61
|
+
FLY = 64,
|
|
62
|
+
/**
|
|
63
|
+
* Bob items (Bob transformation).
|
|
64
|
+
*
|
|
65
|
+
* Equal to "bob" in "items_metadata.xml".
|
|
66
|
+
*
|
|
67
|
+
* 1 << 7
|
|
68
|
+
*/
|
|
69
|
+
BOB = 128,
|
|
70
|
+
/**
|
|
71
|
+
* Mushroom items (Fun Guy transformation).
|
|
72
|
+
*
|
|
73
|
+
* Equal to "mushroom" in "items_metadata.xml".
|
|
74
|
+
*
|
|
75
|
+
* 1 << 8
|
|
76
|
+
*/
|
|
77
|
+
MUSHROOM = 256,
|
|
78
|
+
/**
|
|
79
|
+
* Baby items (Conjoined transformation).
|
|
80
|
+
*
|
|
81
|
+
* Equal to "mushroom" in "items_metadata.xml".
|
|
82
|
+
*
|
|
83
|
+
* 1 << 9
|
|
84
|
+
*/
|
|
85
|
+
BABY = 512,
|
|
86
|
+
/**
|
|
87
|
+
* Angel items (Seraphim transformation).
|
|
88
|
+
*
|
|
89
|
+
* Equal to "angel" in "items_metadata.xml".
|
|
90
|
+
*
|
|
91
|
+
* 1 << 10
|
|
92
|
+
*/
|
|
93
|
+
ANGEL = 1024,
|
|
94
|
+
/**
|
|
95
|
+
* Devil items (Leviathan transformation).
|
|
96
|
+
*
|
|
97
|
+
* Equal to "devil" in "items_metadata.xml".
|
|
98
|
+
*
|
|
99
|
+
* 1 << 11
|
|
100
|
+
*/
|
|
101
|
+
DEVIL = 2048,
|
|
102
|
+
/**
|
|
103
|
+
* Poop items (Oh Shit transformation).
|
|
104
|
+
*
|
|
105
|
+
* Equal to "poop" in "items_metadata.xml".
|
|
106
|
+
*
|
|
107
|
+
* 1 << 12
|
|
108
|
+
*/
|
|
109
|
+
POOP = 4096,
|
|
110
|
+
/**
|
|
111
|
+
* Book items (Book Worm transformation).
|
|
112
|
+
*
|
|
113
|
+
* Equal to "book" in "items_metadata.xml".
|
|
114
|
+
*
|
|
115
|
+
* 1 << 13
|
|
116
|
+
*/
|
|
117
|
+
BOOK = 8192,
|
|
118
|
+
/**
|
|
119
|
+
* Spider items (Spider Baby transformation).
|
|
120
|
+
*
|
|
121
|
+
* Equal to "spider" in "items_metadata.xml".
|
|
122
|
+
*
|
|
123
|
+
* 1 << 14
|
|
124
|
+
*/
|
|
125
|
+
SPIDER = 16384,
|
|
126
|
+
/**
|
|
127
|
+
* Quest item (cannot be rerolled or randomly obtained).
|
|
128
|
+
*
|
|
129
|
+
* Equal to "quest" in "items_metadata.xml".
|
|
130
|
+
*
|
|
131
|
+
* 1 << 15
|
|
132
|
+
*/
|
|
133
|
+
QUEST = 32768,
|
|
134
|
+
/**
|
|
135
|
+
* Can be spawned by Monster Manual.
|
|
136
|
+
*
|
|
137
|
+
* Equal to "monstermanual" in "items_metadata.xml".
|
|
138
|
+
*
|
|
139
|
+
* 1 << 16
|
|
140
|
+
*/
|
|
141
|
+
MONSTER_MANUAL = 65536,
|
|
142
|
+
/**
|
|
143
|
+
* Cannot appear in Greed Mode.
|
|
144
|
+
*
|
|
145
|
+
* Equal to "nogreed" in "items_metadata.xml".
|
|
146
|
+
*
|
|
147
|
+
* 1 << 17
|
|
148
|
+
*/
|
|
149
|
+
NO_GREED = 131072,
|
|
150
|
+
/**
|
|
151
|
+
* Food item (for Binge Eater).
|
|
152
|
+
*
|
|
153
|
+
* Equal to "food" in "items_metadata.xml".
|
|
154
|
+
*
|
|
155
|
+
* 1 << 18
|
|
156
|
+
*/
|
|
157
|
+
FOOD = 262144,
|
|
158
|
+
/**
|
|
159
|
+
* Tears up item (for Lachryphagy unlock detection).
|
|
160
|
+
*
|
|
161
|
+
* Equal to "tearsup" in "items_metadata.xml".
|
|
162
|
+
*
|
|
163
|
+
* 1 << 19
|
|
164
|
+
*/
|
|
165
|
+
TEARS_UP = 524288,
|
|
166
|
+
/**
|
|
167
|
+
* Whitelisted item for Tainted Lost.
|
|
168
|
+
*
|
|
169
|
+
* Equal to "offensive" in "items_metadata.xml".
|
|
170
|
+
*
|
|
171
|
+
* 1 << 20
|
|
172
|
+
*/
|
|
173
|
+
OFFENSIVE = 1048576,
|
|
174
|
+
/**
|
|
175
|
+
* Blacklisted item for Keeper & Tainted Keeper.
|
|
176
|
+
*
|
|
177
|
+
* Equal to "nokeeper" in "items_metadata.xml".
|
|
178
|
+
*
|
|
179
|
+
* 1 << 21
|
|
180
|
+
*/
|
|
181
|
+
NO_KEEPER = 2097152,
|
|
182
|
+
/**
|
|
183
|
+
* Blacklisted item for The Lost's Birthright.
|
|
184
|
+
*
|
|
185
|
+
* Equal to "nolostbr" in "items_metadata.xml".
|
|
186
|
+
*
|
|
187
|
+
* 1 << 22
|
|
188
|
+
*/
|
|
189
|
+
NO_LOST_BR = 4194304,
|
|
190
|
+
/**
|
|
191
|
+
* Star themed items (for the Planetarium unlock).
|
|
192
|
+
*
|
|
193
|
+
* Equal to "stars" in "items_metadata.xml".
|
|
194
|
+
*
|
|
195
|
+
* 1 << 23
|
|
196
|
+
*/
|
|
197
|
+
STARS = 8388608,
|
|
198
|
+
/**
|
|
199
|
+
* Summonable items (for Tainted Bethany).
|
|
200
|
+
*
|
|
201
|
+
* Equal to "summonable" in "items_metadata.xml".
|
|
202
|
+
*
|
|
203
|
+
* 1 << 24
|
|
204
|
+
*/
|
|
205
|
+
SUMMONABLE = 16777216,
|
|
206
|
+
/**
|
|
207
|
+
* Can't be obtained in Cantripped challenge.
|
|
208
|
+
*
|
|
209
|
+
* Equal to "nocantrip" in "items_metadata.xml".
|
|
210
|
+
*
|
|
211
|
+
* 1 << 25
|
|
212
|
+
*/
|
|
213
|
+
NO_CANTRIP = 33554432,
|
|
214
|
+
/**
|
|
215
|
+
* Active items that have wisps attached to them (automatically set).
|
|
216
|
+
*
|
|
217
|
+
* Not equal to any particular tag in "items_metadata.xml". Instead, this is set for all of the
|
|
218
|
+
* items in the "wisps.xml" file.
|
|
219
|
+
*
|
|
220
|
+
* 1 << 26
|
|
221
|
+
*/
|
|
222
|
+
WISP = 67108864,
|
|
223
|
+
/**
|
|
224
|
+
* Unique familiars that cannot be duplicated.
|
|
225
|
+
*
|
|
226
|
+
* Equal to "uniquefamiliar" in "items_metadata.xml".
|
|
227
|
+
*
|
|
228
|
+
* 1 << 27
|
|
229
|
+
*/
|
|
230
|
+
UNIQUE_FAMILIAR = 134217728,
|
|
231
|
+
/**
|
|
232
|
+
* Items that should not be obtainable in challenges.
|
|
233
|
+
*
|
|
234
|
+
* Equal to "nochallenge" in "items_metadata.xml".
|
|
235
|
+
*
|
|
236
|
+
* 1 << 28
|
|
237
|
+
*/
|
|
238
|
+
NO_CHALLENGE = 268435456,
|
|
239
|
+
/**
|
|
240
|
+
* Items that should not be obtainable in daily runs.
|
|
241
|
+
*
|
|
242
|
+
* Equal to "nodaily" in "items_metadata.xml".
|
|
243
|
+
*
|
|
244
|
+
* 1 << 29
|
|
245
|
+
*/
|
|
246
|
+
NO_DAILY = 536870912,
|
|
247
|
+
/**
|
|
248
|
+
* Items that should be shared between Tainted Lazarus' forms.
|
|
249
|
+
*
|
|
250
|
+
* This is different from `LAZ_SHARED_GLOBAL` in that it does apply stat changes from the item for
|
|
251
|
+
* both characters.
|
|
252
|
+
*
|
|
253
|
+
* Equal to "lazarusshared" in "items_metadata.xml".
|
|
254
|
+
*
|
|
255
|
+
* 1 << 30
|
|
256
|
+
*/
|
|
257
|
+
LAZ_SHARED = 1073741824,
|
|
258
|
+
/**
|
|
259
|
+
* Items that should be shared between Tainted Lazarus' forms but only through global checks (such
|
|
260
|
+
* as `PlayerManager::HasCollectible`).
|
|
261
|
+
*
|
|
262
|
+
* This is different from `LAZ_SHARED` in that it does not apply stat changes from the item for
|
|
263
|
+
* both characters.
|
|
264
|
+
*
|
|
265
|
+
* Equal to "lazarussharedglobal" in "items_metadata.xml".
|
|
266
|
+
*
|
|
267
|
+
* 1 << 31
|
|
268
|
+
*/
|
|
269
|
+
LAZ_SHARED_GLOBAL = 2147483648,
|
|
270
|
+
/**
|
|
271
|
+
* Items that will not be a random starting item for Eden and Tainted Eden.
|
|
272
|
+
*
|
|
273
|
+
* Equal to "noeden" in "items_metadata.xml".
|
|
274
|
+
*
|
|
275
|
+
* 1 << 32
|
|
276
|
+
*/
|
|
277
|
+
NO_EDEN = 4294967296
|
|
278
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
____exports.ItemConfigTag = ItemConfigTag or ({})
|
|
4
|
+
____exports.ItemConfigTag.DEAD = 1
|
|
5
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.DEAD] = "DEAD"
|
|
6
|
+
____exports.ItemConfigTag.SYRINGE = 2
|
|
7
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.SYRINGE] = "SYRINGE"
|
|
8
|
+
____exports.ItemConfigTag.MOM = 4
|
|
9
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.MOM] = "MOM"
|
|
10
|
+
____exports.ItemConfigTag.TECH = 8
|
|
11
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.TECH] = "TECH"
|
|
12
|
+
____exports.ItemConfigTag.BATTERY = 16
|
|
13
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.BATTERY] = "BATTERY"
|
|
14
|
+
____exports.ItemConfigTag.GUPPY = 32
|
|
15
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.GUPPY] = "GUPPY"
|
|
16
|
+
____exports.ItemConfigTag.FLY = 64
|
|
17
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.FLY] = "FLY"
|
|
18
|
+
____exports.ItemConfigTag.BOB = 128
|
|
19
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.BOB] = "BOB"
|
|
20
|
+
____exports.ItemConfigTag.MUSHROOM = 256
|
|
21
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.MUSHROOM] = "MUSHROOM"
|
|
22
|
+
____exports.ItemConfigTag.BABY = 512
|
|
23
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.BABY] = "BABY"
|
|
24
|
+
____exports.ItemConfigTag.ANGEL = 1024
|
|
25
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.ANGEL] = "ANGEL"
|
|
26
|
+
____exports.ItemConfigTag.DEVIL = 2048
|
|
27
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.DEVIL] = "DEVIL"
|
|
28
|
+
____exports.ItemConfigTag.POOP = 4096
|
|
29
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.POOP] = "POOP"
|
|
30
|
+
____exports.ItemConfigTag.BOOK = 8192
|
|
31
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.BOOK] = "BOOK"
|
|
32
|
+
____exports.ItemConfigTag.SPIDER = 16384
|
|
33
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.SPIDER] = "SPIDER"
|
|
34
|
+
____exports.ItemConfigTag.QUEST = 32768
|
|
35
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.QUEST] = "QUEST"
|
|
36
|
+
____exports.ItemConfigTag.MONSTER_MANUAL = 65536
|
|
37
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.MONSTER_MANUAL] = "MONSTER_MANUAL"
|
|
38
|
+
____exports.ItemConfigTag.NO_GREED = 131072
|
|
39
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.NO_GREED] = "NO_GREED"
|
|
40
|
+
____exports.ItemConfigTag.FOOD = 262144
|
|
41
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.FOOD] = "FOOD"
|
|
42
|
+
____exports.ItemConfigTag.TEARS_UP = 524288
|
|
43
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.TEARS_UP] = "TEARS_UP"
|
|
44
|
+
____exports.ItemConfigTag.OFFENSIVE = 1048576
|
|
45
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.OFFENSIVE] = "OFFENSIVE"
|
|
46
|
+
____exports.ItemConfigTag.NO_KEEPER = 2097152
|
|
47
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.NO_KEEPER] = "NO_KEEPER"
|
|
48
|
+
____exports.ItemConfigTag.NO_LOST_BR = 4194304
|
|
49
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.NO_LOST_BR] = "NO_LOST_BR"
|
|
50
|
+
____exports.ItemConfigTag.STARS = 8388608
|
|
51
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.STARS] = "STARS"
|
|
52
|
+
____exports.ItemConfigTag.SUMMONABLE = 16777216
|
|
53
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.SUMMONABLE] = "SUMMONABLE"
|
|
54
|
+
____exports.ItemConfigTag.NO_CANTRIP = 33554432
|
|
55
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.NO_CANTRIP] = "NO_CANTRIP"
|
|
56
|
+
____exports.ItemConfigTag.WISP = 67108864
|
|
57
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.WISP] = "WISP"
|
|
58
|
+
____exports.ItemConfigTag.UNIQUE_FAMILIAR = 134217728
|
|
59
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.UNIQUE_FAMILIAR] = "UNIQUE_FAMILIAR"
|
|
60
|
+
____exports.ItemConfigTag.NO_CHALLENGE = 268435456
|
|
61
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.NO_CHALLENGE] = "NO_CHALLENGE"
|
|
62
|
+
____exports.ItemConfigTag.NO_DAILY = 536870912
|
|
63
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.NO_DAILY] = "NO_DAILY"
|
|
64
|
+
____exports.ItemConfigTag.LAZ_SHARED = 1073741824
|
|
65
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.LAZ_SHARED] = "LAZ_SHARED"
|
|
66
|
+
____exports.ItemConfigTag.LAZ_SHARED_GLOBAL = 2147483648
|
|
67
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.LAZ_SHARED_GLOBAL] = "LAZ_SHARED_GLOBAL"
|
|
68
|
+
____exports.ItemConfigTag.NO_EDEN = 4294967296
|
|
69
|
+
____exports.ItemConfigTag[____exports.ItemConfigTag.NO_EDEN] = "NO_EDEN"
|
|
70
|
+
return ____exports
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
declare type ConversionHeartSubType = HeartSubType.HEART_SOUL | HeartSubType.HEART_BLACK;
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to make a character that has the same health mechanic as Blue Baby (red heart
|
|
5
|
+
* containers --> soul hearts) or Dark Judas (red heart containers --> black hearts).
|
|
6
|
+
*
|
|
7
|
+
* Call this function once at the beginning of your mod to declare the health conversion type.
|
|
8
|
+
*/
|
|
9
|
+
export declare function registerCharacterHealthConversion(playerType: PlayerType | int, conversionHeartSubType: ConversionHeartSubType): void;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Map = ____lualib.Map
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local ____exports = {}
|
|
5
|
+
local postPEffectUpdate, convertRedHeartContainers, removeRedHearts, prePickupCollisionHeart, characterHealthReplacementMap
|
|
6
|
+
local ____featuresInitialized = require("featuresInitialized")
|
|
7
|
+
local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
|
|
8
|
+
local ____pickups = require("functions.pickups")
|
|
9
|
+
local isRedHeart = ____pickups.isRedHeart
|
|
10
|
+
local ____utils = require("functions.utils")
|
|
11
|
+
local ensureAllCases = ____utils.ensureAllCases
|
|
12
|
+
function postPEffectUpdate(self, player)
|
|
13
|
+
local character = player:GetPlayerType()
|
|
14
|
+
local conversionHeartSubType = characterHealthReplacementMap:get(character)
|
|
15
|
+
if conversionHeartSubType == nil then
|
|
16
|
+
return
|
|
17
|
+
end
|
|
18
|
+
convertRedHeartContainers(nil, player, conversionHeartSubType)
|
|
19
|
+
removeRedHearts(nil, player)
|
|
20
|
+
end
|
|
21
|
+
function convertRedHeartContainers(self, player, heartSubType)
|
|
22
|
+
local maxHearts = player:GetMaxHearts()
|
|
23
|
+
if maxHearts == 0 then
|
|
24
|
+
return
|
|
25
|
+
end
|
|
26
|
+
player:AddMaxHearts(maxHearts * -1, false)
|
|
27
|
+
repeat
|
|
28
|
+
local ____switch7 = heartSubType
|
|
29
|
+
local ____cond7 = ____switch7 == HeartSubType.HEART_SOUL
|
|
30
|
+
if ____cond7 then
|
|
31
|
+
do
|
|
32
|
+
player:AddSoulHearts(maxHearts)
|
|
33
|
+
return
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
____cond7 = ____cond7 or ____switch7 == HeartSubType.HEART_BLACK
|
|
37
|
+
if ____cond7 then
|
|
38
|
+
do
|
|
39
|
+
player:AddBlackHearts(maxHearts)
|
|
40
|
+
return
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
do
|
|
44
|
+
do
|
|
45
|
+
ensureAllCases(nil, heartSubType)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
until true
|
|
49
|
+
end
|
|
50
|
+
function removeRedHearts(self, player)
|
|
51
|
+
local hearts = player:GetHearts()
|
|
52
|
+
if hearts > 0 then
|
|
53
|
+
player:AddHearts(hearts * -1)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
function prePickupCollisionHeart(self, pickup, collider)
|
|
57
|
+
if not isRedHeart(nil, pickup) then
|
|
58
|
+
return nil
|
|
59
|
+
end
|
|
60
|
+
local player = collider:ToPlayer()
|
|
61
|
+
if player == nil then
|
|
62
|
+
return nil
|
|
63
|
+
end
|
|
64
|
+
local character = player:GetPlayerType()
|
|
65
|
+
local conversionHeartSubType = characterHealthReplacementMap:get(character)
|
|
66
|
+
if conversionHeartSubType == nil then
|
|
67
|
+
return nil
|
|
68
|
+
end
|
|
69
|
+
return false
|
|
70
|
+
end
|
|
71
|
+
local FEATURE_NAME = "character health manager"
|
|
72
|
+
characterHealthReplacementMap = __TS__New(Map)
|
|
73
|
+
function ____exports.characterHealthConversionInit(self, mod)
|
|
74
|
+
mod:AddCallback(ModCallbacks.MC_POST_PEFFECT_UPDATE, postPEffectUpdate)
|
|
75
|
+
mod:AddCallback(ModCallbacks.MC_PRE_PICKUP_COLLISION, prePickupCollisionHeart, 10)
|
|
76
|
+
end
|
|
77
|
+
function ____exports.registerCharacterHealthConversion(self, playerType, conversionHeartSubType)
|
|
78
|
+
errorIfFeaturesNotInitialized(nil, FEATURE_NAME)
|
|
79
|
+
characterHealthReplacementMap:set(playerType, conversionHeartSubType)
|
|
80
|
+
end
|
|
81
|
+
return ____exports
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
import { ItemConfigTag } from "../enums/ItemConfigTag";
|
|
3
|
+
export declare function collectibleHasTag(collectibleType: CollectibleType | int, tag: ItemConfigTag): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Helper function to get all of the collectible types in the game that have a certain tag.
|
|
6
|
+
*
|
|
7
|
+
* For example, to get all of the collectible types that count as offensive for the purposes of
|
|
8
|
+
* Tainted Lost:
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* const offensiveCollectibleTypes = getCollectibleTypesWithTag(ItemConfigTag.OFFENSIVE);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function getCollectibleTypesWithTag(itemConfigTag: ItemConfigTag): Set<CollectibleType | int>;
|
|
15
|
+
/** Returns the number of items that a player has towards a particular transformation. */
|
|
16
|
+
export declare function getPlayerNumCollectiblesWithTag(player: EntityPlayer, itemConfigTag: ItemConfigTag): int;
|
|
17
|
+
export declare function isQuestCollectible(collectibleType: CollectibleType | int): boolean;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local Map = ____lualib.Map
|
|
3
|
+
local __TS__New = ____lualib.__TS__New
|
|
4
|
+
local Set = ____lualib.Set
|
|
5
|
+
local __TS__Spread = ____lualib.__TS__Spread
|
|
6
|
+
local ____exports = {}
|
|
7
|
+
local ____cachedClasses = require("cachedClasses")
|
|
8
|
+
local itemConfig = ____cachedClasses.itemConfig
|
|
9
|
+
local ____ItemConfigTag = require("enums.ItemConfigTag")
|
|
10
|
+
local ItemConfigTag = ____ItemConfigTag.ItemConfigTag
|
|
11
|
+
local ____collectibles = require("functions.collectibles")
|
|
12
|
+
local getMaxCollectibleType = ____collectibles.getMaxCollectibleType
|
|
13
|
+
local ____math = require("functions.math")
|
|
14
|
+
local range = ____math.range
|
|
15
|
+
local ____player = require("functions.player")
|
|
16
|
+
local getPlayerCollectibleCount = ____player.getPlayerCollectibleCount
|
|
17
|
+
local ____set = require("functions.set")
|
|
18
|
+
local copySet = ____set.copySet
|
|
19
|
+
local ____utils = require("functions.utils")
|
|
20
|
+
local getEnumValues = ____utils.getEnumValues
|
|
21
|
+
function ____exports.collectibleHasTag(self, collectibleType, tag)
|
|
22
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
23
|
+
if itemConfigItem == nil then
|
|
24
|
+
return false
|
|
25
|
+
end
|
|
26
|
+
return itemConfigItem:HasTags(tag)
|
|
27
|
+
end
|
|
28
|
+
local TAG_TO_COLLECTIBLE_TYPES_MAP = __TS__New(Map)
|
|
29
|
+
local function initTagMap(self)
|
|
30
|
+
local maxCollectibleType = getMaxCollectibleType(nil)
|
|
31
|
+
for ____, itemConfigTag in ipairs(getEnumValues(nil, ItemConfigTag)) do
|
|
32
|
+
TAG_TO_COLLECTIBLE_TYPES_MAP:set(
|
|
33
|
+
itemConfigTag,
|
|
34
|
+
__TS__New(Set)
|
|
35
|
+
)
|
|
36
|
+
end
|
|
37
|
+
for ____, collectibleType in ipairs(range(nil, 1, maxCollectibleType)) do
|
|
38
|
+
for ____, itemConfigTag in ipairs(getEnumValues(nil, ItemConfigTag)) do
|
|
39
|
+
do
|
|
40
|
+
if not ____exports.collectibleHasTag(nil, collectibleType, itemConfigTag) then
|
|
41
|
+
goto __continue6
|
|
42
|
+
end
|
|
43
|
+
local collectibleTypesSet = TAG_TO_COLLECTIBLE_TYPES_MAP:get(itemConfigTag)
|
|
44
|
+
if collectibleTypesSet == nil then
|
|
45
|
+
error("Failed to get the collectible types for item tag: " .. ItemConfigTag[itemConfigTag])
|
|
46
|
+
end
|
|
47
|
+
collectibleTypesSet:add(collectibleType)
|
|
48
|
+
end
|
|
49
|
+
::__continue6::
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
function ____exports.getCollectibleTypesWithTag(self, itemConfigTag)
|
|
54
|
+
if TAG_TO_COLLECTIBLE_TYPES_MAP.size == 0 then
|
|
55
|
+
initTagMap(nil)
|
|
56
|
+
end
|
|
57
|
+
local collectibleTypes = TAG_TO_COLLECTIBLE_TYPES_MAP:get(itemConfigTag)
|
|
58
|
+
if collectibleTypes == nil then
|
|
59
|
+
error(("The item config tag of " .. tostring(itemConfigTag)) .. " is not a valid value of the ItemConfigTag enum.")
|
|
60
|
+
end
|
|
61
|
+
return copySet(nil, collectibleTypes)
|
|
62
|
+
end
|
|
63
|
+
function ____exports.getPlayerNumCollectiblesWithTag(self, player, itemConfigTag)
|
|
64
|
+
local collectibleTypesSet = ____exports.getCollectibleTypesWithTag(nil, itemConfigTag)
|
|
65
|
+
return getPlayerCollectibleCount(
|
|
66
|
+
nil,
|
|
67
|
+
player,
|
|
68
|
+
__TS__Spread(collectibleTypesSet:values())
|
|
69
|
+
)
|
|
70
|
+
end
|
|
71
|
+
function ____exports.isQuestCollectible(self, collectibleType)
|
|
72
|
+
return ____exports.collectibleHasTag(nil, collectibleType, ItemConfigTag.QUEST)
|
|
73
|
+
end
|
|
74
|
+
return ____exports
|
|
@@ -3,7 +3,6 @@ import { CollectiblePedestalType } from "../enums/CollectiblePedestalType";
|
|
|
3
3
|
import { CollectibleIndex } from "../types/CollectibleIndex";
|
|
4
4
|
export declare function clearCollectibleSprite(collectible: EntityPickup): void;
|
|
5
5
|
export declare function collectibleHasCacheFlag(collectibleType: CollectibleType | int, cacheFlag: CacheFlag): boolean;
|
|
6
|
-
export declare function collectibleHasTag(collectibleType: CollectibleType | int, tag: ItemConfigTag): boolean;
|
|
7
6
|
/** Helper function to check if two collectible sprites have the same sprite sheet loaded. */
|
|
8
7
|
export declare function collectibleSpriteEquals(sprite1: Sprite, sprite2: Sprite): boolean;
|
|
9
8
|
/**
|
|
@@ -90,6 +89,17 @@ export declare function getCollectiblePedestalType(collectible: EntityPickup): C
|
|
|
90
89
|
* type was not valid.
|
|
91
90
|
*/
|
|
92
91
|
export declare function getCollectibleQuality(collectibleType: CollectibleType | int): int;
|
|
92
|
+
/**
|
|
93
|
+
* Helper function to get the tags of a collectible (which is the composition of zero or more
|
|
94
|
+
* `ItemConfigTag`). Returns 0 if the provided collectible type is not valid.
|
|
95
|
+
*
|
|
96
|
+
* Example:
|
|
97
|
+
* ```ts
|
|
98
|
+
* const collectibleType = CollectibleType.COLLECTIBLE_SAD_ONION;
|
|
99
|
+
* const itemConfigTags = getCollectibleTags(collectibleType); // itemConfigTags is "18350080"
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
export declare function getCollectibleTags(collectibleType: CollectibleType | int): int;
|
|
93
103
|
/**
|
|
94
104
|
* Helper function to get the final collectible type in the game.
|
|
95
105
|
*
|
|
@@ -112,7 +122,6 @@ export declare function isGlitchedCollectible(pickup: EntityPickup): boolean;
|
|
|
112
122
|
* `ItemType.ITEM_FAMILIAR`.
|
|
113
123
|
*/
|
|
114
124
|
export declare function isPassiveCollectible(collectibleType: CollectibleType | int): boolean;
|
|
115
|
-
export declare function isQuestCollectible(collectibleType: CollectibleType | int): boolean;
|
|
116
125
|
/**
|
|
117
126
|
* Helper function to determine if a particular collectible will disappear from the player's
|
|
118
127
|
* inventory upon use. Note that this will not work will modded items, as there is no way to
|
|
@@ -54,13 +54,6 @@ function ____exports.collectibleHasCacheFlag(self, collectibleType, cacheFlag)
|
|
|
54
54
|
end
|
|
55
55
|
return hasFlag(nil, itemConfigItem.CacheFlags, cacheFlag)
|
|
56
56
|
end
|
|
57
|
-
function ____exports.collectibleHasTag(self, collectibleType, tag)
|
|
58
|
-
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
59
|
-
if itemConfigItem == nil then
|
|
60
|
-
return false
|
|
61
|
-
end
|
|
62
|
-
return itemConfigItem:HasTags(tag)
|
|
63
|
-
end
|
|
64
57
|
function ____exports.collectibleSpriteEquals(self, sprite1, sprite2)
|
|
65
58
|
local xStart = -1
|
|
66
59
|
local xFinish = 1
|
|
@@ -177,6 +170,10 @@ function ____exports.getCollectibleQuality(self, collectibleType)
|
|
|
177
170
|
end
|
|
178
171
|
return itemConfigItem.Quality
|
|
179
172
|
end
|
|
173
|
+
function ____exports.getCollectibleTags(self, collectibleType)
|
|
174
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
175
|
+
return itemConfigItem == nil and 0 or itemConfigItem.Tags
|
|
176
|
+
end
|
|
180
177
|
function ____exports.getMaxCollectibleType(self)
|
|
181
178
|
return itemConfig:GetCollectibles().Size - 1
|
|
182
179
|
end
|
|
@@ -201,9 +198,6 @@ function ____exports.isPassiveCollectible(self, collectibleType)
|
|
|
201
198
|
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
202
199
|
return itemType == ItemType.ITEM_PASSIVE or itemType == ItemType.ITEM_FAMILIAR
|
|
203
200
|
end
|
|
204
|
-
function ____exports.isQuestCollectible(self, collectibleType)
|
|
205
|
-
return ____exports.collectibleHasTag(nil, collectibleType, 32768)
|
|
206
|
-
end
|
|
207
201
|
function ____exports.isSingleUseCollectible(self, collectibleType)
|
|
208
202
|
return SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES_SET:has(collectibleType)
|
|
209
203
|
end
|
|
@@ -88,6 +88,13 @@ export declare function getPlayerBlackHearts(player: EntityPlayer): int;
|
|
|
88
88
|
* @returns The first player found when iterating upwards from index 0.
|
|
89
89
|
*/
|
|
90
90
|
export declare function getPlayerCloserThan(position: Vector, distance: float): EntityPlayer | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Helper function to return the total amount of collectibles that a player has that match the
|
|
93
|
+
* collectible type(s) provided.
|
|
94
|
+
*
|
|
95
|
+
* This function is variadic, meaning that you can specify N collectible types.
|
|
96
|
+
*/
|
|
97
|
+
export declare function getPlayerCollectibleCount(player: EntityPlayer, ...collectibleTypes: Array<CollectibleType | int>): int;
|
|
91
98
|
/**
|
|
92
99
|
* Iterates over every item in the game and returns a map containing the number of each item that
|
|
93
100
|
* the player has.
|
|
@@ -280,6 +280,14 @@ function ____exports.getPlayerCloserThan(self, position, distance)
|
|
|
280
280
|
function(____, player) return player.Position:Distance(position) <= distance end
|
|
281
281
|
)
|
|
282
282
|
end
|
|
283
|
+
function ____exports.getPlayerCollectibleCount(self, player, ...)
|
|
284
|
+
local collectibleTypes = {...}
|
|
285
|
+
local numCollectibles = 0
|
|
286
|
+
for ____, collectibleType in ipairs(collectibleTypes) do
|
|
287
|
+
numCollectibles = numCollectibles + player:GetCollectibleNum(collectibleType, true)
|
|
288
|
+
end
|
|
289
|
+
return numCollectibles
|
|
290
|
+
end
|
|
283
291
|
function ____exports.getPlayerCollectibleMap(self, player)
|
|
284
292
|
local collectibleSet = getCollectibleSet(nil)
|
|
285
293
|
local collectibleMap = __TS__New(Map)
|
|
@@ -495,9 +503,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
495
503
|
itemPool:RemoveCollectible(collectibleType)
|
|
496
504
|
end
|
|
497
505
|
repeat
|
|
498
|
-
local
|
|
499
|
-
local
|
|
500
|
-
if
|
|
506
|
+
local ____switch109 = activeSlot
|
|
507
|
+
local ____cond109 = ____switch109 == ActiveSlot.SLOT_PRIMARY
|
|
508
|
+
if ____cond109 then
|
|
501
509
|
do
|
|
502
510
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
503
511
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -506,8 +514,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
506
514
|
break
|
|
507
515
|
end
|
|
508
516
|
end
|
|
509
|
-
|
|
510
|
-
if
|
|
517
|
+
____cond109 = ____cond109 or ____switch109 == ActiveSlot.SLOT_SECONDARY
|
|
518
|
+
if ____cond109 then
|
|
511
519
|
do
|
|
512
520
|
if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
|
|
513
521
|
player:RemoveCollectible(primaryCollectibleType)
|
|
@@ -522,16 +530,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
|
|
|
522
530
|
break
|
|
523
531
|
end
|
|
524
532
|
end
|
|
525
|
-
|
|
526
|
-
if
|
|
533
|
+
____cond109 = ____cond109 or ____switch109 == ActiveSlot.SLOT_POCKET
|
|
534
|
+
if ____cond109 then
|
|
527
535
|
do
|
|
528
536
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
529
537
|
player:SetActiveCharge(charge, activeSlot)
|
|
530
538
|
break
|
|
531
539
|
end
|
|
532
540
|
end
|
|
533
|
-
|
|
534
|
-
if
|
|
541
|
+
____cond109 = ____cond109 or ____switch109 == ActiveSlot.SLOT_POCKET2
|
|
542
|
+
if ____cond109 then
|
|
535
543
|
do
|
|
536
544
|
player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
|
|
537
545
|
break
|
|
@@ -5,8 +5,9 @@ local preventCollectibleRotate = ____preventCollectibleRotate.preventCollectible
|
|
|
5
5
|
local ____featuresInitialized = require("featuresInitialized")
|
|
6
6
|
local areFeaturesInitialized = ____featuresInitialized.areFeaturesInitialized
|
|
7
7
|
local ____collectibles = require("functions.collectibles")
|
|
8
|
-
local isQuestCollectible = ____collectibles.isQuestCollectible
|
|
9
8
|
local setCollectibleEmpty = ____collectibles.setCollectibleEmpty
|
|
9
|
+
local ____collectibleTag = require("functions.collectibleTag")
|
|
10
|
+
local isQuestCollectible = ____collectibleTag.isQuestCollectible
|
|
10
11
|
local ____entitySpecific = require("functions.entitySpecific")
|
|
11
12
|
local spawnPickupWithSeed = ____entitySpecific.spawnPickupWithSeed
|
|
12
13
|
local ____player = require("functions.player")
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get all of the collectible types in the game that count towards a particular
|
|
4
|
+
* transformation.
|
|
5
|
+
*
|
|
6
|
+
* For example, to get all of the collectible types that count towards Guppy:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const guppyCollectibleTypes = getCollectibleTypesForTransformation(PlayerForm.PLAYERFORM_GUPPY);
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCollectibleTypesForTransformation(playerForm: PlayerForm): Set<CollectibleType | int>;
|
|
3
13
|
/** Returns the number of items that a player has towards a particular transformation. */
|
|
4
|
-
export declare function
|
|
14
|
+
export declare function getPlayerNumCollectiblesForTransformation(player: EntityPlayer, playerForm: PlayerForm): int;
|
|
5
15
|
/**
|
|
6
16
|
* Helper function to get a transformation name from a PlayerForm enum.
|
|
7
17
|
*
|
|
@@ -2,103 +2,74 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local Map = ____lualib.Map
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local Set = ____lualib.Set
|
|
5
|
+
local __TS__Spread = ____lualib.__TS__Spread
|
|
5
6
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
6
7
|
local ____exports = {}
|
|
7
|
-
local
|
|
8
|
-
local
|
|
8
|
+
local ____ItemConfigTag = require("enums.ItemConfigTag")
|
|
9
|
+
local ItemConfigTag = ____ItemConfigTag.ItemConfigTag
|
|
9
10
|
local ____transformationNames = require("objects.transformationNames")
|
|
10
11
|
local DEFAULT_TRANSFORMATION_NAME = ____transformationNames.DEFAULT_TRANSFORMATION_NAME
|
|
11
12
|
local TRANSFORMATION_NAMES = ____transformationNames.TRANSFORMATION_NAMES
|
|
12
13
|
local ____collectibles = require("functions.collectibles")
|
|
13
|
-
local
|
|
14
|
-
local
|
|
14
|
+
local getCollectibleTags = ____collectibles.getCollectibleTags
|
|
15
|
+
local ____collectibleTag = require("functions.collectibleTag")
|
|
16
|
+
local getCollectibleTypesWithTag = ____collectibleTag.getCollectibleTypesWithTag
|
|
17
|
+
local ____flag = require("functions.flag")
|
|
18
|
+
local hasFlag = ____flag.hasFlag
|
|
15
19
|
local ____math = require("functions.math")
|
|
16
20
|
local range = ____math.range
|
|
17
|
-
local
|
|
18
|
-
local
|
|
21
|
+
local ____player = require("functions.player")
|
|
22
|
+
local getPlayerCollectibleCount = ____player.getPlayerCollectibleCount
|
|
19
23
|
local TRANSFORMATION_TO_TAG_MAP = __TS__New(Map, {
|
|
20
|
-
{PlayerForm.PLAYERFORM_GUPPY,
|
|
21
|
-
{PlayerForm.PLAYERFORM_LORD_OF_THE_FLIES,
|
|
22
|
-
{PlayerForm.PLAYERFORM_MUSHROOM,
|
|
23
|
-
{PlayerForm.PLAYERFORM_ANGEL,
|
|
24
|
-
{PlayerForm.PLAYERFORM_BOB,
|
|
25
|
-
{PlayerForm.PLAYERFORM_DRUGS,
|
|
26
|
-
{PlayerForm.PLAYERFORM_MOM,
|
|
27
|
-
{PlayerForm.PLAYERFORM_BABY,
|
|
28
|
-
{PlayerForm.PLAYERFORM_EVIL_ANGEL,
|
|
29
|
-
{PlayerForm.PLAYERFORM_POOP,
|
|
30
|
-
{PlayerForm.PLAYERFORM_BOOK_WORM,
|
|
31
|
-
{PlayerForm.PLAYERFORM_SPIDERBABY,
|
|
24
|
+
{PlayerForm.PLAYERFORM_GUPPY, ItemConfigTag.GUPPY},
|
|
25
|
+
{PlayerForm.PLAYERFORM_LORD_OF_THE_FLIES, ItemConfigTag.FLY},
|
|
26
|
+
{PlayerForm.PLAYERFORM_MUSHROOM, ItemConfigTag.MUSHROOM},
|
|
27
|
+
{PlayerForm.PLAYERFORM_ANGEL, ItemConfigTag.ANGEL},
|
|
28
|
+
{PlayerForm.PLAYERFORM_BOB, ItemConfigTag.BOB},
|
|
29
|
+
{PlayerForm.PLAYERFORM_DRUGS, ItemConfigTag.SYRINGE},
|
|
30
|
+
{PlayerForm.PLAYERFORM_MOM, ItemConfigTag.MOM},
|
|
31
|
+
{PlayerForm.PLAYERFORM_BABY, ItemConfigTag.BABY},
|
|
32
|
+
{PlayerForm.PLAYERFORM_EVIL_ANGEL, ItemConfigTag.DEVIL},
|
|
33
|
+
{PlayerForm.PLAYERFORM_POOP, ItemConfigTag.POOP},
|
|
34
|
+
{PlayerForm.PLAYERFORM_BOOK_WORM, ItemConfigTag.BOOK},
|
|
35
|
+
{PlayerForm.PLAYERFORM_SPIDERBABY, ItemConfigTag.SPIDER}
|
|
32
36
|
})
|
|
33
|
-
local TRANSFORMATIONS_NOT_BASED_ON_ITEMS = __TS__New(Set, {PlayerForm.PLAYERFORM_ADULTHOOD, PlayerForm.PLAYERFORM_STOMPY, PlayerForm.PLAYERFORM_FLIGHT})
|
|
34
37
|
local TRANSFORMATIONS_THAT_GRANT_FLYING = __TS__New(Set, {PlayerForm.PLAYERFORM_GUPPY, PlayerForm.PLAYERFORM_LORD_OF_THE_FLIES, PlayerForm.PLAYERFORM_ANGEL, PlayerForm.PLAYERFORM_EVIL_ANGEL})
|
|
35
|
-
local TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP = __TS__New(Map)
|
|
36
|
-
local COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP = __TS__New(
|
|
37
|
-
DefaultMap,
|
|
38
|
-
function() return __TS__New(Set) end
|
|
39
|
-
)
|
|
40
|
-
local function initTransformationMaps(self)
|
|
41
|
-
local maxCollectibleType = getMaxCollectibleType(nil)
|
|
42
|
-
for ____, playerForm in __TS__Iterator(TRANSFORMATION_TO_TAG_MAP:keys()) do
|
|
43
|
-
TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP:set(
|
|
44
|
-
playerForm,
|
|
45
|
-
__TS__New(Set)
|
|
46
|
-
)
|
|
47
|
-
end
|
|
48
|
-
for ____, collectibleType in ipairs(range(nil, 1, maxCollectibleType)) do
|
|
49
|
-
for ____, ____value in __TS__Iterator(TRANSFORMATION_TO_TAG_MAP:entries()) do
|
|
50
|
-
local playerForm = ____value[1]
|
|
51
|
-
local tag = ____value[2]
|
|
52
|
-
do
|
|
53
|
-
if not collectibleHasTag(nil, collectibleType, tag) then
|
|
54
|
-
goto __continue7
|
|
55
|
-
end
|
|
56
|
-
local collectibleTypesSet = TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP:get(playerForm)
|
|
57
|
-
if collectibleTypesSet == nil then
|
|
58
|
-
error("Failed to get the collectible types for transformation: " .. tostring(playerForm))
|
|
59
|
-
end
|
|
60
|
-
collectibleTypesSet:add(collectibleType)
|
|
61
|
-
local transformations = COLLECTIBLE_TYPE_TO_TRANSFORMATION_MAP:getAndSetDefault(collectibleType)
|
|
62
|
-
transformations:add(playerForm)
|
|
63
|
-
end
|
|
64
|
-
::__continue7::
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
38
|
function ____exports.getCollectibleTypesForTransformation(self, playerForm)
|
|
69
|
-
|
|
70
|
-
|
|
39
|
+
local itemConfigTag = TRANSFORMATION_TO_TAG_MAP:get(playerForm)
|
|
40
|
+
if itemConfigTag == nil then
|
|
41
|
+
error(("Failed to get the collectible types for the transformation of " .. tostring(playerForm)) .. " because that transformation is not based on collectibles.")
|
|
71
42
|
end
|
|
72
|
-
|
|
73
|
-
return collectibleTypes == nil and __TS__New(Set) or copySet(nil, collectibleTypes)
|
|
43
|
+
return getCollectibleTypesWithTag(nil, itemConfigTag)
|
|
74
44
|
end
|
|
75
|
-
function ____exports.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
local itemsForTransformation = TRANSFORMATION_TO_COLLECTIBLE_TYPES_MAP:get(playerForm)
|
|
83
|
-
if itemsForTransformation == nil then
|
|
84
|
-
error(("The transformation of " .. tostring(playerForm)) .. " is not a valid value of the PlayerForm enum.")
|
|
85
|
-
end
|
|
86
|
-
local numCollectibles = 0
|
|
87
|
-
for ____, collectibleType in __TS__Iterator(itemsForTransformation:values()) do
|
|
88
|
-
numCollectibles = numCollectibles + player:GetCollectibleNum(collectibleType)
|
|
89
|
-
end
|
|
90
|
-
return numCollectibles
|
|
45
|
+
function ____exports.getPlayerNumCollectiblesForTransformation(self, player, playerForm)
|
|
46
|
+
local collectibleTypes = ____exports.getCollectibleTypesForTransformation(nil, playerForm)
|
|
47
|
+
return getPlayerCollectibleCount(
|
|
48
|
+
nil,
|
|
49
|
+
player,
|
|
50
|
+
__TS__Spread(collectibleTypes:values())
|
|
51
|
+
)
|
|
91
52
|
end
|
|
92
53
|
function ____exports.getTransformationName(self, playerForm)
|
|
93
54
|
local transformationName = TRANSFORMATION_NAMES[playerForm]
|
|
94
55
|
return transformationName == nil and DEFAULT_TRANSFORMATION_NAME or transformationName
|
|
95
56
|
end
|
|
96
57
|
function ____exports.getTransformationsForCollectibleType(self, collectibleType)
|
|
97
|
-
|
|
98
|
-
|
|
58
|
+
local itemConfigTags = getCollectibleTags(nil, collectibleType)
|
|
59
|
+
local transformationSet = __TS__New(Set)
|
|
60
|
+
for ____, playerForm in ipairs(range(nil, 0, PlayerForm.NUM_PLAYER_FORMS - 1)) do
|
|
61
|
+
do
|
|
62
|
+
local itemConfigTag = TRANSFORMATION_TO_TAG_MAP:get(playerForm)
|
|
63
|
+
if itemConfigTag == nil then
|
|
64
|
+
goto __continue7
|
|
65
|
+
end
|
|
66
|
+
if hasFlag(nil, itemConfigTags, itemConfigTag) then
|
|
67
|
+
transformationSet:add(playerForm)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
::__continue7::
|
|
99
71
|
end
|
|
100
|
-
|
|
101
|
-
return transformations == nil and __TS__New(Set) or copySet(nil, transformations)
|
|
72
|
+
return transformationSet
|
|
102
73
|
end
|
|
103
74
|
function ____exports.hasFlyingTransformation(self, player)
|
|
104
75
|
for ____, playerForm in __TS__Iterator(TRANSFORMATIONS_THAT_GRANT_FLYING:values()) do
|
package/dist/index.d.ts
CHANGED
|
@@ -7,12 +7,14 @@ export * from "./constants";
|
|
|
7
7
|
export * from "./enums/CardType";
|
|
8
8
|
export * from "./enums/CollectiblePedestalType";
|
|
9
9
|
export * from "./enums/HealthType";
|
|
10
|
+
export * from "./enums/ItemConfigTag";
|
|
10
11
|
export * from "./enums/ModCallbacksCustom";
|
|
11
12
|
export * from "./enums/PillEffectClass";
|
|
12
13
|
export * from "./enums/PillEffectType";
|
|
13
14
|
export * from "./enums/PocketItemType";
|
|
14
15
|
export * from "./enums/SerializationType";
|
|
15
|
-
export
|
|
16
|
+
export { registerCharacterHealthConversion } from "./features/characterHealthConversion";
|
|
17
|
+
export { registerCharacterStats } from "./features/characterStats";
|
|
16
18
|
export { deployJSONRoom, deployRandomJSONRoom, emptyRoom, } from "./features/deployJSONRoom";
|
|
17
19
|
export { disableAllInputs, disableAllInputsExceptFor, disableMovementInputs, disableShootingInputs, enableAllInputs, enableAllInputsExceptFor, } from "./features/disableInputs";
|
|
18
20
|
export { disableAllSound, enableAllSound } from "./features/disableSound";
|
|
@@ -41,6 +43,7 @@ export * from "./functions/chargeBar";
|
|
|
41
43
|
export * from "./functions/collectibleCacheFlag";
|
|
42
44
|
export * from "./functions/collectibles";
|
|
43
45
|
export * from "./functions/collectibleSet";
|
|
46
|
+
export * from "./functions/collectibleTag";
|
|
44
47
|
export * from "./functions/color";
|
|
45
48
|
export * from "./functions/debug";
|
|
46
49
|
export { deepCopy } from "./functions/deepCopy";
|
package/dist/index.lua
CHANGED
|
@@ -71,7 +71,7 @@ do
|
|
|
71
71
|
end
|
|
72
72
|
end
|
|
73
73
|
do
|
|
74
|
-
local ____export = require("enums.
|
|
74
|
+
local ____export = require("enums.ItemConfigTag")
|
|
75
75
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
76
76
|
if ____exportKey ~= "default" then
|
|
77
77
|
____exports[____exportKey] = ____exportValue
|
|
@@ -79,7 +79,7 @@ do
|
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
do
|
|
82
|
-
local ____export = require("enums.
|
|
82
|
+
local ____export = require("enums.ModCallbacksCustom")
|
|
83
83
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
84
84
|
if ____exportKey ~= "default" then
|
|
85
85
|
____exports[____exportKey] = ____exportValue
|
|
@@ -87,7 +87,7 @@ do
|
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
do
|
|
90
|
-
local ____export = require("enums.
|
|
90
|
+
local ____export = require("enums.PillEffectClass")
|
|
91
91
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
92
92
|
if ____exportKey ~= "default" then
|
|
93
93
|
____exports[____exportKey] = ____exportValue
|
|
@@ -95,7 +95,7 @@ do
|
|
|
95
95
|
end
|
|
96
96
|
end
|
|
97
97
|
do
|
|
98
|
-
local ____export = require("enums.
|
|
98
|
+
local ____export = require("enums.PillEffectType")
|
|
99
99
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
100
100
|
if ____exportKey ~= "default" then
|
|
101
101
|
____exports[____exportKey] = ____exportValue
|
|
@@ -103,7 +103,7 @@ do
|
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
105
|
do
|
|
106
|
-
local ____export = require("enums.
|
|
106
|
+
local ____export = require("enums.PocketItemType")
|
|
107
107
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
108
108
|
if ____exportKey ~= "default" then
|
|
109
109
|
____exports[____exportKey] = ____exportValue
|
|
@@ -111,13 +111,23 @@ do
|
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
113
|
do
|
|
114
|
-
local ____export = require("
|
|
114
|
+
local ____export = require("enums.SerializationType")
|
|
115
115
|
for ____exportKey, ____exportValue in pairs(____export) do
|
|
116
116
|
if ____exportKey ~= "default" then
|
|
117
117
|
____exports[____exportKey] = ____exportValue
|
|
118
118
|
end
|
|
119
119
|
end
|
|
120
120
|
end
|
|
121
|
+
do
|
|
122
|
+
local ____characterHealthConversion = require("features.characterHealthConversion")
|
|
123
|
+
local registerCharacterHealthConversion = ____characterHealthConversion.registerCharacterHealthConversion
|
|
124
|
+
____exports.registerCharacterHealthConversion = registerCharacterHealthConversion
|
|
125
|
+
end
|
|
126
|
+
do
|
|
127
|
+
local ____characterStats = require("features.characterStats")
|
|
128
|
+
local registerCharacterStats = ____characterStats.registerCharacterStats
|
|
129
|
+
____exports.registerCharacterStats = registerCharacterStats
|
|
130
|
+
end
|
|
121
131
|
do
|
|
122
132
|
local ____deployJSONRoom = require("features.deployJSONRoom")
|
|
123
133
|
local deployJSONRoom = ____deployJSONRoom.deployJSONRoom
|
|
@@ -337,6 +347,14 @@ do
|
|
|
337
347
|
end
|
|
338
348
|
end
|
|
339
349
|
end
|
|
350
|
+
do
|
|
351
|
+
local ____export = require("functions.collectibleTag")
|
|
352
|
+
for ____exportKey, ____exportValue in pairs(____export) do
|
|
353
|
+
if ____exportKey ~= "default" then
|
|
354
|
+
____exports[____exportKey] = ____exportValue
|
|
355
|
+
end
|
|
356
|
+
end
|
|
357
|
+
end
|
|
340
358
|
do
|
|
341
359
|
local ____export = require("functions.color")
|
|
342
360
|
for ____exportKey, ____exportValue in pairs(____export) do
|
package/dist/upgradeMod.lua
CHANGED
|
@@ -78,6 +78,8 @@ local ____roomClearChange = require("callbacks.roomClearChange")
|
|
|
78
78
|
local roomClearChangeCallbackInit = ____roomClearChange.roomClearChangeCallbackInit
|
|
79
79
|
local ____ModUpgraded = require("classes.ModUpgraded")
|
|
80
80
|
local ModUpgraded = ____ModUpgraded.ModUpgraded
|
|
81
|
+
local ____characterHealthConversion = require("features.characterHealthConversion")
|
|
82
|
+
local characterHealthConversionInit = ____characterHealthConversion.characterHealthConversionInit
|
|
81
83
|
local ____characterStats = require("features.characterStats")
|
|
82
84
|
local characterStatsInit = ____characterStats.characterStatsInit
|
|
83
85
|
local ____deployJSONRoom = require("features.deployJSONRoom")
|
|
@@ -166,6 +168,7 @@ function initFeatures(self, mod)
|
|
|
166
168
|
fastResetInit(nil, mod)
|
|
167
169
|
fadeInRemoverInit(nil, mod)
|
|
168
170
|
characterStatsInit(nil, mod)
|
|
171
|
+
characterHealthConversionInit(nil, mod)
|
|
169
172
|
end
|
|
170
173
|
function ____exports.upgradeMod(self, modVanilla)
|
|
171
174
|
patchErrorFunction(nil)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.284",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^1.0.
|
|
28
|
+
"isaac-typescript-definitions": "^1.0.395",
|
|
29
29
|
"isaacscript-lint": "^1.0.99",
|
|
30
30
|
"isaacscript-tsconfig": "^1.1.9",
|
|
31
31
|
"typedoc": "^0.22.15",
|