isaacscript-common 76.2.0 → 77.0.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/classes/features/callbackLogic/CustomGridEntities.d.ts +8 -0
- package/dist/classes/features/callbackLogic/CustomGridEntities.d.ts.map +1 -1
- package/dist/classes/features/callbackLogic/GameReorderedCallbacks.d.ts +6 -0
- package/dist/classes/features/callbackLogic/GameReorderedCallbacks.d.ts.map +1 -1
- package/dist/classes/features/other/CharacterHealthConversion.d.ts +2 -0
- package/dist/classes/features/other/CharacterHealthConversion.d.ts.map +1 -1
- package/dist/classes/features/other/CharacterStats.d.ts +2 -0
- package/dist/classes/features/other/CharacterStats.d.ts.map +1 -1
- package/dist/classes/features/other/CollectibleItemPoolType.d.ts +2 -0
- package/dist/classes/features/other/CollectibleItemPoolType.d.ts.map +1 -1
- package/dist/classes/features/other/CustomHotkeys.d.ts +4 -0
- package/dist/classes/features/other/CustomHotkeys.d.ts.map +1 -1
- package/dist/classes/features/other/CustomItemPools.d.ts +2 -0
- package/dist/classes/features/other/CustomItemPools.d.ts.map +1 -1
- package/dist/classes/features/other/CustomPickups.d.ts +1 -0
- package/dist/classes/features/other/CustomPickups.d.ts.map +1 -1
- package/dist/classes/features/other/CustomStages.d.ts +3 -0
- package/dist/classes/features/other/CustomStages.d.ts.map +1 -1
- package/dist/classes/features/other/DebugDisplay.d.ts +54 -0
- package/dist/classes/features/other/DebugDisplay.d.ts.map +1 -1
- package/dist/classes/features/other/DeployJSONRoom.d.ts +1 -0
- package/dist/classes/features/other/DeployJSONRoom.d.ts.map +1 -1
- package/dist/classes/features/other/DisableInputs.d.ts +9 -0
- package/dist/classes/features/other/DisableInputs.d.ts.map +1 -1
- package/dist/classes/features/other/EdenStartingStatsHealth.d.ts +6 -0
- package/dist/classes/features/other/EdenStartingStatsHealth.d.ts.map +1 -1
- package/dist/classes/features/other/ExtraConsoleCommands.d.ts +6 -0
- package/dist/classes/features/other/ExtraConsoleCommands.d.ts.map +1 -1
- package/dist/classes/features/other/FadeInRemover.d.ts +4 -0
- package/dist/classes/features/other/FadeInRemover.d.ts.map +1 -1
- package/dist/classes/features/other/FastReset.d.ts +4 -0
- package/dist/classes/features/other/FastReset.d.ts.map +1 -1
- package/dist/classes/features/other/FlyingDetection.d.ts +2 -0
- package/dist/classes/features/other/FlyingDetection.d.ts.map +1 -1
- package/dist/classes/features/other/FlyingDetection.lua +2 -3
- package/dist/classes/features/other/ForgottenSwitch.d.ts +2 -0
- package/dist/classes/features/other/ForgottenSwitch.d.ts.map +1 -1
- package/dist/classes/features/other/ItemPoolDetection.d.ts +7 -1
- package/dist/classes/features/other/ItemPoolDetection.d.ts.map +1 -1
- package/dist/classes/features/other/ModdedElementDetection.d.ts +32 -0
- package/dist/classes/features/other/ModdedElementDetection.d.ts.map +1 -1
- package/dist/classes/features/other/ModdedElementSets.d.ts +88 -20
- package/dist/classes/features/other/ModdedElementSets.d.ts.map +1 -1
- package/dist/classes/features/other/ModdedElementSets.lua +75 -86
- package/dist/classes/features/other/NoSirenSteal.d.ts +1 -0
- package/dist/classes/features/other/NoSirenSteal.d.ts.map +1 -1
- package/dist/classes/features/other/Pause.d.ts +10 -0
- package/dist/classes/features/other/Pause.d.ts.map +1 -1
- package/dist/classes/features/other/PersistentEntities.d.ts +2 -0
- package/dist/classes/features/other/PersistentEntities.d.ts.map +1 -1
- package/dist/classes/features/other/PlayerCollectibleTracking.d.ts +3 -0
- package/dist/classes/features/other/PlayerCollectibleTracking.d.ts.map +1 -1
- package/dist/classes/features/other/PonyDetection.d.ts +4 -0
- package/dist/classes/features/other/PonyDetection.d.ts.map +1 -1
- package/dist/classes/features/other/PreventChildEntities.d.ts +2 -0
- package/dist/classes/features/other/PreventChildEntities.d.ts.map +1 -1
- package/dist/classes/features/other/RoomClearFrame.d.ts +19 -0
- package/dist/classes/features/other/RoomClearFrame.d.ts.map +1 -1
- package/dist/classes/features/other/RoomClearFrame.lua +8 -2
- package/dist/classes/features/other/RoomHistory.d.ts +17 -1
- package/dist/classes/features/other/RoomHistory.d.ts.map +1 -1
- package/dist/classes/features/other/RunInNFrames.d.ts +9 -2
- package/dist/classes/features/other/RunInNFrames.d.ts.map +1 -1
- package/dist/classes/features/other/RunNextRun.d.ts +2 -0
- package/dist/classes/features/other/RunNextRun.d.ts.map +1 -1
- package/dist/classes/features/other/SaveDataManager.d.ts +21 -0
- package/dist/classes/features/other/SaveDataManager.d.ts.map +1 -1
- package/dist/classes/features/other/SpawnRockAltRewards.d.ts +1 -0
- package/dist/classes/features/other/SpawnRockAltRewards.d.ts.map +1 -1
- package/dist/classes/features/other/StageHistory.d.ts +3 -0
- package/dist/classes/features/other/StageHistory.d.ts.map +1 -1
- package/dist/classes/features/other/StartAmbush.d.ts +2 -0
- package/dist/classes/features/other/StartAmbush.d.ts.map +1 -1
- package/dist/classes/features/other/TaintedLazarusPlayers.d.ts +2 -0
- package/dist/classes/features/other/TaintedLazarusPlayers.d.ts.map +1 -1
- package/dist/classes/features/other/UnlockAchievementsDetection.d.ts +2 -0
- package/dist/classes/features/other/UnlockAchievementsDetection.d.ts.map +1 -1
- package/dist/classes/private/CustomCallback.d.ts +0 -1
- package/dist/classes/private/CustomCallback.d.ts.map +1 -1
- package/dist/classes/private/CustomCallback.lua +0 -19
- package/dist/functions/array.d.ts +3 -3
- package/dist/functions/array.d.ts.map +1 -1
- package/dist/functions/array.lua +34 -28
- package/dist/functions/cards.lua +3 -3
- package/dist/functions/collectibles.d.ts +2 -2
- package/dist/functions/collectibles.d.ts.map +1 -1
- package/dist/functions/collectibles.lua +4 -5
- package/dist/functions/pills.d.ts +3 -3
- package/dist/functions/pills.d.ts.map +1 -1
- package/dist/functions/playerTrinkets.d.ts +1 -1
- package/dist/functions/playerTrinkets.d.ts.map +1 -1
- package/dist/functions/players.d.ts.map +1 -1
- package/dist/functions/players.lua +7 -7
- package/dist/index.rollup.d.ts +354 -34
- package/dist/isaacscript-common.lua +490 -510
- package/dist/sets/{itemConfigCardTypesForCardsSet.d.ts → itemConfigCardTypesForCards.d.ts} +2 -2
- package/dist/sets/itemConfigCardTypesForCards.d.ts.map +1 -0
- package/dist/sets/{itemConfigCardTypesForCardsSet.lua → itemConfigCardTypesForCards.lua} +1 -1
- package/package.json +1 -1
- package/src/classes/features/callbackLogic/CustomGridEntities.ts +8 -0
- package/src/classes/features/callbackLogic/GameReorderedCallbacks.ts +6 -0
- package/src/classes/features/other/CharacterHealthConversion.ts +2 -0
- package/src/classes/features/other/CharacterStats.ts +2 -0
- package/src/classes/features/other/CollectibleItemPoolType.ts +2 -0
- package/src/classes/features/other/CustomHotkeys.ts +4 -0
- package/src/classes/features/other/CustomItemPools.ts +2 -0
- package/src/classes/features/other/CustomPickups.ts +1 -0
- package/src/classes/features/other/CustomStages.ts +3 -0
- package/src/classes/features/other/DebugDisplay.ts +54 -0
- package/src/classes/features/other/DeployJSONRoom.ts +1 -0
- package/src/classes/features/other/DisableInputs.ts +9 -0
- package/src/classes/features/other/EdenStartingStatsHealth.ts +6 -0
- package/src/classes/features/other/ExtraConsoleCommands.ts +6 -0
- package/src/classes/features/other/FadeInRemover.ts +4 -0
- package/src/classes/features/other/FastReset.ts +4 -0
- package/src/classes/features/other/FlyingDetection.ts +2 -0
- package/src/classes/features/other/ForgottenSwitch.ts +2 -0
- package/src/classes/features/other/ItemPoolDetection.ts +7 -1
- package/src/classes/features/other/ModdedElementDetection.ts +32 -0
- package/src/classes/features/other/ModdedElementSets.ts +174 -121
- package/src/classes/features/other/NoSirenSteal.ts +1 -0
- package/src/classes/features/other/Pause.ts +10 -0
- package/src/classes/features/other/PersistentEntities.ts +2 -0
- package/src/classes/features/other/PlayerCollectibleTracking.ts +3 -0
- package/src/classes/features/other/PonyDetection.ts +4 -0
- package/src/classes/features/other/PreventChildEntities.ts +2 -0
- package/src/classes/features/other/RoomClearFrame.ts +27 -1
- package/src/classes/features/other/RoomHistory.ts +17 -1
- package/src/classes/features/other/RunInNFrames.ts +9 -2
- package/src/classes/features/other/RunNextRun.ts +2 -0
- package/src/classes/features/other/SaveDataManager.ts +21 -0
- package/src/classes/features/other/SpawnRockAltRewards.ts +1 -0
- package/src/classes/features/other/StageHistory.ts +3 -0
- package/src/classes/features/other/StartAmbush.ts +2 -0
- package/src/classes/features/other/TaintedLazarusPlayers.ts +2 -0
- package/src/classes/features/other/UnlockAchievementsDetection.ts +2 -0
- package/src/classes/private/CustomCallback.ts +0 -15
- package/src/functions/array.ts +12 -5
- package/src/functions/cards.ts +2 -2
- package/src/functions/collectibles.ts +7 -7
- package/src/functions/pills.ts +3 -3
- package/src/functions/playerTrinkets.ts +3 -1
- package/src/sets/{itemConfigCardTypesForCardsSet.ts → itemConfigCardTypesForCards.ts} +3 -1
- package/dist/sets/itemConfigCardTypesForCardsSet.d.ts.map +0 -1
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
} from "../../../core/constantsVanilla";
|
|
27
27
|
import { Exported } from "../../../decorators";
|
|
28
28
|
import { ISCFeature } from "../../../enums/ISCFeature";
|
|
29
|
+
import { arrayRemove, getRandomArrayElement } from "../../../functions/array";
|
|
29
30
|
import { getItemConfigCardType } from "../../../functions/cards";
|
|
30
31
|
import { collectibleHasTag } from "../../../functions/collectibleTag";
|
|
31
32
|
import {
|
|
@@ -36,12 +37,7 @@ import {
|
|
|
36
37
|
isPassiveOrFamiliarCollectible,
|
|
37
38
|
} from "../../../functions/collectibles";
|
|
38
39
|
import { getFlagName } from "../../../functions/flag";
|
|
39
|
-
import {
|
|
40
|
-
copySet,
|
|
41
|
-
deleteSetsFromSet,
|
|
42
|
-
getRandomSetElement,
|
|
43
|
-
getSortedSetValues,
|
|
44
|
-
} from "../../../functions/set";
|
|
40
|
+
import { getRandomSetElement } from "../../../functions/set";
|
|
45
41
|
import { trinketHasCacheFlag } from "../../../functions/trinkets";
|
|
46
42
|
import {
|
|
47
43
|
asCardType,
|
|
@@ -50,9 +46,9 @@ import {
|
|
|
50
46
|
asTrinketType,
|
|
51
47
|
} from "../../../functions/types";
|
|
52
48
|
import { assertDefined, iRange, repeat } from "../../../functions/utils";
|
|
53
|
-
import {
|
|
49
|
+
import { ITEM_CONFIG_CARD_TYPES_FOR_CARDS } from "../../../sets/itemConfigCardTypesForCards";
|
|
54
50
|
import { ReadonlyMap } from "../../../types/ReadonlyMap";
|
|
55
|
-
import { ReadonlySet } from "../../../types/ReadonlySet";
|
|
51
|
+
import type { ReadonlySet } from "../../../types/ReadonlySet";
|
|
56
52
|
import { Feature } from "../../private/Feature";
|
|
57
53
|
import type { ModdedElementDetection } from "./ModdedElementDetection";
|
|
58
54
|
|
|
@@ -125,23 +121,22 @@ export class ModdedElementSets extends Feature {
|
|
|
125
121
|
|
|
126
122
|
private readonly cacheFlagToCollectibleTypesMap = new Map<
|
|
127
123
|
CacheFlag,
|
|
128
|
-
|
|
124
|
+
readonly CollectibleType[]
|
|
129
125
|
>();
|
|
130
126
|
|
|
131
127
|
private readonly cacheFlagToTrinketTypesMap = new Map<
|
|
132
128
|
CacheFlag,
|
|
133
|
-
|
|
129
|
+
readonly TrinketType[]
|
|
134
130
|
>();
|
|
135
131
|
|
|
136
|
-
private
|
|
137
|
-
private
|
|
138
|
-
new Set<CollectibleType>();
|
|
132
|
+
private flyingCollectibleTypes: CollectibleType[] = [];
|
|
133
|
+
private permanentFlyingCollectibleTypes: CollectibleType[] = [];
|
|
139
134
|
|
|
140
|
-
private
|
|
135
|
+
private flyingTrinketTypes: TrinketType[] = [];
|
|
141
136
|
|
|
142
137
|
private readonly tagToCollectibleTypesMap = new Map<
|
|
143
138
|
ItemConfigTag,
|
|
144
|
-
|
|
139
|
+
CollectibleType[]
|
|
145
140
|
>();
|
|
146
141
|
|
|
147
142
|
private readonly edenActiveCollectibleTypesSet = new Set<CollectibleType>();
|
|
@@ -149,21 +144,21 @@ export class ModdedElementSets extends Feature {
|
|
|
149
144
|
|
|
150
145
|
private readonly qualityToCollectibleTypesMap = new Map<
|
|
151
146
|
Quality,
|
|
152
|
-
|
|
147
|
+
readonly CollectibleType[]
|
|
153
148
|
>();
|
|
154
149
|
|
|
155
150
|
private readonly itemConfigCardTypeToCardTypeMap = new Map<
|
|
156
151
|
ItemConfigCardType,
|
|
157
|
-
|
|
152
|
+
CardType[]
|
|
158
153
|
>();
|
|
159
154
|
|
|
160
155
|
/**
|
|
161
|
-
* The
|
|
156
|
+
* The array of card types that are not:
|
|
162
157
|
*
|
|
163
158
|
* - ItemConfigCardType.RUNE
|
|
164
159
|
* - ItemConfigCardType.SPECIAL_OBJECT
|
|
165
160
|
*/
|
|
166
|
-
private readonly
|
|
161
|
+
private readonly cardTypeCardArray: CardType[] = [];
|
|
167
162
|
|
|
168
163
|
private readonly moddedElementDetection: ModdedElementDetection;
|
|
169
164
|
|
|
@@ -318,9 +313,9 @@ export class ModdedElementSets extends Feature {
|
|
|
318
313
|
|
|
319
314
|
private lazyInitTagToCollectibleTypesMap() {
|
|
320
315
|
// The tag to collectible types map should be valid for every tag, so we initialize it with
|
|
321
|
-
// empty
|
|
316
|
+
// empty arrays.
|
|
322
317
|
for (const itemConfigTag of ITEM_CONFIG_TAG_VALUES) {
|
|
323
|
-
this.tagToCollectibleTypesMap.set(itemConfigTag,
|
|
318
|
+
this.tagToCollectibleTypesMap.set(itemConfigTag, [] as CollectibleType[]);
|
|
324
319
|
}
|
|
325
320
|
|
|
326
321
|
for (const collectibleType of this.getCollectibleTypes()) {
|
|
@@ -329,92 +324,88 @@ export class ModdedElementSets extends Feature {
|
|
|
329
324
|
continue;
|
|
330
325
|
}
|
|
331
326
|
|
|
332
|
-
const
|
|
327
|
+
const collectibleTypes =
|
|
333
328
|
this.tagToCollectibleTypesMap.get(itemConfigTag);
|
|
334
|
-
if (
|
|
329
|
+
if (collectibleTypes === undefined) {
|
|
335
330
|
const flagName = getFlagName(itemConfigTag, ItemConfigTag);
|
|
336
331
|
error(
|
|
337
332
|
`Failed to get the collectible types for item tag: ${flagName}`,
|
|
338
333
|
);
|
|
339
334
|
}
|
|
340
|
-
|
|
335
|
+
collectibleTypes.push(collectibleType);
|
|
341
336
|
}
|
|
342
337
|
}
|
|
343
338
|
}
|
|
344
339
|
|
|
345
340
|
private lazyInitCacheFlagToCollectibleTypesMap() {
|
|
346
341
|
for (const cacheFlag of CACHE_FLAG_VALUES) {
|
|
347
|
-
const
|
|
342
|
+
const collectibleTypes: CollectibleType[] = [];
|
|
348
343
|
|
|
349
344
|
for (const collectibleType of this.getCollectibleTypes()) {
|
|
350
345
|
if (collectibleHasCacheFlag(collectibleType, cacheFlag)) {
|
|
351
|
-
|
|
346
|
+
collectibleTypes.push(collectibleType);
|
|
352
347
|
}
|
|
353
348
|
}
|
|
354
349
|
|
|
355
|
-
this.cacheFlagToCollectibleTypesMap.set(cacheFlag,
|
|
350
|
+
this.cacheFlagToCollectibleTypesMap.set(cacheFlag, collectibleTypes);
|
|
356
351
|
}
|
|
357
352
|
}
|
|
358
353
|
|
|
359
354
|
private lazyInitCacheFlagToTrinketTypesMap() {
|
|
360
355
|
for (const cacheFlag of CACHE_FLAG_VALUES) {
|
|
361
|
-
const
|
|
356
|
+
const trinketTypes: TrinketType[] = [];
|
|
362
357
|
|
|
363
358
|
for (const trinketType of this.getTrinketTypes()) {
|
|
364
359
|
if (trinketHasCacheFlag(trinketType, cacheFlag)) {
|
|
365
|
-
|
|
360
|
+
trinketTypes.push(trinketType);
|
|
366
361
|
}
|
|
367
362
|
}
|
|
368
363
|
|
|
369
|
-
this.cacheFlagToTrinketTypesMap.set(cacheFlag,
|
|
364
|
+
this.cacheFlagToTrinketTypesMap.set(cacheFlag, trinketTypes);
|
|
370
365
|
}
|
|
371
366
|
}
|
|
372
367
|
|
|
373
368
|
private lazyInitFlyingCollectibleTypesSet() {
|
|
374
369
|
// Instead of manually compiling a list of collectibles that grant flying, we can instead
|
|
375
|
-
// dynamically look for collectibles that have `CacheFlag.FLYING`.
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
);
|
|
386
|
-
deleteSetsFromSet(
|
|
387
|
-
this.flyingCollectibleTypesSet,
|
|
388
|
-
collectiblesWithAllCacheFlag,
|
|
370
|
+
// dynamically look for collectibles that have `CacheFlag.FLYING`. But none of the collectibles
|
|
371
|
+
// with a cache of "all" grant flying (including all of the 3 Dollar Bill collectibles and all
|
|
372
|
+
// of the Birthright effects), so we can safely remove them from the list.
|
|
373
|
+
const collectibleTypesWithFlyingCacheFlag =
|
|
374
|
+
this.getCollectibleTypesWithCacheFlag(CacheFlag.FLYING);
|
|
375
|
+
const collectibleTypesWithAllCacheFlag =
|
|
376
|
+
this.getCollectibleTypesWithCacheFlag(CacheFlag.ALL);
|
|
377
|
+
this.flyingCollectibleTypes = arrayRemove(
|
|
378
|
+
collectibleTypesWithFlyingCacheFlag,
|
|
379
|
+
...collectibleTypesWithAllCacheFlag,
|
|
389
380
|
);
|
|
390
381
|
|
|
391
382
|
// Additionally, create a second set that represents the collectible types that grant flying
|
|
392
383
|
// non-conditionally.
|
|
393
|
-
|
|
394
|
-
this.
|
|
384
|
+
this.permanentFlyingCollectibleTypes = arrayRemove(
|
|
385
|
+
this.flyingCollectibleTypes,
|
|
386
|
+
...CONDITIONAL_FLYING_COLLECTIBLE_TYPES,
|
|
395
387
|
);
|
|
396
|
-
for (const collectibleType of CONDITIONAL_FLYING_COLLECTIBLE_TYPES) {
|
|
397
|
-
permanentFlyingCollectibleTypes.delete(collectibleType);
|
|
398
|
-
}
|
|
399
|
-
for (const collectibleType of permanentFlyingCollectibleTypes) {
|
|
400
|
-
this.permanentFlyingCollectibleTypesSet.add(collectibleType);
|
|
401
|
-
}
|
|
402
388
|
}
|
|
403
389
|
|
|
404
390
|
private lazyInitFlyingTrinketTypesSet() {
|
|
405
391
|
// Instead of manually compiling a list of trinkets that grant flying, we can instead
|
|
406
|
-
// dynamically look for collectibles that have `CacheFlag.FLYING`.
|
|
407
|
-
|
|
408
|
-
|
|
392
|
+
// dynamically look for collectibles that have `CacheFlag.FLYING`. But none of the trinkets with
|
|
393
|
+
// `CacheFlag.ALL` grant flying except for Azazel's Stump, so we can safely remove them from the
|
|
394
|
+
// list.
|
|
395
|
+
const trinketTypesWithFlyingCacheFlag = this.getTrinketsTypesWithCacheFlag(
|
|
396
|
+
CacheFlag.FLYING,
|
|
409
397
|
);
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
const
|
|
414
|
-
|
|
398
|
+
const trinketTypesWithAllCacheFlag = this.getTrinketsTypesWithCacheFlag(
|
|
399
|
+
CacheFlag.ALL,
|
|
400
|
+
);
|
|
401
|
+
const trinketTypesWithAllCacheFlagThatDontGrantFlying = arrayRemove(
|
|
402
|
+
trinketTypesWithAllCacheFlag,
|
|
403
|
+
TrinketType.AZAZELS_STUMP,
|
|
404
|
+
);
|
|
405
|
+
this.flyingTrinketTypes = arrayRemove(
|
|
406
|
+
trinketTypesWithFlyingCacheFlag,
|
|
407
|
+
...trinketTypesWithAllCacheFlagThatDontGrantFlying,
|
|
415
408
|
);
|
|
416
|
-
trinketsWithAllCacheFlag.delete(TrinketType.AZAZELS_STUMP);
|
|
417
|
-
deleteSetsFromSet(this.flyingTrinketTypesSet, trinketsWithAllCacheFlag);
|
|
418
409
|
}
|
|
419
410
|
|
|
420
411
|
private lazyInitEdenCollectibleTypesSet() {
|
|
@@ -438,43 +429,43 @@ export class ModdedElementSets extends Feature {
|
|
|
438
429
|
|
|
439
430
|
private lazyInitQualityToCollectibleTypesMap() {
|
|
440
431
|
for (const quality of QUALITIES) {
|
|
441
|
-
const
|
|
432
|
+
const collectibleTypes: CollectibleType[] = [];
|
|
442
433
|
|
|
443
434
|
for (const collectibleType of this.getCollectibleTypes()) {
|
|
444
435
|
const collectibleTypeQuality = getCollectibleQuality(collectibleType);
|
|
445
436
|
if (collectibleTypeQuality === quality) {
|
|
446
|
-
|
|
437
|
+
collectibleTypes.push(collectibleType);
|
|
447
438
|
}
|
|
448
439
|
}
|
|
449
440
|
|
|
450
|
-
this.qualityToCollectibleTypesMap.set(quality,
|
|
441
|
+
this.qualityToCollectibleTypesMap.set(quality, collectibleTypes);
|
|
451
442
|
}
|
|
452
443
|
}
|
|
453
444
|
|
|
454
445
|
private lazyInitCardTypes() {
|
|
455
446
|
// The card type to cards map should be valid for every card type, so we initialize it with
|
|
456
|
-
// empty
|
|
447
|
+
// empty arrays.
|
|
457
448
|
for (const itemConfigCardType of ITEM_CONFIG_CARD_TYPE_VALUES) {
|
|
458
449
|
this.itemConfigCardTypeToCardTypeMap.set(
|
|
459
450
|
itemConfigCardType,
|
|
460
|
-
|
|
451
|
+
[] as CardType[],
|
|
461
452
|
);
|
|
462
453
|
}
|
|
463
454
|
|
|
464
455
|
for (const cardType of this.getCardTypes()) {
|
|
465
456
|
const itemConfigCardType = getItemConfigCardType(cardType);
|
|
466
457
|
if (itemConfigCardType !== undefined) {
|
|
467
|
-
const
|
|
458
|
+
const cardTypes =
|
|
468
459
|
this.itemConfigCardTypeToCardTypeMap.get(itemConfigCardType);
|
|
469
460
|
assertDefined(
|
|
470
|
-
|
|
471
|
-
`Failed to get the card
|
|
461
|
+
cardTypes,
|
|
462
|
+
`Failed to get the card types for item config card type: ${itemConfigCardType}`,
|
|
472
463
|
);
|
|
473
464
|
|
|
474
|
-
|
|
465
|
+
cardTypes.push(cardType);
|
|
475
466
|
|
|
476
|
-
if (
|
|
477
|
-
this.
|
|
467
|
+
if (ITEM_CONFIG_CARD_TYPES_FOR_CARDS.has(itemConfigCardType)) {
|
|
468
|
+
this.cardTypeCardArray.push(cardType);
|
|
478
469
|
}
|
|
479
470
|
}
|
|
480
471
|
}
|
|
@@ -496,6 +487,8 @@ export class ModdedElementSets extends Feature {
|
|
|
496
487
|
* order).
|
|
497
488
|
*
|
|
498
489
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
490
|
+
*
|
|
491
|
+
* @public
|
|
499
492
|
*/
|
|
500
493
|
@Exported
|
|
501
494
|
public getCollectibleTypes(): readonly CollectibleType[] {
|
|
@@ -515,6 +508,8 @@ export class ModdedElementSets extends Feature {
|
|
|
515
508
|
* order).
|
|
516
509
|
*
|
|
517
510
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
511
|
+
*
|
|
512
|
+
* @public
|
|
518
513
|
*/
|
|
519
514
|
@Exported
|
|
520
515
|
public getCollectibleTypeSet(): ReadonlySet<CollectibleType> {
|
|
@@ -533,6 +528,8 @@ export class ModdedElementSets extends Feature {
|
|
|
533
528
|
* order).
|
|
534
529
|
*
|
|
535
530
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
531
|
+
*
|
|
532
|
+
* @public
|
|
536
533
|
*/
|
|
537
534
|
@Exported
|
|
538
535
|
public getModdedCollectibleTypes(): readonly CollectibleType[] {
|
|
@@ -551,6 +548,8 @@ export class ModdedElementSets extends Feature {
|
|
|
551
548
|
* order).
|
|
552
549
|
*
|
|
553
550
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
551
|
+
*
|
|
552
|
+
* @public
|
|
554
553
|
*/
|
|
555
554
|
@Exported
|
|
556
555
|
public getModdedCollectibleTypesSet(): ReadonlySet<CollectibleType> {
|
|
@@ -569,6 +568,8 @@ export class ModdedElementSets extends Feature {
|
|
|
569
568
|
* order).
|
|
570
569
|
*
|
|
571
570
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
571
|
+
*
|
|
572
|
+
* @public
|
|
572
573
|
*/
|
|
573
574
|
@Exported
|
|
574
575
|
public getPlayerCollectibleMap(
|
|
@@ -624,6 +625,8 @@ export class ModdedElementSets extends Feature {
|
|
|
624
625
|
* order).
|
|
625
626
|
*
|
|
626
627
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
628
|
+
*
|
|
629
|
+
* @public
|
|
627
630
|
*/
|
|
628
631
|
@Exported
|
|
629
632
|
public getTrinketTypes(): readonly TrinketType[] {
|
|
@@ -642,6 +645,8 @@ export class ModdedElementSets extends Feature {
|
|
|
642
645
|
* order).
|
|
643
646
|
*
|
|
644
647
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
648
|
+
*
|
|
649
|
+
* @public
|
|
645
650
|
*/
|
|
646
651
|
@Exported
|
|
647
652
|
public getTrinketTypesSet(): ReadonlySet<TrinketType> {
|
|
@@ -660,6 +665,8 @@ export class ModdedElementSets extends Feature {
|
|
|
660
665
|
* order).
|
|
661
666
|
*
|
|
662
667
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
668
|
+
*
|
|
669
|
+
* @public
|
|
663
670
|
*/
|
|
664
671
|
@Exported
|
|
665
672
|
public getModdedTrinketTypes(): readonly TrinketType[] {
|
|
@@ -678,6 +685,8 @@ export class ModdedElementSets extends Feature {
|
|
|
678
685
|
* order).
|
|
679
686
|
*
|
|
680
687
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
688
|
+
*
|
|
689
|
+
* @public
|
|
681
690
|
*/
|
|
682
691
|
@Exported
|
|
683
692
|
public getModdedTrinketTypesSet(): ReadonlySet<TrinketType> {
|
|
@@ -699,6 +708,8 @@ export class ModdedElementSets extends Feature {
|
|
|
699
708
|
* not all card types will necessarily be present when a mod first loads (due to mod load order).
|
|
700
709
|
*
|
|
701
710
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
711
|
+
*
|
|
712
|
+
* @public
|
|
702
713
|
*/
|
|
703
714
|
@Exported
|
|
704
715
|
public getCardTypes(): readonly CardType[] {
|
|
@@ -716,6 +727,8 @@ export class ModdedElementSets extends Feature {
|
|
|
716
727
|
* not all card types will necessarily be present when a mod first loads (due to mod load order).
|
|
717
728
|
*
|
|
718
729
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
730
|
+
*
|
|
731
|
+
* @public
|
|
719
732
|
*/
|
|
720
733
|
@Exported
|
|
721
734
|
public getCardTypesSet(): ReadonlySet<CardType> {
|
|
@@ -733,6 +746,8 @@ export class ModdedElementSets extends Feature {
|
|
|
733
746
|
* not all card types will necessarily be present when a mod first loads (due to mod load order).
|
|
734
747
|
*
|
|
735
748
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
749
|
+
*
|
|
750
|
+
* @public
|
|
736
751
|
*/
|
|
737
752
|
@Exported
|
|
738
753
|
public getModdedCardTypes(): readonly CardType[] {
|
|
@@ -750,6 +765,8 @@ export class ModdedElementSets extends Feature {
|
|
|
750
765
|
* not all card types will necessarily be present when a mod first loads (due to mod load order).
|
|
751
766
|
*
|
|
752
767
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
768
|
+
*
|
|
769
|
+
* @public
|
|
753
770
|
*/
|
|
754
771
|
@Exported
|
|
755
772
|
public getModdedCardTypesSet(): ReadonlySet<CardType> {
|
|
@@ -772,6 +789,8 @@ export class ModdedElementSets extends Feature {
|
|
|
772
789
|
* order).
|
|
773
790
|
*
|
|
774
791
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
792
|
+
*
|
|
793
|
+
* @public
|
|
775
794
|
*/
|
|
776
795
|
@Exported
|
|
777
796
|
public getPillEffects(): readonly PillEffect[] {
|
|
@@ -790,6 +809,8 @@ export class ModdedElementSets extends Feature {
|
|
|
790
809
|
* order).
|
|
791
810
|
*
|
|
792
811
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
812
|
+
*
|
|
813
|
+
* @public
|
|
793
814
|
*/
|
|
794
815
|
@Exported
|
|
795
816
|
public getPillEffectsSet(): ReadonlySet<PillEffect> {
|
|
@@ -808,6 +829,8 @@ export class ModdedElementSets extends Feature {
|
|
|
808
829
|
* order).
|
|
809
830
|
*
|
|
810
831
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
832
|
+
*
|
|
833
|
+
* @public
|
|
811
834
|
*/
|
|
812
835
|
@Exported
|
|
813
836
|
public getModdedPillEffects(): readonly PillEffect[] {
|
|
@@ -826,6 +849,8 @@ export class ModdedElementSets extends Feature {
|
|
|
826
849
|
* order).
|
|
827
850
|
*
|
|
828
851
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
852
|
+
*
|
|
853
|
+
* @public
|
|
829
854
|
*/
|
|
830
855
|
@Exported
|
|
831
856
|
public getModdedPillEffectsSet(): ReadonlySet<PillEffect> {
|
|
@@ -846,16 +871,18 @@ export class ModdedElementSets extends Feature {
|
|
|
846
871
|
* order).
|
|
847
872
|
*
|
|
848
873
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
874
|
+
*
|
|
875
|
+
* @public
|
|
849
876
|
*/
|
|
850
877
|
@Exported
|
|
851
878
|
public getCollectibleTypesWithCacheFlag(
|
|
852
879
|
cacheFlag: CacheFlag,
|
|
853
|
-
):
|
|
880
|
+
): readonly CollectibleType[] {
|
|
854
881
|
this.lazyInit();
|
|
855
882
|
|
|
856
883
|
const collectiblesSet = this.cacheFlagToCollectibleTypesMap.get(cacheFlag);
|
|
857
884
|
if (collectiblesSet === undefined) {
|
|
858
|
-
return
|
|
885
|
+
return [];
|
|
859
886
|
}
|
|
860
887
|
|
|
861
888
|
return collectiblesSet;
|
|
@@ -870,19 +897,21 @@ export class ModdedElementSets extends Feature {
|
|
|
870
897
|
* order).
|
|
871
898
|
*
|
|
872
899
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
900
|
+
*
|
|
901
|
+
* @public
|
|
873
902
|
*/
|
|
874
903
|
@Exported
|
|
875
904
|
public getTrinketsTypesWithCacheFlag(
|
|
876
905
|
cacheFlag: CacheFlag,
|
|
877
|
-
):
|
|
906
|
+
): readonly TrinketType[] {
|
|
878
907
|
this.lazyInit();
|
|
879
908
|
|
|
880
|
-
const
|
|
881
|
-
if (
|
|
882
|
-
return
|
|
909
|
+
const trinketTypes = this.cacheFlagToTrinketTypesMap.get(cacheFlag);
|
|
910
|
+
if (trinketTypes === undefined) {
|
|
911
|
+
return [];
|
|
883
912
|
}
|
|
884
913
|
|
|
885
|
-
return
|
|
914
|
+
return trinketTypes;
|
|
886
915
|
}
|
|
887
916
|
|
|
888
917
|
/**
|
|
@@ -908,19 +937,19 @@ export class ModdedElementSets extends Feature {
|
|
|
908
937
|
* order).
|
|
909
938
|
*
|
|
910
939
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
940
|
+
*
|
|
941
|
+
* @public
|
|
911
942
|
*/
|
|
912
943
|
@Exported
|
|
913
944
|
public getPlayerCollectiblesWithCacheFlag(
|
|
914
945
|
player: EntityPlayer,
|
|
915
946
|
cacheFlag: CacheFlag,
|
|
916
|
-
): CollectibleType[] {
|
|
947
|
+
): readonly CollectibleType[] {
|
|
917
948
|
const collectiblesWithCacheFlag =
|
|
918
949
|
this.getCollectibleTypesWithCacheFlag(cacheFlag);
|
|
919
950
|
|
|
920
951
|
const playerCollectibles: CollectibleType[] = [];
|
|
921
|
-
for (const collectibleType of
|
|
922
|
-
collectiblesWithCacheFlag,
|
|
923
|
-
)) {
|
|
952
|
+
for (const collectibleType of collectiblesWithCacheFlag) {
|
|
924
953
|
// We specify "true" as the second argument to filter out things like Lilith's Incubus.
|
|
925
954
|
const numCollectibles = player.GetCollectibleNum(collectibleType, true);
|
|
926
955
|
repeat(numCollectibles, () => {
|
|
@@ -940,6 +969,8 @@ export class ModdedElementSets extends Feature {
|
|
|
940
969
|
* order).
|
|
941
970
|
*
|
|
942
971
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
972
|
+
*
|
|
973
|
+
* @public
|
|
943
974
|
*/
|
|
944
975
|
@Exported
|
|
945
976
|
public getPlayerTrinketsWithCacheFlag(
|
|
@@ -980,16 +1011,17 @@ export class ModdedElementSets extends Feature {
|
|
|
980
1011
|
*
|
|
981
1012
|
* @param includeConditionalItems Whether collectibles that only grant flight conditionally should
|
|
982
1013
|
* be included in the set (like Empty Vessel).
|
|
1014
|
+
* @public
|
|
983
1015
|
*/
|
|
984
1016
|
@Exported
|
|
985
1017
|
public getFlyingCollectibleTypes(
|
|
986
1018
|
includeConditionalItems: boolean,
|
|
987
|
-
):
|
|
1019
|
+
): readonly CollectibleType[] {
|
|
988
1020
|
this.lazyInit();
|
|
989
1021
|
|
|
990
1022
|
return includeConditionalItems
|
|
991
|
-
? this.
|
|
992
|
-
: this.
|
|
1023
|
+
? this.flyingCollectibleTypes
|
|
1024
|
+
: this.permanentFlyingCollectibleTypes;
|
|
993
1025
|
}
|
|
994
1026
|
|
|
995
1027
|
/**
|
|
@@ -1005,11 +1037,13 @@ export class ModdedElementSets extends Feature {
|
|
|
1005
1037
|
* order).
|
|
1006
1038
|
*
|
|
1007
1039
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1040
|
+
*
|
|
1041
|
+
* @public
|
|
1008
1042
|
*/
|
|
1009
1043
|
@Exported
|
|
1010
|
-
public getFlyingTrinketTypes():
|
|
1044
|
+
public getFlyingTrinketTypes(): readonly TrinketType[] {
|
|
1011
1045
|
this.lazyInit();
|
|
1012
|
-
return this.
|
|
1046
|
+
return this.flyingTrinketTypes;
|
|
1013
1047
|
}
|
|
1014
1048
|
|
|
1015
1049
|
// ----------------
|
|
@@ -1031,11 +1065,13 @@ export class ModdedElementSets extends Feature {
|
|
|
1031
1065
|
* order).
|
|
1032
1066
|
*
|
|
1033
1067
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1068
|
+
*
|
|
1069
|
+
* @public
|
|
1034
1070
|
*/
|
|
1035
1071
|
@Exported
|
|
1036
1072
|
public getCollectibleTypesWithTag(
|
|
1037
1073
|
itemConfigTag: ItemConfigTag,
|
|
1038
|
-
):
|
|
1074
|
+
): readonly CollectibleType[] {
|
|
1039
1075
|
this.lazyInit();
|
|
1040
1076
|
|
|
1041
1077
|
const collectibleTypes = this.tagToCollectibleTypesMap.get(itemConfigTag);
|
|
@@ -1055,17 +1091,19 @@ export class ModdedElementSets extends Feature {
|
|
|
1055
1091
|
* order).
|
|
1056
1092
|
*
|
|
1057
1093
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1094
|
+
*
|
|
1095
|
+
* @public
|
|
1058
1096
|
*/
|
|
1059
1097
|
@Exported
|
|
1060
1098
|
public getPlayerCollectiblesWithTag(
|
|
1061
1099
|
player: EntityPlayer,
|
|
1062
1100
|
itemConfigTag: ItemConfigTag,
|
|
1063
|
-
): CollectibleType[] {
|
|
1101
|
+
): readonly CollectibleType[] {
|
|
1064
1102
|
const collectibleTypesWithTag =
|
|
1065
1103
|
this.getCollectibleTypesWithTag(itemConfigTag);
|
|
1066
1104
|
|
|
1067
1105
|
const playerCollectibles: CollectibleType[] = [];
|
|
1068
|
-
for (const collectibleType of
|
|
1106
|
+
for (const collectibleType of collectibleTypesWithTag) {
|
|
1069
1107
|
// We specify "true" as the second argument to filter out things like Lilith's Incubus.
|
|
1070
1108
|
const numCollectibles = player.GetCollectibleNum(collectibleType, true);
|
|
1071
1109
|
repeat(numCollectibles, () => {
|
|
@@ -1091,11 +1129,13 @@ export class ModdedElementSets extends Feature {
|
|
|
1091
1129
|
* order).
|
|
1092
1130
|
*
|
|
1093
1131
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1132
|
+
*
|
|
1133
|
+
* @public
|
|
1094
1134
|
*/
|
|
1095
1135
|
@Exported
|
|
1096
1136
|
public getCollectibleTypesForTransformation(
|
|
1097
1137
|
playerForm: PlayerForm,
|
|
1098
|
-
):
|
|
1138
|
+
): readonly CollectibleType[] {
|
|
1099
1139
|
const itemConfigTag = TRANSFORMATION_TO_TAG_MAP.get(playerForm);
|
|
1100
1140
|
assertDefined(
|
|
1101
1141
|
itemConfigTag,
|
|
@@ -1114,19 +1154,19 @@ export class ModdedElementSets extends Feature {
|
|
|
1114
1154
|
* order).
|
|
1115
1155
|
*
|
|
1116
1156
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1157
|
+
*
|
|
1158
|
+
* @public
|
|
1117
1159
|
*/
|
|
1118
1160
|
@Exported
|
|
1119
1161
|
public getPlayerCollectiblesForTransformation(
|
|
1120
1162
|
player: EntityPlayer,
|
|
1121
1163
|
playerForm: PlayerForm,
|
|
1122
|
-
): CollectibleType[] {
|
|
1164
|
+
): readonly CollectibleType[] {
|
|
1123
1165
|
const collectibleForTransformation =
|
|
1124
1166
|
this.getCollectibleTypesForTransformation(playerForm);
|
|
1125
1167
|
|
|
1126
1168
|
const playerCollectibles: CollectibleType[] = [];
|
|
1127
|
-
for (const collectibleType of
|
|
1128
|
-
collectibleForTransformation,
|
|
1129
|
-
)) {
|
|
1169
|
+
for (const collectibleType of collectibleForTransformation) {
|
|
1130
1170
|
// We specify "true" as the second argument to filter out things like Lilith's Incubus.
|
|
1131
1171
|
const numCollectibles = player.GetCollectibleNum(collectibleType, true);
|
|
1132
1172
|
repeat(numCollectibles, () => {
|
|
@@ -1148,6 +1188,8 @@ export class ModdedElementSets extends Feature {
|
|
|
1148
1188
|
* order).
|
|
1149
1189
|
*
|
|
1150
1190
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1191
|
+
*
|
|
1192
|
+
* @public
|
|
1151
1193
|
*/
|
|
1152
1194
|
@Exported
|
|
1153
1195
|
public getEdenActiveCollectibleTypes(): ReadonlySet<CollectibleType> {
|
|
@@ -1166,6 +1208,8 @@ export class ModdedElementSets extends Feature {
|
|
|
1166
1208
|
* order).
|
|
1167
1209
|
*
|
|
1168
1210
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1211
|
+
*
|
|
1212
|
+
* @public
|
|
1169
1213
|
*/
|
|
1170
1214
|
@Exported
|
|
1171
1215
|
public getEdenPassiveCollectibleTypes(): ReadonlySet<CollectibleType> {
|
|
@@ -1189,6 +1233,7 @@ export class ModdedElementSets extends Feature {
|
|
|
1189
1233
|
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
1190
1234
|
* to a random seed.
|
|
1191
1235
|
* @param exceptions Optional. An array of runes to not select.
|
|
1236
|
+
* @public
|
|
1192
1237
|
*/
|
|
1193
1238
|
@Exported
|
|
1194
1239
|
public getRandomEdenActiveCollectibleType(
|
|
@@ -1221,6 +1266,7 @@ export class ModdedElementSets extends Feature {
|
|
|
1221
1266
|
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
1222
1267
|
* to a random seed.
|
|
1223
1268
|
* @param exceptions Optional. An array of runes to not select.
|
|
1269
|
+
* @public
|
|
1224
1270
|
*/
|
|
1225
1271
|
@Exported
|
|
1226
1272
|
public getRandomEdenPassiveCollectibleType(
|
|
@@ -1241,18 +1287,20 @@ export class ModdedElementSets extends Feature {
|
|
|
1241
1287
|
// -------------------
|
|
1242
1288
|
|
|
1243
1289
|
/**
|
|
1244
|
-
* Returns
|
|
1290
|
+
* Returns an array containing every collectible type with the given quality.
|
|
1245
1291
|
*
|
|
1246
1292
|
* This function can only be called if at least one callback has been executed. This is because
|
|
1247
1293
|
* not all collectible types will necessarily be present when a mod first loads (due to mod load
|
|
1248
1294
|
* order).
|
|
1249
1295
|
*
|
|
1250
1296
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1297
|
+
*
|
|
1298
|
+
* @public
|
|
1251
1299
|
*/
|
|
1252
1300
|
@Exported
|
|
1253
1301
|
public getCollectibleTypesOfQuality(
|
|
1254
1302
|
quality: Quality,
|
|
1255
|
-
):
|
|
1303
|
+
): readonly CollectibleType[] {
|
|
1256
1304
|
this.lazyInit();
|
|
1257
1305
|
|
|
1258
1306
|
const collectibleTypes = this.qualityToCollectibleTypesMap.get(quality);
|
|
@@ -1272,27 +1320,27 @@ export class ModdedElementSets extends Feature {
|
|
|
1272
1320
|
* order).
|
|
1273
1321
|
*
|
|
1274
1322
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1323
|
+
*
|
|
1324
|
+
* @public
|
|
1275
1325
|
*/
|
|
1276
1326
|
@Exported
|
|
1277
1327
|
public getPlayerCollectiblesOfQuality(
|
|
1278
1328
|
player: EntityPlayer,
|
|
1279
1329
|
quality: Quality,
|
|
1280
|
-
): CollectibleType[] {
|
|
1330
|
+
): readonly CollectibleType[] {
|
|
1281
1331
|
const collectibleTypesOfQuality =
|
|
1282
1332
|
this.getCollectibleTypesOfQuality(quality);
|
|
1283
1333
|
|
|
1284
|
-
const
|
|
1285
|
-
for (const collectibleType of
|
|
1286
|
-
collectibleTypesOfQuality,
|
|
1287
|
-
)) {
|
|
1334
|
+
const playerCollectibleTypes: CollectibleType[] = [];
|
|
1335
|
+
for (const collectibleType of collectibleTypesOfQuality) {
|
|
1288
1336
|
// We specify "true" as the second argument to filter out things like Lilith's Incubus.
|
|
1289
1337
|
const numCollectibles = player.GetCollectibleNum(collectibleType, true);
|
|
1290
1338
|
repeat(numCollectibles, () => {
|
|
1291
|
-
|
|
1339
|
+
playerCollectibleTypes.push(collectibleType);
|
|
1292
1340
|
});
|
|
1293
1341
|
}
|
|
1294
1342
|
|
|
1295
|
-
return
|
|
1343
|
+
return playerCollectibleTypes;
|
|
1296
1344
|
}
|
|
1297
1345
|
|
|
1298
1346
|
// ----------------------
|
|
@@ -1300,33 +1348,35 @@ export class ModdedElementSets extends Feature {
|
|
|
1300
1348
|
// ----------------------
|
|
1301
1349
|
|
|
1302
1350
|
/**
|
|
1303
|
-
* Helper function to get
|
|
1351
|
+
* Helper function to get an array of card types matching the `ItemConfigCardType`.
|
|
1304
1352
|
*
|
|
1305
|
-
* This function is variadic, meaning that you can you can specify N card types to get
|
|
1353
|
+
* This function is variadic, meaning that you can you can specify N card types to get an array
|
|
1306
1354
|
* containing cards that match any of the specified types.
|
|
1307
1355
|
*
|
|
1308
1356
|
* This function can only be called if at least one callback has been executed. This is because
|
|
1309
1357
|
* not all card types will necessarily be present when a mod first loads (due to mod load order).
|
|
1310
1358
|
*
|
|
1311
1359
|
* In order to use this function, you must upgrade your mod with `ISCFeature.MODDED_ELEMENT_SETS`.
|
|
1360
|
+
*
|
|
1361
|
+
* @public
|
|
1312
1362
|
*/
|
|
1313
1363
|
@Exported
|
|
1314
1364
|
public getCardTypesOfType(
|
|
1315
1365
|
...itemConfigCardTypes: ItemConfigCardType[]
|
|
1316
|
-
):
|
|
1366
|
+
): readonly CardType[] {
|
|
1317
1367
|
this.lazyInit();
|
|
1318
1368
|
|
|
1319
|
-
const matchingCardTypes =
|
|
1369
|
+
const matchingCardTypes: CardType[] = [];
|
|
1320
1370
|
for (const itemConfigCardType of itemConfigCardTypes) {
|
|
1321
|
-
const
|
|
1371
|
+
const cardTypes =
|
|
1322
1372
|
this.itemConfigCardTypeToCardTypeMap.get(itemConfigCardType);
|
|
1323
1373
|
assertDefined(
|
|
1324
|
-
|
|
1325
|
-
`Failed to get the card
|
|
1374
|
+
cardTypes,
|
|
1375
|
+
`Failed to get the card types for item config type: ${itemConfigCardType}`,
|
|
1326
1376
|
);
|
|
1327
1377
|
|
|
1328
|
-
for (const cardType of
|
|
1329
|
-
matchingCardTypes.
|
|
1378
|
+
for (const cardType of cardTypes) {
|
|
1379
|
+
matchingCardTypes.push(cardType);
|
|
1330
1380
|
}
|
|
1331
1381
|
}
|
|
1332
1382
|
|
|
@@ -1350,6 +1400,7 @@ export class ModdedElementSets extends Feature {
|
|
|
1350
1400
|
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
1351
1401
|
* to a random seed.
|
|
1352
1402
|
* @param exceptions Optional. An array of cards to not select.
|
|
1403
|
+
* @public
|
|
1353
1404
|
*/
|
|
1354
1405
|
@Exported
|
|
1355
1406
|
public getRandomCardTypeOfType(
|
|
@@ -1357,8 +1408,8 @@ export class ModdedElementSets extends Feature {
|
|
|
1357
1408
|
seedOrRNG: Seed | RNG | undefined,
|
|
1358
1409
|
exceptions: CardType[] = [],
|
|
1359
1410
|
): CardType {
|
|
1360
|
-
const
|
|
1361
|
-
return
|
|
1411
|
+
const cardTypes = this.getCardTypesOfType(itemConfigCardType);
|
|
1412
|
+
return getRandomArrayElement(cardTypes, seedOrRNG, exceptions);
|
|
1362
1413
|
}
|
|
1363
1414
|
|
|
1364
1415
|
/**
|
|
@@ -1380,6 +1431,7 @@ export class ModdedElementSets extends Feature {
|
|
|
1380
1431
|
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
1381
1432
|
* to a random seed.
|
|
1382
1433
|
* @param exceptions Optional. An array of cards to not select.
|
|
1434
|
+
* @public
|
|
1383
1435
|
*/
|
|
1384
1436
|
@Exported
|
|
1385
1437
|
public getRandomCard(
|
|
@@ -1387,7 +1439,7 @@ export class ModdedElementSets extends Feature {
|
|
|
1387
1439
|
exceptions: CardType[] = [],
|
|
1388
1440
|
): CardType {
|
|
1389
1441
|
this.lazyInit();
|
|
1390
|
-
return
|
|
1442
|
+
return getRandomArrayElement(this.cardTypeCardArray, seedOrRNG, exceptions);
|
|
1391
1443
|
}
|
|
1392
1444
|
|
|
1393
1445
|
/**
|
|
@@ -1406,14 +1458,15 @@ export class ModdedElementSets extends Feature {
|
|
|
1406
1458
|
* `RNG.Next` method will be called. If `undefined` is provided, it will default
|
|
1407
1459
|
* to a random seed.
|
|
1408
1460
|
* @param exceptions Optional. An array of runes to not select.
|
|
1461
|
+
* @public
|
|
1409
1462
|
*/
|
|
1410
1463
|
@Exported
|
|
1411
1464
|
public getRandomRune(
|
|
1412
1465
|
seedOrRNG: Seed | RNG | undefined,
|
|
1413
1466
|
exceptions: CardType[] = [],
|
|
1414
1467
|
): CardType {
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1417
|
-
return
|
|
1468
|
+
const runeCardTypes = this.getCardTypesOfType(ItemConfigCardType.RUNE);
|
|
1469
|
+
exceptions.push(CardType.RUNE_SHARD);
|
|
1470
|
+
return getRandomArrayElement(runeCardTypes, seedOrRNG, exceptions);
|
|
1418
1471
|
}
|
|
1419
1472
|
}
|