isaacscript-common 16.1.6 → 17.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.
Files changed (36) hide show
  1. package/dist/index.d.ts +191 -49
  2. package/dist/isaacscript-common.lua +520 -511
  3. package/dist/src/classes/ModUpgradedBase.d.ts +3 -1
  4. package/dist/src/classes/ModUpgradedBase.d.ts.map +1 -1
  5. package/dist/src/classes/ModUpgradedBase.lua +16 -8
  6. package/dist/src/classes/features/other/ModdedElementSets.d.ts +172 -5
  7. package/dist/src/classes/features/other/ModdedElementSets.d.ts.map +1 -1
  8. package/dist/src/classes/features/other/ModdedElementSets.lua +161 -5
  9. package/dist/src/classes/features/other/Pause.d.ts +1 -0
  10. package/dist/src/classes/features/other/Pause.d.ts.map +1 -1
  11. package/dist/src/classes/features/other/Pause.lua +5 -1
  12. package/dist/src/core/constants.d.ts +3 -1
  13. package/dist/src/core/constants.d.ts.map +1 -1
  14. package/dist/src/core/constants.lua +6 -0
  15. package/dist/src/core/upgradeMod.d.ts.map +1 -1
  16. package/dist/src/core/upgradeMod.lua +7 -0
  17. package/dist/src/functions/cards.d.ts +7 -34
  18. package/dist/src/functions/cards.d.ts.map +1 -1
  19. package/dist/src/functions/cards.lua +20 -119
  20. package/dist/src/functions/globals.d.ts.map +1 -1
  21. package/dist/src/functions/globals.lua +0 -1
  22. package/dist/src/functions/positionVelocity.d.ts.map +1 -1
  23. package/dist/src/functions/positionVelocity.lua +4 -4
  24. package/package.json +2 -2
  25. package/src/classes/ModUpgradedBase.ts +24 -9
  26. package/src/classes/features/other/ModdedElementSets.ts +346 -5
  27. package/src/classes/features/other/Pause.ts +5 -0
  28. package/src/core/constants.ts +9 -0
  29. package/src/core/upgradeMod.ts +10 -0
  30. package/src/functions/cards.ts +20 -139
  31. package/src/functions/globals.ts +0 -1
  32. package/src/functions/positionVelocity.ts +6 -2
  33. package/dist/src/objects/cardTypeToItemConfigCardType.d.ts +0 -6
  34. package/dist/src/objects/cardTypeToItemConfigCardType.d.ts.map +0 -1
  35. package/dist/src/objects/cardTypeToItemConfigCardType.lua +0 -106
  36. package/src/objects/cardTypeToItemConfigCardType.ts +0 -106
@@ -1,15 +1,17 @@
1
1
  local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
2
3
  local Map = ____lualib.Map
3
4
  local __TS__New = ____lualib.__TS__New
4
5
  local __TS__Class = ____lualib.__TS__Class
5
6
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
6
- local Set = ____lualib.Set
7
7
  local __TS__Decorate = ____lualib.__TS__Decorate
8
8
  local __TS__Iterator = ____lualib.__TS__Iterator
9
9
  local ____exports = {}
10
10
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
11
11
  local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
12
+ local CardType = ____isaac_2Dtypescript_2Ddefinitions.CardType
12
13
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
14
+ local ItemConfigCardType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigCardType
13
15
  local ItemConfigTag = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTag
14
16
  local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
15
17
  local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
@@ -17,10 +19,14 @@ local ____cachedClasses = require("src.core.cachedClasses")
17
19
  local itemConfig = ____cachedClasses.itemConfig
18
20
  local ____constants = require("src.core.constants")
19
21
  local FIRST_GLITCHED_COLLECTIBLE_TYPE = ____constants.FIRST_GLITCHED_COLLECTIBLE_TYPE
22
+ local ITEM_CONFIG_CARD_TYPES_FOR_CARDS = ____constants.ITEM_CONFIG_CARD_TYPES_FOR_CARDS
20
23
  local ____decorators = require("src.decorators")
21
24
  local Exported = ____decorators.Exported
22
25
  local ____ISCFeature = require("src.enums.ISCFeature")
23
26
  local ISCFeature = ____ISCFeature.ISCFeature
27
+ local ____cards = require("src.functions.cards")
28
+ local getItemConfigCardType = ____cards.getItemConfigCardType
29
+ local getVanillaCardTypes = ____cards.getVanillaCardTypes
24
30
  local ____collectibles = require("src.functions.collectibles")
25
31
  local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
26
32
  local getVanillaCollectibleTypeRange = ____collectibles.getVanillaCollectibleTypeRange
@@ -80,6 +86,12 @@ function ModdedElementSets.prototype.____constructor(self, moddedElementDetectio
80
86
  self.vanillaTrinketTypesSet = __TS__New(Set)
81
87
  self.moddedTrinketTypesArray = {}
82
88
  self.moddedTrinketTypesSet = __TS__New(Set)
89
+ self.allCardTypesArray = {}
90
+ self.allCardTypesSet = __TS__New(Set)
91
+ self.vanillaCardTypesArray = {}
92
+ self.vanillaCardTypesSet = __TS__New(Set)
93
+ self.moddedCardTypesArray = {}
94
+ self.moddedCardTypesSet = __TS__New(Set)
83
95
  self.tagToCollectibleTypesMap = __TS__New(Map)
84
96
  self.cacheFlagToCollectibleTypesMap = __TS__New(Map)
85
97
  self.cacheFlagToTrinketTypesMap = __TS__New(Map)
@@ -88,6 +100,8 @@ function ModdedElementSets.prototype.____constructor(self, moddedElementDetectio
88
100
  self.flyingTrinketTypesSet = __TS__New(Set)
89
101
  self.edenActiveCollectibleTypesSet = __TS__New(Set)
90
102
  self.edenPassiveCollectibleTypesSet = __TS__New(Set)
103
+ self.itemConfigCardTypeToCardTypeMap = __TS__New(Map)
104
+ self.cardSet = __TS__New(Set)
91
105
  self.featuresUsed = {ISCFeature.MODDED_ELEMENT_DETECTION}
92
106
  self.moddedElementDetection = moddedElementDetection
93
107
  end
@@ -165,6 +179,43 @@ function ModdedElementSets.prototype.lazyInitModdedTrinketTypes(self)
165
179
  end
166
180
  end
167
181
  end
182
+ function ModdedElementSets.prototype.lazyInitVanillaCardTypes(self)
183
+ if #self.vanillaCardTypesArray > 0 then
184
+ return
185
+ end
186
+ local vanillaCardTypes = getVanillaCardTypes(nil)
187
+ for ____, cardType in ipairs(vanillaCardTypes) do
188
+ local itemConfigCard = itemConfig:GetCard(cardType)
189
+ if itemConfigCard ~= nil then
190
+ local ____self_vanillaCardTypesArray_8 = self.vanillaCardTypesArray
191
+ ____self_vanillaCardTypesArray_8[#____self_vanillaCardTypesArray_8 + 1] = cardType
192
+ self.vanillaCardTypesSet:add(cardType)
193
+ end
194
+ end
195
+ end
196
+ function ModdedElementSets.prototype.lazyInitModdedCardTypes(self)
197
+ if #self.moddedCardTypesArray > 0 then
198
+ return
199
+ end
200
+ self:lazyInitVanillaCardTypes()
201
+ for ____, cardType in ipairs(self.vanillaCardTypesArray) do
202
+ local ____self_allCardTypesArray_9 = self.allCardTypesArray
203
+ ____self_allCardTypesArray_9[#____self_allCardTypesArray_9 + 1] = cardType
204
+ self.allCardTypesSet:add(cardType)
205
+ end
206
+ local moddedCardTypes = self.moddedElementDetection:getModdedCardTypes()
207
+ for ____, cardType in ipairs(moddedCardTypes) do
208
+ local itemConfigCard = itemConfig:GetCard(cardType)
209
+ if itemConfigCard ~= nil then
210
+ local ____self_moddedCardTypesArray_10 = self.moddedCardTypesArray
211
+ ____self_moddedCardTypesArray_10[#____self_moddedCardTypesArray_10 + 1] = cardType
212
+ self.moddedCardTypesSet:add(cardType)
213
+ local ____self_allCardTypesArray_11 = self.allCardTypesArray
214
+ ____self_allCardTypesArray_11[#____self_allCardTypesArray_11 + 1] = cardType
215
+ self.allCardTypesSet:add(cardType)
216
+ end
217
+ end
218
+ end
168
219
  function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
169
220
  if self.tagToCollectibleTypesMap.size > 0 then
170
221
  return
@@ -179,7 +230,7 @@ function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
179
230
  for ____, itemConfigTag in ipairs(getEnumValues(nil, ItemConfigTag)) do
180
231
  do
181
232
  if not collectibleHasTag(nil, collectibleType, itemConfigTag) then
182
- goto __continue32
233
+ goto __continue44
183
234
  end
184
235
  local collectibleTypesSet = self.tagToCollectibleTypesMap:get(itemConfigTag)
185
236
  if collectibleTypesSet == nil then
@@ -188,7 +239,7 @@ function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
188
239
  end
189
240
  collectibleTypesSet:add(collectibleType)
190
241
  end
191
- ::__continue32::
242
+ ::__continue44::
192
243
  end
193
244
  end
194
245
  end
@@ -257,7 +308,7 @@ function ModdedElementSets.prototype.lazyInitEdenCollectibleTypesSet(self)
257
308
  for ____, collectibleType in ipairs(self:getCollectibleArray()) do
258
309
  do
259
310
  if isHiddenCollectible(nil, collectibleType) or collectibleHasTag(nil, collectibleType, ItemConfigTag.NO_EDEN) then
260
- goto __continue59
311
+ goto __continue71
261
312
  end
262
313
  if isActiveCollectible(nil, collectibleType) then
263
314
  self.edenActiveCollectibleTypesSet:add(collectibleType)
@@ -266,8 +317,57 @@ function ModdedElementSets.prototype.lazyInitEdenCollectibleTypesSet(self)
266
317
  self.edenPassiveCollectibleTypesSet:add(collectibleType)
267
318
  end
268
319
  end
269
- ::__continue59::
320
+ ::__continue71::
321
+ end
322
+ end
323
+ function ModdedElementSets.prototype.lazyInitCardTypes(self)
324
+ if self.itemConfigCardTypeToCardTypeMap.size > 0 then
325
+ return
326
+ end
327
+ for ____, itemConfigCardType in ipairs(getEnumValues(nil, ItemConfigCardType)) do
328
+ self.itemConfigCardTypeToCardTypeMap:set(
329
+ itemConfigCardType,
330
+ __TS__New(Set)
331
+ )
332
+ end
333
+ for ____, cardType in ipairs(self:getCardArray()) do
334
+ local itemConfigCardType = getItemConfigCardType(nil, cardType)
335
+ if itemConfigCardType ~= nil then
336
+ local cardTypeSet = self.itemConfigCardTypeToCardTypeMap:get(itemConfigCardType)
337
+ if cardTypeSet == nil then
338
+ error("Failed to get the card set for item config card type: " .. tostring(itemConfigCardType))
339
+ end
340
+ cardTypeSet:add(cardType)
341
+ if ITEM_CONFIG_CARD_TYPES_FOR_CARDS:has(itemConfigCardType) then
342
+ self.cardSet:add(cardType)
343
+ end
344
+ end
345
+ end
346
+ end
347
+ function ModdedElementSets.prototype.getCardArray(self)
348
+ self:lazyInitModdedCardTypes()
349
+ return self.allCardTypesArray
350
+ end
351
+ function ModdedElementSets.prototype.getCardSet(self)
352
+ self:lazyInitModdedCardTypes()
353
+ return self.allCardTypesSet
354
+ end
355
+ function ModdedElementSets.prototype.getCardTypesOfType(self, ...)
356
+ local itemConfigCardTypes = {...}
357
+ if self.itemConfigCardTypeToCardTypeMap.size == 0 then
358
+ self:lazyInitCardTypes()
359
+ end
360
+ local matchingCardTypes = __TS__New(Set)
361
+ for ____, itemConfigCardType in ipairs(itemConfigCardTypes) do
362
+ local cardTypeSet = self.itemConfigCardTypeToCardTypeMap:get(itemConfigCardType)
363
+ if cardTypeSet == nil then
364
+ error("Failed to get the card type set for item config type: " .. tostring(itemConfigCardType))
365
+ end
366
+ for ____, cardType in __TS__Iterator(cardTypeSet:values()) do
367
+ matchingCardTypes:add(cardType)
368
+ end
270
369
  end
370
+ return matchingCardTypes
271
371
  end
272
372
  function ModdedElementSets.prototype.getCollectibleArray(self)
273
373
  self:lazyInitModdedCollectibleTypes()
@@ -316,6 +416,14 @@ function ModdedElementSets.prototype.getFlyingTrinkets(self)
316
416
  self:lazyInitFlyingTrinketTypesSet()
317
417
  return self.flyingTrinketTypesSet
318
418
  end
419
+ function ModdedElementSets.prototype.getModdedCardArray(self)
420
+ self:lazyInitModdedCardTypes()
421
+ return self.moddedCardTypesArray
422
+ end
423
+ function ModdedElementSets.prototype.getModdedCardSet(self)
424
+ self:lazyInitModdedCardTypes()
425
+ return self.moddedCardTypesSet
426
+ end
319
427
  function ModdedElementSets.prototype.getModdedCollectibleArray(self)
320
428
  self:lazyInitModdedCollectibleTypes()
321
429
  return self.moddedCollectibleTypesArray
@@ -415,6 +523,36 @@ function ModdedElementSets.prototype.getPlayerTrinketsWithCacheFlag(self, player
415
523
  end
416
524
  return playerTrinkets
417
525
  end
526
+ function ModdedElementSets.prototype.getRandomCard(self, seedOrRNG, exceptions)
527
+ if seedOrRNG == nil then
528
+ seedOrRNG = getRandomSeed(nil)
529
+ end
530
+ if exceptions == nil then
531
+ exceptions = {}
532
+ end
533
+ return getRandomSetElement(nil, self.cardSet, seedOrRNG, exceptions)
534
+ end
535
+ function ModdedElementSets.prototype.getRandomCardTypeOfType(self, itemConfigCardType, seedOrRNG, exceptions)
536
+ if seedOrRNG == nil then
537
+ seedOrRNG = getRandomSeed(nil)
538
+ end
539
+ if exceptions == nil then
540
+ exceptions = {}
541
+ end
542
+ local cardTypeSet = self:getCardTypesOfType(itemConfigCardType)
543
+ return getRandomSetElement(nil, cardTypeSet, seedOrRNG, exceptions)
544
+ end
545
+ function ModdedElementSets.prototype.getRandomRune(self, seedOrRNG, exceptions)
546
+ if seedOrRNG == nil then
547
+ seedOrRNG = getRandomSeed(nil)
548
+ end
549
+ if exceptions == nil then
550
+ exceptions = {}
551
+ end
552
+ local runesSet = self:getCardTypesOfType(ItemConfigCardType.RUNE)
553
+ runesSet:delete(CardType.RUNE_SHARD)
554
+ return getRandomSetElement(nil, runesSet, seedOrRNG, exceptions)
555
+ end
418
556
  function ModdedElementSets.prototype.getRandomEdenActiveCollectible(self, seedOrRNG, exceptions)
419
557
  if seedOrRNG == nil then
420
558
  seedOrRNG = getRandomSeed(nil)
@@ -451,6 +589,14 @@ function ModdedElementSets.prototype.getTrinketsWithCacheFlag(self, cacheFlag)
451
589
  end
452
590
  return trinketsSet
453
591
  end
592
+ function ModdedElementSets.prototype.getVanillaCardArray(self)
593
+ self:lazyInitVanillaCardTypes()
594
+ return self.vanillaCardTypesArray
595
+ end
596
+ function ModdedElementSets.prototype.getVanillaCardSet(self)
597
+ self:lazyInitVanillaCardTypes()
598
+ return self.vanillaCardTypesSet
599
+ end
454
600
  function ModdedElementSets.prototype.getVanillaCollectibleArray(self)
455
601
  self:lazyInitVanillaCollectibleTypes()
456
602
  return self.vanillaCollectibleTypesArray
@@ -467,6 +613,9 @@ function ModdedElementSets.prototype.getVanillaTrinketSet(self)
467
613
  self:lazyInitVanillaTrinketTypes()
468
614
  return self.vanillaTrinketTypesSet
469
615
  end
616
+ __TS__Decorate({Exported}, ModdedElementSets.prototype, "getCardArray", true)
617
+ __TS__Decorate({Exported}, ModdedElementSets.prototype, "getCardSet", true)
618
+ __TS__Decorate({Exported}, ModdedElementSets.prototype, "getCardTypesOfType", true)
470
619
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getCollectibleArray", true)
471
620
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getCollectibleSet", true)
472
621
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getCollectiblesForTransformation", true)
@@ -476,6 +625,8 @@ __TS__Decorate({Exported}, ModdedElementSets.prototype, "getEdenActiveCollectibl
476
625
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getEdenPassiveCollectibles", true)
477
626
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getFlyingCollectibles", true)
478
627
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getFlyingTrinkets", true)
628
+ __TS__Decorate({Exported}, ModdedElementSets.prototype, "getModdedCardArray", true)
629
+ __TS__Decorate({Exported}, ModdedElementSets.prototype, "getModdedCardSet", true)
479
630
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getModdedCollectibleArray", true)
480
631
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getModdedCollectibleSet", true)
481
632
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getModdedTrinketArray", true)
@@ -485,11 +636,16 @@ __TS__Decorate({Exported}, ModdedElementSets.prototype, "getPlayerCollectiblesWi
485
636
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getPlayerCollectiblesWithTag", true)
486
637
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getPlayerCollectiblesForTransformation", true)
487
638
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getPlayerTrinketsWithCacheFlag", true)
639
+ __TS__Decorate({Exported}, ModdedElementSets.prototype, "getRandomCard", true)
640
+ __TS__Decorate({Exported}, ModdedElementSets.prototype, "getRandomCardTypeOfType", true)
641
+ __TS__Decorate({Exported}, ModdedElementSets.prototype, "getRandomRune", true)
488
642
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getRandomEdenActiveCollectible", true)
489
643
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getRandomEdenPassiveCollectible", true)
490
644
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getTrinketArray", true)
491
645
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getTrinketSet", true)
492
646
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getTrinketsWithCacheFlag", true)
647
+ __TS__Decorate({Exported}, ModdedElementSets.prototype, "getVanillaCardArray", true)
648
+ __TS__Decorate({Exported}, ModdedElementSets.prototype, "getVanillaCardSet", true)
493
649
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getVanillaCollectibleArray", true)
494
650
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getVanillaCollectibleSet", true)
495
651
  __TS__Decorate({Exported}, ModdedElementSets.prototype, "getVanillaTrinketArray", true)
@@ -4,6 +4,7 @@ export declare class Pause extends Feature {
4
4
  private postUpdate;
5
5
  private stopTearsAndProjectilesFromMoving;
6
6
  private inputActionGetActionValue;
7
+ isPaused(): boolean;
7
8
  /**
8
9
  * Helper function to emulate what happens when the player pauses the game. Use the `unpause`
9
10
  * function to return things back to normal.
@@ -1 +1 @@
1
- {"version":3,"file":"Pause.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/Pause.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAYhD,qBAAa,KAAM,SAAQ,OAAO;IAUhC,OAAO,CAAC,aAAa,CAAgB;IAkBrC,OAAO,CAAC,UAAU,CAShB;IAEF,OAAO,CAAC,iCAAiC;IA0BzC,OAAO,CAAC,yBAAyB,CAiB/B;IAEF;;;;;;;;;;OAUG;IAEI,KAAK,IAAI,IAAI;IAwDpB;;;;OAIG;IAEI,OAAO,IAAI,IAAI;CA4BvB"}
1
+ {"version":3,"file":"Pause.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/Pause.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAYhD,qBAAa,KAAM,SAAQ,OAAO;IAUhC,OAAO,CAAC,aAAa,CAAgB;IAkBrC,OAAO,CAAC,UAAU,CAShB;IAEF,OAAO,CAAC,iCAAiC;IA0BzC,OAAO,CAAC,yBAAyB,CAiB/B;IAGK,QAAQ,IAAI,OAAO;IAI1B;;;;;;;;;;OAUG;IAEI,KAAK,IAAI,IAAI;IAwDpB;;;;OAIG;IAEI,OAAO,IAAI,IAAI;CA4BvB"}
@@ -6,8 +6,8 @@ local __TS__New = ____lualib.__TS__New
6
6
  local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
7
7
  local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
8
8
  local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
9
- local Set = ____lualib.Set
10
9
  local __TS__Decorate = ____lualib.__TS__Decorate
10
+ local Set = ____lualib.Set
11
11
  local ____exports = {}
12
12
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
13
13
  local ButtonAction = ____isaac_2Dtypescript_2Ddefinitions.ButtonAction
@@ -95,6 +95,9 @@ function Pause.prototype.stopTearsAndProjectilesFromMoving(self)
95
95
  ::__continue9::
96
96
  end
97
97
  end
98
+ function Pause.prototype.isPaused(self)
99
+ return self.v.run.isPseudoPaused
100
+ end
98
101
  function Pause.prototype.pause(self)
99
102
  if self.v.run.isPseudoPaused then
100
103
  logError(nil, "Failed to pseudo-pause the game, since it was already pseudo-paused.")
@@ -152,6 +155,7 @@ function Pause.prototype.unpause(self)
152
155
  removeAllTears(nil)
153
156
  removeAllProjectiles(nil)
154
157
  end
158
+ __TS__Decorate({Exported}, Pause.prototype, "isPaused", true)
155
159
  __TS__Decorate({Exported}, Pause.prototype, "pause", true)
156
160
  __TS__Decorate({Exported}, Pause.prototype, "unpause", true)
157
161
  return ____exports
@@ -1,4 +1,4 @@
1
- import { ItemPoolType } from "isaac-typescript-definitions";
1
+ import { ItemConfigCardType, ItemPoolType } from "isaac-typescript-definitions";
2
2
  /**
3
3
  * The combination of the following flags:
4
4
  * - `DisplayFlag.VISIBLE` (1 << 0)
@@ -50,6 +50,8 @@ export declare const EMPTY_PNG_PATH = "gfx/none.png";
50
50
  export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: import("isaac-typescript-definitions").CollectibleType;
51
51
  /** Game frames are what is returned by the `Game.GetFrameCount` method. */
52
52
  export declare const GAME_FRAMES_PER_SECOND = 30;
53
+ /** The set of all `ItemConfigCardType` values that are not a rune or special object. */
54
+ export declare const ITEM_CONFIG_CARD_TYPES_FOR_CARDS: Set<ItemConfigCardType>;
53
55
  /** Render frames are what is returned by the `Isaac.GetFrameCount` method. */
54
56
  export declare const RENDER_FRAMES_PER_SECOND = 60;
55
57
  export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAEb,MAAM,8BAA8B,CAAC;AAMtC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;EAI7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iCAAiC,SAAS,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,4CAA4C,CAAC;AAE7E,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,iGAAiG;AACjG,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,sBAAsB,wBAAwB,CAAC;AAE5D,gGAAgG;AAChG,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,eAAO,MAAM,kBAAk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,eAAO,MAAM,sBAAsB,QAA8B,CAAC;AAElE,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,6FAA6F;AAC7F,eAAO,MAAM,gDAAgD,QAAQ,CAAC;AAEtE,4CAA4C;AAC5C,eAAO,MAAM,8BAA8B,QAA4B,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAgB,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAgB,CAAC;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAkB,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAsB,CAAC"}
@@ -1,7 +1,11 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
1
4
  local ____exports = {}
2
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
6
  local Dimension = ____isaac_2Dtypescript_2Ddefinitions.Dimension
4
7
  local DisplayFlag = ____isaac_2Dtypescript_2Ddefinitions.DisplayFlag
8
+ local ItemConfigCardType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigCardType
5
9
  local ItemPoolType = ____isaac_2Dtypescript_2Ddefinitions.ItemPoolType
6
10
  local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
7
11
  local ____enums = require("src.functions.enums")
@@ -47,6 +51,8 @@ ____exports.EMPTY_PNG_PATH = "gfx/none.png"
47
51
  ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = asCollectibleType(nil, (1 << 32) - 1)
48
52
  --- Game frames are what is returned by the `Game.GetFrameCount` method.
49
53
  ____exports.GAME_FRAMES_PER_SECOND = 30
54
+ --- The set of all `ItemConfigCardType` values that are not a rune or special object.
55
+ ____exports.ITEM_CONFIG_CARD_TYPES_FOR_CARDS = __TS__New(Set, {ItemConfigCardType.TAROT, ItemConfigCardType.SUIT, ItemConfigCardType.SPECIAL, ItemConfigCardType.TAROT_REVERSE})
50
56
  --- Render frames are what is returned by the `Isaac.GetFrameCount` method.
51
57
  ____exports.RENDER_FRAMES_PER_SECOND = 60
52
58
  ____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
@@ -1 +1 @@
1
- {"version":3,"file":"upgradeMod.d.ts","sourceRoot":"","sources":["../../../src/core/upgradeMod.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,KAAK,eAAe,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,IAClD,UAAU,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC1B,8FAA8F,GAC9F,CAAC,CAAC;AAER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,GAAG,KAAK,EAAE,EAClE,UAAU,EAAE,GAAG,EACf,QAAQ,GAAE,eAAe,CAAC,CAAC,CAAuC,EAClE,mBAAmB,GAAE,iBAAiB,EAAE,GAAG,SAAS,iBAAiB,EAAO,EAC5E,KAAK,UAAQ,EACb,aAAa,CAAC,EAAE,KAAK,GACpB,WAAW,CAAC,CAAC,CAAC,CAShB"}
1
+ {"version":3,"file":"upgradeMod.d.ts","sourceRoot":"","sources":["../../../src/core/upgradeMod.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,KAAK,eAAe,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,IAClD,UAAU,SAAS,CAAC,CAAC,QAAQ,CAAC,GAC1B,8FAA8F,GAC9F,CAAC,CAAC;AAER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,GAAG,KAAK,EAAE,EAClE,UAAU,EAAE,GAAG,EACf,QAAQ,GAAE,eAAe,CAAC,CAAC,CAAuC,EAClE,mBAAmB,GAAE,iBAAiB,EAAE,GAAG,SAAS,iBAAiB,EAAO,EAC5E,KAAK,UAAQ,EACb,aAAa,CAAC,EAAE,KAAK,GACpB,WAAW,CAAC,CAAC,CAAC,CAmBhB"}
@@ -1,4 +1,5 @@
1
1
  local ____lualib = require("lualib_bundle")
2
+ local __TS__Iterator = ____lualib.__TS__Iterator
2
3
  local __TS__New = ____lualib.__TS__New
3
4
  local ____exports = {}
4
5
  local initOptionalFeatures, initCallbacksEarly
@@ -67,6 +68,12 @@ function ____exports.upgradeMod(self, modVanilla, features, customCallbacksUsed,
67
68
  if ____debug == nil then
68
69
  ____debug = false
69
70
  end
71
+ for ____, feature in __TS__Iterator(features) do
72
+ local featureType = type(feature)
73
+ if featureType ~= "number" then
74
+ error(("Failed to upgrade the mod due to one of the specified features being of type \"" .. featureType) .. "\". (All of the features should be numbers represented by the \"ISCFeature\" enum.)")
75
+ end
76
+ end
70
77
  patchErrorFunction(nil)
71
78
  local mod = __TS__New(ModUpgradedBase, modVanilla, ____debug, timeThreshold)
72
79
  applyShaderCrashFix(nil, mod)
@@ -12,45 +12,18 @@ export declare function getCardDescription(cardType: CardType): string;
12
12
  */
13
13
  export declare function getCardName(cardType: CardType): string;
14
14
  /**
15
- * Helper function to get a set of card types matching the `ItemConfigCardType`.
15
+ * Helper function to get the item config card type of a particular card, rune, or object. For
16
+ * example, the item config card type of `CardType.FOOL` is equal to `ItemConfigCardType.TAROT`.
16
17
  *
17
- * This function is variadic, meaning that you can you can specify N card types to get a set
18
- * containing cards that match any of the specified types.
18
+ * Returns undefined if the provided card type was not valid.
19
19
  */
20
- export declare function getCardTypesOfType(...itemConfigCardTypes: ItemConfigCardType[]): Set<CardType>;
21
- export declare function getItemConfigCardType(cardType: CardType): ItemConfigCardType;
20
+ export declare function getItemConfigCardType(cardType: CardType): ItemConfigCardType | undefined;
22
21
  /**
23
- * Has an equal chance of returning any card (e.g. Fool, Reverse Fool, Wild Card, etc.).
22
+ * Helper function to get an array with every valid vanilla card sub-type.
24
23
  *
25
- * This will not return:
26
- * - any runes
27
- * - any objects like Dice Shard
28
- * - any modded cards (since there is not a way to distinguish between modded cards and modded
29
- * runes/objects)
30
- *
31
- * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
32
- * `RNG.Next` method will be called. Default is `getRandomSeed()`.
33
- * @param exceptions Optional. An array of cards to not select.
34
- */
35
- export declare function getRandomCard(seedOrRNG?: Seed | RNG, exceptions?: CardType[]): CardType;
36
- /**
37
- * @param itemConfigCardType The item config card type that represents the pool of cards to select
38
- * from.
39
- * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
40
- * `RNG.Next` method will be called. Default is `getRandomSeed()`.
41
- * @param exceptions Optional. An array of cards to not select.
42
- */
43
- export declare function getRandomCardTypeOfType(itemConfigCardType: ItemConfigCardType, seedOrRNG?: Seed | RNG, exceptions?: CardType[]): CardType;
44
- /**
45
- * Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul of
46
- * Isaac, etc.). This will never return a Rune Shard.
47
- *
48
- * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
49
- * `RNG.Next` method will be called. Default is `getRandomSeed()`.
50
- * @param exceptions Optional. An array of runes to not select.
24
+ * Note that unlike collectibles and trinkets, there are no gaps in the card types, so this is a
25
+ * simple range from the first card type to the last vanilla card type.
51
26
  */
52
- export declare function getRandomRune(seedOrRNG?: Seed | RNG, exceptions?: CardType[]): CardType;
53
- /** Helper function to get an array with every valid vanilla card sub-type. */
54
27
  export declare function getVanillaCardTypes(): CardType[];
55
28
  /**
56
29
  * Returns true for cards that have the following card type:
@@ -1 +1 @@
1
- {"version":3,"file":"cards.d.ts","sourceRoot":"","sources":["../../../src/functions/cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAkE5E;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAgB7D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAgBtD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,mBAAmB,EAAE,kBAAkB,EAAE,GAC3C,GAAG,CAAC,QAAQ,CAAC,CAqBf;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,kBAAkB,CAQ5E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAC3B,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,UAAU,GAAE,QAAQ,EAAO,GAC1B,QAAQ,CAEV;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,kBAAkB,EAAE,kBAAkB,EACtC,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,UAAU,GAAE,QAAQ,EAAO,GAC1B,QAAQ,CAGV;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,SAAS,GAAE,IAAI,GAAG,GAAqB,EACvC,UAAU,GAAE,QAAQ,EAAO,GAC1B,QAAQ,CAIV;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,IAAI,QAAQ,EAAE,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO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AED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAOlD;AAED,8FAA8F;AAC9F,wBAAgB,UAAU,CACxB,QAAQ,EAAE,QAAQ,EAClB,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAET;AAED,wDAAwD;AACxD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE5D;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE9D;AAED,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE9D;AAED,wDAAwD;AACxD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAElD;AAED,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEzD;AAED,wDAAwD;AACxD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEtD;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAEvD;AAED,iDAAiD;AACjD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE7D"}
@@ -1,15 +1,12 @@
1
1
  local ____lualib = require("lualib_bundle")
2
- local Map = ____lualib.Map
3
- local __TS__New = ____lualib.__TS__New
4
2
  local Set = ____lualib.Set
5
- local __TS__Iterator = ____lualib.__TS__Iterator
6
3
  local ____exports = {}
7
- local lazyInitCardMapsSets, ITEM_CONFIG_CARD_TYPE_TO_CARD_TYPE_MAP, CARD_SET
8
4
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
9
- local CardType = ____isaac_2Dtypescript_2Ddefinitions.CardType
10
5
  local ItemConfigCardType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigCardType
11
6
  local ____cachedClasses = require("src.core.cachedClasses")
12
7
  local itemConfig = ____cachedClasses.itemConfig
8
+ local ____constants = require("src.core.constants")
9
+ local ITEM_CONFIG_CARD_TYPES_FOR_CARDS = ____constants.ITEM_CONFIG_CARD_TYPES_FOR_CARDS
13
10
  local ____constantsFirstLast = require("src.core.constantsFirstLast")
14
11
  local FIRST_CARD_TYPE = ____constantsFirstLast.FIRST_CARD_TYPE
15
12
  local LAST_VANILLA_CARD_TYPE = ____constantsFirstLast.LAST_VANILLA_CARD_TYPE
@@ -19,77 +16,12 @@ local DEFAULT_CARD_DESCRIPTION = ____cardDescriptions.DEFAULT_CARD_DESCRIPTION
19
16
  local ____cardNames = require("src.objects.cardNames")
20
17
  local CARD_NAMES = ____cardNames.CARD_NAMES
21
18
  local DEFAULT_CARD_NAME = ____cardNames.DEFAULT_CARD_NAME
22
- local ____cardTypeToItemConfigCardType = require("src.objects.cardTypeToItemConfigCardType")
23
- local CARD_TYPE_TO_ITEM_CONFIG_CARD_TYPE = ____cardTypeToItemConfigCardType.CARD_TYPE_TO_ITEM_CONFIG_CARD_TYPE
24
- local DEFAULT_CARD_TYPE = ____cardTypeToItemConfigCardType.DEFAULT_CARD_TYPE
25
- local ____enums = require("src.functions.enums")
26
- local getEnumValues = ____enums.getEnumValues
27
- local ____rng = require("src.functions.rng")
28
- local getRandomSeed = ____rng.getRandomSeed
29
- local ____set = require("src.functions.set")
30
- local addSetsToSet = ____set.addSetsToSet
31
- local getRandomSetElement = ____set.getRandomSetElement
32
19
  local ____utils = require("src.functions.utils")
33
20
  local iRange = ____utils.iRange
34
- function lazyInitCardMapsSets(self)
35
- for ____, cardType in ipairs(getEnumValues(nil, ItemConfigCardType)) do
36
- ITEM_CONFIG_CARD_TYPE_TO_CARD_TYPE_MAP:set(
37
- cardType,
38
- __TS__New(Set)
39
- )
40
- end
41
- for ____, card in ipairs(____exports.getVanillaCardTypes(nil)) do
42
- local itemConfigCardType = ____exports.getItemConfigCardType(nil, card)
43
- local cardTypeSet = ITEM_CONFIG_CARD_TYPE_TO_CARD_TYPE_MAP:get(itemConfigCardType)
44
- if cardTypeSet == nil then
45
- error("Failed to get the card set for item config card type: " .. tostring(itemConfigCardType))
46
- end
47
- cardTypeSet:add(card)
48
- end
49
- local cards = ____exports.getCardTypesOfType(
50
- nil,
51
- ItemConfigCardType.TAROT,
52
- ItemConfigCardType.SUIT,
53
- ItemConfigCardType.SPECIAL,
54
- ItemConfigCardType.TAROT_REVERSE
55
- )
56
- addSetsToSet(nil, CARD_SET, cards)
57
- end
58
- --- Helper function to get a set of card types matching the `ItemConfigCardType`.
59
- --
60
- -- This function is variadic, meaning that you can you can specify N card types to get a set
61
- -- containing cards that match any of the specified types.
62
- function ____exports.getCardTypesOfType(self, ...)
63
- local itemConfigCardTypes = {...}
64
- if ITEM_CONFIG_CARD_TYPE_TO_CARD_TYPE_MAP.size == 0 then
65
- lazyInitCardMapsSets(nil)
66
- end
67
- local matchingCardTypes = __TS__New(Set)
68
- for ____, itemConfigCardType in ipairs(itemConfigCardTypes) do
69
- local cardTypeSet = ITEM_CONFIG_CARD_TYPE_TO_CARD_TYPE_MAP:get(itemConfigCardType)
70
- if cardTypeSet == nil then
71
- error("Failed to get the card type set for item config type: " .. tostring(itemConfigCardType))
72
- end
73
- for ____, cardType in __TS__Iterator(cardTypeSet:values()) do
74
- matchingCardTypes:add(cardType)
75
- end
76
- end
77
- return matchingCardTypes
78
- end
79
- function ____exports.getItemConfigCardType(self, cardType)
80
- local itemConfigCardType = CARD_TYPE_TO_ITEM_CONFIG_CARD_TYPE[cardType]
81
- return itemConfigCardType == nil and DEFAULT_CARD_TYPE or itemConfigCardType
82
- end
83
- --- Helper function to get an array with every valid vanilla card sub-type.
84
- function ____exports.getVanillaCardTypes(self)
85
- return iRange(nil, FIRST_CARD_TYPE, LAST_VANILLA_CARD_TYPE)
86
- end
87
21
  --- Returns true for any vanilla card or rune.
88
22
  function ____exports.isVanillaCardType(self, cardType)
89
23
  return cardType <= LAST_VANILLA_CARD_TYPE
90
24
  end
91
- ITEM_CONFIG_CARD_TYPE_TO_CARD_TYPE_MAP = __TS__New(Map)
92
- CARD_SET = __TS__New(Set)
93
25
  --- Helper function to get a card description from a Card enum value.
94
26
  --
95
27
  -- For example, `getCardDescription(card)` returns "Where journey begins".
@@ -118,58 +50,23 @@ function ____exports.getCardName(self, cardType)
118
50
  end
119
51
  return DEFAULT_CARD_NAME
120
52
  end
121
- --- Has an equal chance of returning any card (e.g. Fool, Reverse Fool, Wild Card, etc.).
53
+ --- Helper function to get the item config card type of a particular card, rune, or object. For
54
+ -- example, the item config card type of `CardType.FOOL` is equal to `ItemConfigCardType.TAROT`.
122
55
  --
123
- -- This will not return:
124
- -- - any runes
125
- -- - any objects like Dice Shard
126
- -- - any modded cards (since there is not a way to distinguish between modded cards and modded
127
- -- runes/objects)
128
- --
129
- -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
130
- -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
131
- -- @param exceptions Optional. An array of cards to not select.
132
- function ____exports.getRandomCard(self, seedOrRNG, exceptions)
133
- if seedOrRNG == nil then
134
- seedOrRNG = getRandomSeed(nil)
135
- end
136
- if exceptions == nil then
137
- exceptions = {}
138
- end
139
- return getRandomSetElement(nil, CARD_SET, seedOrRNG, exceptions)
140
- end
141
- ---
142
- -- @param itemConfigCardType The item config card type that represents the pool of cards to select
143
- -- from.
144
- -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
145
- -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
146
- -- @param exceptions Optional. An array of cards to not select.
147
- function ____exports.getRandomCardTypeOfType(self, itemConfigCardType, seedOrRNG, exceptions)
148
- if seedOrRNG == nil then
149
- seedOrRNG = getRandomSeed(nil)
150
- end
151
- if exceptions == nil then
152
- exceptions = {}
56
+ -- Returns undefined if the provided card type was not valid.
57
+ function ____exports.getItemConfigCardType(self, cardType)
58
+ local itemConfigCard = itemConfig:GetCard(cardType)
59
+ if itemConfigCard == nil then
60
+ return nil
153
61
  end
154
- local cardTypeSet = ____exports.getCardTypesOfType(nil, itemConfigCardType)
155
- return getRandomSetElement(nil, cardTypeSet, seedOrRNG, exceptions)
62
+ return itemConfigCard.CardType
156
63
  end
157
- --- Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul of
158
- -- Isaac, etc.). This will never return a Rune Shard.
64
+ --- Helper function to get an array with every valid vanilla card sub-type.
159
65
  --
160
- -- @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
161
- -- `RNG.Next` method will be called. Default is `getRandomSeed()`.
162
- -- @param exceptions Optional. An array of runes to not select.
163
- function ____exports.getRandomRune(self, seedOrRNG, exceptions)
164
- if seedOrRNG == nil then
165
- seedOrRNG = getRandomSeed(nil)
166
- end
167
- if exceptions == nil then
168
- exceptions = {}
169
- end
170
- local runesSet = ____exports.getCardTypesOfType(nil, ItemConfigCardType.RUNE)
171
- runesSet:delete(CardType.RUNE_SHARD)
172
- return getRandomSetElement(nil, runesSet, seedOrRNG, exceptions)
66
+ -- Note that unlike collectibles and trinkets, there are no gaps in the card types, so this is a
67
+ -- simple range from the first card type to the last vanilla card type.
68
+ function ____exports.getVanillaCardTypes(self)
69
+ return iRange(nil, FIRST_CARD_TYPE, LAST_VANILLA_CARD_TYPE)
173
70
  end
174
71
  --- Returns true for cards that have the following card type:
175
72
  -- - CardType.TAROT
@@ -177,7 +74,11 @@ end
177
74
  -- - CardType.SPECIAL
178
75
  -- - CardType.TAROT_REVERSE
179
76
  function ____exports.isCard(self, cardType)
180
- return CARD_SET:has(cardType)
77
+ local itemConfigCardType = ____exports.getItemConfigCardType(nil, cardType)
78
+ if itemConfigCardType == nil then
79
+ return false
80
+ end
81
+ return ITEM_CONFIG_CARD_TYPES_FOR_CARDS:has(itemConfigCardType)
181
82
  end
182
83
  --- Returns whether or not the given card type matches the specified item config card type.
183
84
  function ____exports.isCardType(self, cardType, itemConfigCardType)
@@ -1 +1 @@
1
- {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../src/functions/globals.ts"],"names":[],"mappings":";AA6LA;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAAC,MAAM,CAAC,CAYvD;AAMD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,aAAa,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAcnE;AAED,wBAAgB,aAAa,IAAI,IAAI,CAWpC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAS5C;AAED,wBAAgB,2BAA2B,IAAI,IAAI,CAKlD"}
1
+ {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../src/functions/globals.ts"],"names":[],"mappings":";AA4LA;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAAC,MAAM,CAAC,CAYvD;AAMD;;;GAGG;AACH,wBAAgB,aAAa,IAAI,aAAa,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAcnE;AAED,wBAAgB,aAAa,IAAI,IAAI,CAWpC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAS5C;AAED,wBAAgB,2BAA2B,IAAI,IAAI,CAKlD"}