isaacscript-common 76.3.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.
Files changed (32) hide show
  1. package/dist/classes/features/other/FlyingDetection.lua +2 -3
  2. package/dist/classes/features/other/ItemPoolDetection.d.ts +1 -1
  3. package/dist/classes/features/other/ItemPoolDetection.d.ts.map +1 -1
  4. package/dist/classes/features/other/ModdedElementSets.d.ts +20 -20
  5. package/dist/classes/features/other/ModdedElementSets.d.ts.map +1 -1
  6. package/dist/classes/features/other/ModdedElementSets.lua +75 -86
  7. package/dist/functions/array.d.ts +3 -3
  8. package/dist/functions/array.d.ts.map +1 -1
  9. package/dist/functions/array.lua +34 -28
  10. package/dist/functions/cards.lua +3 -3
  11. package/dist/functions/collectibles.d.ts +2 -2
  12. package/dist/functions/collectibles.d.ts.map +1 -1
  13. package/dist/functions/collectibles.lua +4 -5
  14. package/dist/functions/pills.d.ts +3 -3
  15. package/dist/functions/pills.d.ts.map +1 -1
  16. package/dist/functions/playerTrinkets.d.ts +1 -1
  17. package/dist/functions/playerTrinkets.d.ts.map +1 -1
  18. package/dist/index.rollup.d.ts +30 -30
  19. package/dist/isaacscript-common.lua +121 -128
  20. package/dist/sets/{itemConfigCardTypesForCardsSet.d.ts → itemConfigCardTypesForCards.d.ts} +2 -2
  21. package/dist/sets/itemConfigCardTypesForCards.d.ts.map +1 -0
  22. package/dist/sets/{itemConfigCardTypesForCardsSet.lua → itemConfigCardTypesForCards.lua} +1 -1
  23. package/package.json +1 -1
  24. package/src/classes/features/other/ItemPoolDetection.ts +1 -1
  25. package/src/classes/features/other/ModdedElementSets.ts +106 -121
  26. package/src/functions/array.ts +12 -5
  27. package/src/functions/cards.ts +2 -2
  28. package/src/functions/collectibles.ts +7 -7
  29. package/src/functions/pills.ts +3 -3
  30. package/src/functions/playerTrinkets.ts +3 -1
  31. package/src/sets/{itemConfigCardTypesForCardsSet.ts → itemConfigCardTypesForCards.ts} +3 -1
  32. package/dist/sets/itemConfigCardTypesForCardsSet.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 76.2.0
3
+ isaacscript-common 76.3.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -17664,10 +17664,10 @@ return ____exports
17664
17664
  ["functions.array"] = function(...)
17665
17665
  local ____lualib = require("lualib_bundle")
17666
17666
  local __TS__ArrayEvery = ____lualib.__TS__ArrayEvery
17667
+ local __TS__New = ____lualib.__TS__New
17667
17668
  local __TS__ArrayIndexOf = ____lualib.__TS__ArrayIndexOf
17668
17669
  local __TS__ArraySplice = ____lualib.__TS__ArraySplice
17669
17670
  local __TS__ArrayPushArray = ____lualib.__TS__ArrayPushArray
17670
- local __TS__New = ____lualib.__TS__New
17671
17671
  local __TS__ArrayEntries = ____lualib.__TS__ArrayEntries
17672
17672
  local __TS__Iterator = ____lualib.__TS__Iterator
17673
17673
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
@@ -17723,28 +17723,6 @@ function ____exports.arrayRemoveAllInPlace(self, array, ...)
17723
17723
  end
17724
17724
  return removedOneOrMoreElements
17725
17725
  end
17726
- --- Removes the specified element(s) from the array. If the specified element(s) are not found in the
17727
- -- array, this function will do nothing.
17728
- --
17729
- -- This function is variadic, meaning that you can specify N arguments to remove N elements.
17730
- --
17731
- -- If there is more than one matching element in the array, this function will only remove the first
17732
- -- matching element. If you want to remove all of the elements, use the `arrayRemoveAllInPlace`
17733
- -- function instead.
17734
- --
17735
- -- @returns The removed elements. This will be an empty array if no elements were removed.
17736
- function ____exports.arrayRemoveInPlace(self, array, ...)
17737
- local elementsToRemove = {...}
17738
- local removedElements = {}
17739
- for ____, element in ipairs(elementsToRemove) do
17740
- local index = __TS__ArrayIndexOf(array, element)
17741
- if index > -1 then
17742
- local removedElement = __TS__ArraySplice(array, index, 1)
17743
- __TS__ArrayPushArray(removedElements, removedElement)
17744
- end
17745
- end
17746
- return removedElements
17747
- end
17748
17726
  --- Helper function to perform a shallow copy.
17749
17727
  --
17750
17728
  -- @param oldArray The array to copy.
@@ -17855,9 +17833,9 @@ function ____exports.arrayEquals(self, array1, array2)
17855
17833
  end
17856
17834
  )
17857
17835
  end
17858
- --- Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
17859
- -- the specified element(s) are not found in the array, it will simply return a shallow copy of the
17860
- -- array.
17836
+ --- Builds a new array based on the original array without the specified element(s). Returns the new
17837
+ -- array. If the specified element(s) are not found in the array, it will simply return a shallow
17838
+ -- copy of the array.
17861
17839
  --
17862
17840
  -- This function is variadic, meaning that you can specify N arguments to remove N elements.
17863
17841
  --
@@ -17865,8 +17843,14 @@ end
17865
17843
  -- matching element. If you want to remove all of the elements, use the `arrayRemoveAll` function
17866
17844
  -- instead.
17867
17845
  function ____exports.arrayRemove(self, originalArray, ...)
17868
- local array = ____exports.copyArray(nil, originalArray)
17869
- ____exports.arrayRemoveInPlace(nil, array, ...)
17846
+ local elementsToRemove = {...}
17847
+ local elementsToRemoveSet = __TS__New(ReadonlySet, elementsToRemove)
17848
+ local array = {}
17849
+ for ____, element in ipairs(originalArray) do
17850
+ if not elementsToRemoveSet:has(element) then
17851
+ array[#array + 1] = element
17852
+ end
17853
+ end
17870
17854
  return array
17871
17855
  end
17872
17856
  --- Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
@@ -17883,6 +17867,28 @@ function ____exports.arrayRemoveAll(self, originalArray, ...)
17883
17867
  ____exports.arrayRemoveAllInPlace(nil, array, ...)
17884
17868
  return array
17885
17869
  end
17870
+ --- Removes the specified element(s) from the array. If the specified element(s) are not found in the
17871
+ -- array, this function will do nothing.
17872
+ --
17873
+ -- This function is variadic, meaning that you can specify N arguments to remove N elements.
17874
+ --
17875
+ -- If there is more than one matching element in the array, this function will only remove the first
17876
+ -- matching element. If you want to remove all of the elements, use the `arrayRemoveAllInPlace`
17877
+ -- function instead.
17878
+ --
17879
+ -- @returns The removed elements. This will be an empty array if no elements were removed.
17880
+ function ____exports.arrayRemoveInPlace(self, array, ...)
17881
+ local elementsToRemove = {...}
17882
+ local removedElements = {}
17883
+ for ____, element in ipairs(elementsToRemove) do
17884
+ local index = __TS__ArrayIndexOf(array, element)
17885
+ if index > -1 then
17886
+ local removedElement = __TS__ArraySplice(array, index, 1)
17887
+ __TS__ArrayPushArray(removedElements, removedElement)
17888
+ end
17889
+ end
17890
+ return removedElements
17891
+ end
17886
17892
  --- Shallow copies and removes the elements at the specified indexes from the array. Returns the
17887
17893
  -- copied array. If the specified indexes are not found in the array, it will simply return a
17888
17894
  -- shallow copy of the array.
@@ -26455,7 +26461,6 @@ return ____exports
26455
26461
  local ____lualib = require("lualib_bundle")
26456
26462
  local Map = ____lualib.Map
26457
26463
  local __TS__New = ____lualib.__TS__New
26458
- local Set = ____lualib.Set
26459
26464
  local ____exports = {}
26460
26465
  local getCollectibleTypeFromArg
26461
26466
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.index")
@@ -26595,14 +26600,14 @@ local GLITCHED_ITEM_THRESHOLD = 4000000000
26595
26600
  local QUALITY_TO_VANILLA_COLLECTIBLE_TYPES_MAP = (function()
26596
26601
  local qualityToCollectibleTypesMap = __TS__New(Map)
26597
26602
  for ____, quality in ipairs(QUALITIES) do
26598
- local collectibleTypesSet = __TS__New(Set)
26603
+ local collectibleTypes = {}
26599
26604
  for ____, collectibleType in ipairs(VANILLA_COLLECTIBLE_TYPES) do
26600
26605
  local collectibleTypeQuality = ____exports.getCollectibleQuality(nil, collectibleType)
26601
26606
  if collectibleTypeQuality == quality then
26602
- collectibleTypesSet:add(collectibleType)
26607
+ collectibleTypes[#collectibleTypes + 1] = collectibleType
26603
26608
  end
26604
26609
  end
26605
- qualityToCollectibleTypesMap:set(quality, collectibleTypesSet)
26610
+ qualityToCollectibleTypesMap:set(quality, collectibleTypes)
26606
26611
  end
26607
26612
  return qualityToCollectibleTypesMap
26608
26613
  end)(nil)
@@ -26793,7 +26798,7 @@ function ____exports.getCollectibleTags(self, collectibleOrCollectibleType)
26793
26798
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
26794
26799
  return itemConfigItem == nil and ItemConfigTagZero or itemConfigItem.Tags
26795
26800
  end
26796
- --- Returns a set containing every vanilla collectible type with the given quality.
26801
+ --- Returns an array containing every vanilla collectible type with the given quality.
26797
26802
  --
26798
26803
  -- Note that this function will only return vanilla collectible types. To handle modded collectible
26799
26804
  -- types, use the `getCollectibleTypesOfQuality` helper function instead.
@@ -43139,7 +43144,7 @@ ____exports.CARD_NAMES = {
43139
43144
  }
43140
43145
  return ____exports
43141
43146
  end,
43142
- ["sets.itemConfigCardTypesForCardsSet"] = function(...)
43147
+ ["sets.itemConfigCardTypesForCards"] = function(...)
43143
43148
  local ____lualib = require("lualib_bundle")
43144
43149
  local __TS__New = ____lualib.__TS__New
43145
43150
  local ____exports = {}
@@ -43148,7 +43153,7 @@ local ItemConfigCardType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigCardTy
43148
43153
  local ____ReadonlySet = require("types.ReadonlySet")
43149
43154
  local ReadonlySet = ____ReadonlySet.ReadonlySet
43150
43155
  --- The set of all `ItemConfigCardType` values that are not a rune or special object.
43151
- ____exports.ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET = __TS__New(ReadonlySet, {ItemConfigCardType.TAROT, ItemConfigCardType.SUIT, ItemConfigCardType.SPECIAL, ItemConfigCardType.TAROT_REVERSE})
43156
+ ____exports.ITEM_CONFIG_CARD_TYPES_FOR_CARDS = __TS__New(ReadonlySet, {ItemConfigCardType.TAROT, ItemConfigCardType.SUIT, ItemConfigCardType.SPECIAL, ItemConfigCardType.TAROT_REVERSE})
43152
43157
  return ____exports
43153
43158
  end,
43154
43159
  ["functions.cards"] = function(...)
@@ -43172,8 +43177,8 @@ local DEFAULT_CARD_DESCRIPTION = ____cardDescriptions.DEFAULT_CARD_DESCRIPTION
43172
43177
  local ____cardNames = require("objects.cardNames")
43173
43178
  local CARD_NAMES = ____cardNames.CARD_NAMES
43174
43179
  local DEFAULT_CARD_NAME = ____cardNames.DEFAULT_CARD_NAME
43175
- local ____itemConfigCardTypesForCardsSet = require("sets.itemConfigCardTypesForCardsSet")
43176
- local ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET = ____itemConfigCardTypesForCardsSet.ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET
43180
+ local ____itemConfigCardTypesForCards = require("sets.itemConfigCardTypesForCards")
43181
+ local ITEM_CONFIG_CARD_TYPES_FOR_CARDS = ____itemConfigCardTypesForCards.ITEM_CONFIG_CARD_TYPES_FOR_CARDS
43177
43182
  local ____flag = require("functions.flag")
43178
43183
  local addFlag = ____flag.addFlag
43179
43184
  function ____exports.isVanillaCardType(self, cardType)
@@ -43251,7 +43256,7 @@ function ____exports.isCard(self, cardType)
43251
43256
  if itemConfigCardType == nil then
43252
43257
  return false
43253
43258
  end
43254
- return ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET:has(itemConfigCardType)
43259
+ return ITEM_CONFIG_CARD_TYPES_FOR_CARDS:has(itemConfigCardType)
43255
43260
  end
43256
43261
  --- Returns whether the given card type matches the specified item config card type.
43257
43262
  function ____exports.isCardType(self, cardType, itemConfigCardType)
@@ -43661,7 +43666,6 @@ local __TS__Class = ____lualib.__TS__Class
43661
43666
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
43662
43667
  local Set = ____lualib.Set
43663
43668
  local Map = ____lualib.Map
43664
- local __TS__Iterator = ____lualib.__TS__Iterator
43665
43669
  local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
43666
43670
  local ____exports = {}
43667
43671
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.index")
@@ -43690,6 +43694,9 @@ local ____decorators = require("decorators")
43690
43694
  local Exported = ____decorators.Exported
43691
43695
  local ____ISCFeature = require("enums.ISCFeature")
43692
43696
  local ISCFeature = ____ISCFeature.ISCFeature
43697
+ local ____array = require("functions.array")
43698
+ local arrayRemove = ____array.arrayRemove
43699
+ local getRandomArrayElement = ____array.getRandomArrayElement
43693
43700
  local ____cards = require("functions.cards")
43694
43701
  local getItemConfigCardType = ____cards.getItemConfigCardType
43695
43702
  local ____collectibleTag = require("functions.collectibleTag")
@@ -43703,10 +43710,7 @@ local isPassiveOrFamiliarCollectible = ____collectibles.isPassiveOrFamiliarColle
43703
43710
  local ____flag = require("functions.flag")
43704
43711
  local getFlagName = ____flag.getFlagName
43705
43712
  local ____set = require("functions.set")
43706
- local copySet = ____set.copySet
43707
- local deleteSetsFromSet = ____set.deleteSetsFromSet
43708
43713
  local getRandomSetElement = ____set.getRandomSetElement
43709
- local getSortedSetValues = ____set.getSortedSetValues
43710
43714
  local ____trinkets = require("functions.trinkets")
43711
43715
  local trinketHasCacheFlag = ____trinkets.trinketHasCacheFlag
43712
43716
  local ____types = require("functions.types")
@@ -43718,12 +43722,10 @@ local ____utils = require("functions.utils")
43718
43722
  local assertDefined = ____utils.assertDefined
43719
43723
  local iRange = ____utils.iRange
43720
43724
  local ____repeat = ____utils["repeat"]
43721
- local ____itemConfigCardTypesForCardsSet = require("sets.itemConfigCardTypesForCardsSet")
43722
- local ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET = ____itemConfigCardTypesForCardsSet.ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET
43725
+ local ____itemConfigCardTypesForCards = require("sets.itemConfigCardTypesForCards")
43726
+ local ITEM_CONFIG_CARD_TYPES_FOR_CARDS = ____itemConfigCardTypesForCards.ITEM_CONFIG_CARD_TYPES_FOR_CARDS
43723
43727
  local ____ReadonlyMap = require("types.ReadonlyMap")
43724
43728
  local ReadonlyMap = ____ReadonlyMap.ReadonlyMap
43725
- local ____ReadonlySet = require("types.ReadonlySet")
43726
- local ReadonlySet = ____ReadonlySet.ReadonlySet
43727
43729
  local ____Feature = require("classes.private.Feature")
43728
43730
  local Feature = ____Feature.Feature
43729
43731
  local CONDITIONAL_FLYING_COLLECTIBLE_TYPES = {CollectibleType.BIBLE, CollectibleType.EMPTY_VESSEL, CollectibleType.ASTRAL_PROJECTION, CollectibleType.RECALL}
@@ -43772,15 +43774,15 @@ function ModdedElementSets.prototype.____constructor(self, moddedElementDetectio
43772
43774
  self.moddedPillEffectsSet = __TS__New(Set)
43773
43775
  self.cacheFlagToCollectibleTypesMap = __TS__New(Map)
43774
43776
  self.cacheFlagToTrinketTypesMap = __TS__New(Map)
43775
- self.flyingCollectibleTypesSet = __TS__New(Set)
43776
- self.permanentFlyingCollectibleTypesSet = __TS__New(Set)
43777
- self.flyingTrinketTypesSet = __TS__New(Set)
43777
+ self.flyingCollectibleTypes = {}
43778
+ self.permanentFlyingCollectibleTypes = {}
43779
+ self.flyingTrinketTypes = {}
43778
43780
  self.tagToCollectibleTypesMap = __TS__New(Map)
43779
43781
  self.edenActiveCollectibleTypesSet = __TS__New(Set)
43780
43782
  self.edenPassiveCollectibleTypesSet = __TS__New(Set)
43781
43783
  self.qualityToCollectibleTypesMap = __TS__New(Map)
43782
43784
  self.itemConfigCardTypeToCardTypeMap = __TS__New(Map)
43783
- self.cardSet = __TS__New(Set)
43785
+ self.cardTypeCardArray = {}
43784
43786
  self.featuresUsed = {ISCFeature.MODDED_ELEMENT_DETECTION}
43785
43787
  self.moddedElementDetection = moddedElementDetection
43786
43788
  end
@@ -43904,10 +43906,7 @@ function ModdedElementSets.prototype.lazyInitModdedPillEffects(self)
43904
43906
  end
43905
43907
  function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
43906
43908
  for ____, itemConfigTag in ipairs(ITEM_CONFIG_TAG_VALUES) do
43907
- self.tagToCollectibleTypesMap:set(
43908
- itemConfigTag,
43909
- __TS__New(Set)
43910
- )
43909
+ self.tagToCollectibleTypesMap:set(itemConfigTag, {})
43911
43910
  end
43912
43911
  for ____, collectibleType in ipairs(self:getCollectibleTypes()) do
43913
43912
  for ____, itemConfigTag in ipairs(ITEM_CONFIG_TAG_VALUES) do
@@ -43915,12 +43914,12 @@ function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
43915
43914
  if not collectibleHasTag(nil, collectibleType, itemConfigTag) then
43916
43915
  goto __continue37
43917
43916
  end
43918
- local collectibleTypesSet = self.tagToCollectibleTypesMap:get(itemConfigTag)
43919
- if collectibleTypesSet == nil then
43917
+ local collectibleTypes = self.tagToCollectibleTypesMap:get(itemConfigTag)
43918
+ if collectibleTypes == nil then
43920
43919
  local flagName = getFlagName(nil, itemConfigTag, ItemConfigTag)
43921
43920
  error("Failed to get the collectible types for item tag: " .. tostring(flagName))
43922
43921
  end
43923
- collectibleTypesSet:add(collectibleType)
43922
+ collectibleTypes[#collectibleTypes + 1] = collectibleType
43924
43923
  end
43925
43924
  ::__continue37::
43926
43925
  end
@@ -43928,58 +43927,55 @@ function ModdedElementSets.prototype.lazyInitTagToCollectibleTypesMap(self)
43928
43927
  end
43929
43928
  function ModdedElementSets.prototype.lazyInitCacheFlagToCollectibleTypesMap(self)
43930
43929
  for ____, cacheFlag in ipairs(CACHE_FLAG_VALUES) do
43931
- local collectibleTypeSet = __TS__New(Set)
43930
+ local collectibleTypes = {}
43932
43931
  for ____, collectibleType in ipairs(self:getCollectibleTypes()) do
43933
43932
  if collectibleHasCacheFlag(nil, collectibleType, cacheFlag) then
43934
- collectibleTypeSet:add(collectibleType)
43933
+ collectibleTypes[#collectibleTypes + 1] = collectibleType
43935
43934
  end
43936
43935
  end
43937
- self.cacheFlagToCollectibleTypesMap:set(cacheFlag, collectibleTypeSet)
43936
+ self.cacheFlagToCollectibleTypesMap:set(cacheFlag, collectibleTypes)
43938
43937
  end
43939
43938
  end
43940
43939
  function ModdedElementSets.prototype.lazyInitCacheFlagToTrinketTypesMap(self)
43941
43940
  for ____, cacheFlag in ipairs(CACHE_FLAG_VALUES) do
43942
- local trinketTypesSet = __TS__New(Set)
43941
+ local trinketTypes = {}
43943
43942
  for ____, trinketType in ipairs(self:getTrinketTypes()) do
43944
43943
  if trinketHasCacheFlag(nil, trinketType, cacheFlag) then
43945
- trinketTypesSet:add(trinketType)
43944
+ trinketTypes[#trinketTypes + 1] = trinketType
43946
43945
  end
43947
43946
  end
43948
- self.cacheFlagToTrinketTypesMap:set(cacheFlag, trinketTypesSet)
43947
+ self.cacheFlagToTrinketTypesMap:set(cacheFlag, trinketTypes)
43949
43948
  end
43950
43949
  end
43951
43950
  function ModdedElementSets.prototype.lazyInitFlyingCollectibleTypesSet(self)
43952
- self.flyingCollectibleTypesSet = copySet(
43951
+ local collectibleTypesWithFlyingCacheFlag = self:getCollectibleTypesWithCacheFlag(CacheFlag.FLYING)
43952
+ local collectibleTypesWithAllCacheFlag = self:getCollectibleTypesWithCacheFlag(CacheFlag.ALL)
43953
+ self.flyingCollectibleTypes = arrayRemove(
43953
43954
  nil,
43954
- self:getCollectibleTypesWithCacheFlag(CacheFlag.FLYING)
43955
+ collectibleTypesWithFlyingCacheFlag,
43956
+ table.unpack(collectibleTypesWithAllCacheFlag)
43955
43957
  )
43956
- local collectiblesWithAllCacheFlag = self:getCollectibleTypesWithCacheFlag(CacheFlag.ALL)
43957
- deleteSetsFromSet(nil, self.flyingCollectibleTypesSet, collectiblesWithAllCacheFlag)
43958
- local permanentFlyingCollectibleTypes = copySet(nil, self.flyingCollectibleTypesSet)
43959
- for ____, collectibleType in ipairs(CONDITIONAL_FLYING_COLLECTIBLE_TYPES) do
43960
- permanentFlyingCollectibleTypes:delete(collectibleType)
43961
- end
43962
- for ____, collectibleType in __TS__Iterator(permanentFlyingCollectibleTypes) do
43963
- self.permanentFlyingCollectibleTypesSet:add(collectibleType)
43964
- end
43965
- end
43966
- function ModdedElementSets.prototype.lazyInitFlyingTrinketTypesSet(self)
43967
- self.flyingTrinketTypesSet = copySet(
43958
+ self.permanentFlyingCollectibleTypes = arrayRemove(
43968
43959
  nil,
43969
- self:getTrinketsTypesWithCacheFlag(CacheFlag.FLYING)
43960
+ self.flyingCollectibleTypes,
43961
+ table.unpack(CONDITIONAL_FLYING_COLLECTIBLE_TYPES)
43970
43962
  )
43971
- local trinketsWithAllCacheFlag = copySet(
43963
+ end
43964
+ function ModdedElementSets.prototype.lazyInitFlyingTrinketTypesSet(self)
43965
+ local trinketTypesWithFlyingCacheFlag = self:getTrinketsTypesWithCacheFlag(CacheFlag.FLYING)
43966
+ local trinketTypesWithAllCacheFlag = self:getTrinketsTypesWithCacheFlag(CacheFlag.ALL)
43967
+ local trinketTypesWithAllCacheFlagThatDontGrantFlying = arrayRemove(nil, trinketTypesWithAllCacheFlag, TrinketType.AZAZELS_STUMP)
43968
+ self.flyingTrinketTypes = arrayRemove(
43972
43969
  nil,
43973
- self:getTrinketsTypesWithCacheFlag(CacheFlag.ALL)
43970
+ trinketTypesWithFlyingCacheFlag,
43971
+ table.unpack(trinketTypesWithAllCacheFlagThatDontGrantFlying)
43974
43972
  )
43975
- trinketsWithAllCacheFlag:delete(TrinketType.AZAZELS_STUMP)
43976
- deleteSetsFromSet(nil, self.flyingTrinketTypesSet, trinketsWithAllCacheFlag)
43977
43973
  end
43978
43974
  function ModdedElementSets.prototype.lazyInitEdenCollectibleTypesSet(self)
43979
43975
  for ____, collectibleType in ipairs(self:getCollectibleTypes()) do
43980
43976
  do
43981
43977
  if isHiddenCollectible(nil, collectibleType) or collectibleHasTag(nil, collectibleType, ItemConfigTag.NO_EDEN) then
43982
- goto __continue61
43978
+ goto __continue57
43983
43979
  end
43984
43980
  if isActiveCollectible(nil, collectibleType) then
43985
43981
  self.edenActiveCollectibleTypesSet:add(collectibleType)
@@ -43988,40 +43984,38 @@ function ModdedElementSets.prototype.lazyInitEdenCollectibleTypesSet(self)
43988
43984
  self.edenPassiveCollectibleTypesSet:add(collectibleType)
43989
43985
  end
43990
43986
  end
43991
- ::__continue61::
43987
+ ::__continue57::
43992
43988
  end
43993
43989
  end
43994
43990
  function ModdedElementSets.prototype.lazyInitQualityToCollectibleTypesMap(self)
43995
43991
  for ____, quality in ipairs(QUALITIES) do
43996
- local collectibleTypesSet = __TS__New(Set)
43992
+ local collectibleTypes = {}
43997
43993
  for ____, collectibleType in ipairs(self:getCollectibleTypes()) do
43998
43994
  local collectibleTypeQuality = getCollectibleQuality(nil, collectibleType)
43999
43995
  if collectibleTypeQuality == quality then
44000
- collectibleTypesSet:add(collectibleType)
43996
+ collectibleTypes[#collectibleTypes + 1] = collectibleType
44001
43997
  end
44002
43998
  end
44003
- self.qualityToCollectibleTypesMap:set(quality, collectibleTypesSet)
43999
+ self.qualityToCollectibleTypesMap:set(quality, collectibleTypes)
44004
44000
  end
44005
44001
  end
44006
44002
  function ModdedElementSets.prototype.lazyInitCardTypes(self)
44007
44003
  for ____, itemConfigCardType in ipairs(ITEM_CONFIG_CARD_TYPE_VALUES) do
44008
- self.itemConfigCardTypeToCardTypeMap:set(
44009
- itemConfigCardType,
44010
- __TS__New(Set)
44011
- )
44004
+ self.itemConfigCardTypeToCardTypeMap:set(itemConfigCardType, {})
44012
44005
  end
44013
44006
  for ____, cardType in ipairs(self:getCardTypes()) do
44014
44007
  local itemConfigCardType = getItemConfigCardType(nil, cardType)
44015
44008
  if itemConfigCardType ~= nil then
44016
- local cardTypeSet = self.itemConfigCardTypeToCardTypeMap:get(itemConfigCardType)
44009
+ local cardTypes = self.itemConfigCardTypeToCardTypeMap:get(itemConfigCardType)
44017
44010
  assertDefined(
44018
44011
  nil,
44019
- cardTypeSet,
44020
- "Failed to get the card set for item config card type: " .. tostring(itemConfigCardType)
44012
+ cardTypes,
44013
+ "Failed to get the card types for item config card type: " .. tostring(itemConfigCardType)
44021
44014
  )
44022
- cardTypeSet:add(cardType)
44023
- if ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET:has(itemConfigCardType) then
44024
- self.cardSet:add(cardType)
44015
+ cardTypes[#cardTypes + 1] = cardType
44016
+ if ITEM_CONFIG_CARD_TYPES_FOR_CARDS:has(itemConfigCardType) then
44017
+ local ____self_cardTypeCardArray_12 = self.cardTypeCardArray
44018
+ ____self_cardTypeCardArray_12[#____self_cardTypeCardArray_12 + 1] = cardType
44025
44019
  end
44026
44020
  end
44027
44021
  end
@@ -44138,24 +44132,24 @@ function ModdedElementSets.prototype.getCollectibleTypesWithCacheFlag(self, cach
44138
44132
  self:lazyInit()
44139
44133
  local collectiblesSet = self.cacheFlagToCollectibleTypesMap:get(cacheFlag)
44140
44134
  if collectiblesSet == nil then
44141
- return __TS__New(ReadonlySet)
44135
+ return {}
44142
44136
  end
44143
44137
  return collectiblesSet
44144
44138
  end
44145
44139
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleTypesWithCacheFlag", true)
44146
44140
  function ModdedElementSets.prototype.getTrinketsTypesWithCacheFlag(self, cacheFlag)
44147
44141
  self:lazyInit()
44148
- local trinketsSet = self.cacheFlagToTrinketTypesMap:get(cacheFlag)
44149
- if trinketsSet == nil then
44150
- return __TS__New(ReadonlySet)
44142
+ local trinketTypes = self.cacheFlagToTrinketTypesMap:get(cacheFlag)
44143
+ if trinketTypes == nil then
44144
+ return {}
44151
44145
  end
44152
- return trinketsSet
44146
+ return trinketTypes
44153
44147
  end
44154
44148
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getTrinketsTypesWithCacheFlag", true)
44155
44149
  function ModdedElementSets.prototype.getPlayerCollectiblesWithCacheFlag(self, player, cacheFlag)
44156
44150
  local collectiblesWithCacheFlag = self:getCollectibleTypesWithCacheFlag(cacheFlag)
44157
44151
  local playerCollectibles = {}
44158
- for ____, collectibleType in ipairs(getSortedSetValues(nil, collectiblesWithCacheFlag)) do
44152
+ for ____, collectibleType in ipairs(collectiblesWithCacheFlag) do
44159
44153
  local numCollectibles = player:GetCollectibleNum(collectibleType, true)
44160
44154
  ____repeat(
44161
44155
  nil,
@@ -44171,7 +44165,7 @@ __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getPlayerCollecti
44171
44165
  function ModdedElementSets.prototype.getPlayerTrinketsWithCacheFlag(self, player, cacheFlag)
44172
44166
  local trinketTypesWithCacheFlag = self:getTrinketsTypesWithCacheFlag(cacheFlag)
44173
44167
  local playerTrinkets = __TS__New(Map)
44174
- for ____, trinketType in __TS__Iterator(trinketTypesWithCacheFlag) do
44168
+ for ____, trinketType in ipairs(trinketTypesWithCacheFlag) do
44175
44169
  local trinketMultiplier = player:GetTrinketMultiplier(trinketType)
44176
44170
  if trinketMultiplier > 0 then
44177
44171
  playerTrinkets:set(trinketType, trinketMultiplier)
@@ -44182,12 +44176,12 @@ end
44182
44176
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getPlayerTrinketsWithCacheFlag", true)
44183
44177
  function ModdedElementSets.prototype.getFlyingCollectibleTypes(self, includeConditionalItems)
44184
44178
  self:lazyInit()
44185
- return includeConditionalItems and self.flyingCollectibleTypesSet or self.permanentFlyingCollectibleTypesSet
44179
+ return includeConditionalItems and self.flyingCollectibleTypes or self.permanentFlyingCollectibleTypes
44186
44180
  end
44187
44181
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getFlyingCollectibleTypes", true)
44188
44182
  function ModdedElementSets.prototype.getFlyingTrinketTypes(self)
44189
44183
  self:lazyInit()
44190
- return self.flyingTrinketTypesSet
44184
+ return self.flyingTrinketTypes
44191
44185
  end
44192
44186
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getFlyingTrinketTypes", true)
44193
44187
  function ModdedElementSets.prototype.getCollectibleTypesWithTag(self, itemConfigTag)
@@ -44204,7 +44198,7 @@ __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleTyp
44204
44198
  function ModdedElementSets.prototype.getPlayerCollectiblesWithTag(self, player, itemConfigTag)
44205
44199
  local collectibleTypesWithTag = self:getCollectibleTypesWithTag(itemConfigTag)
44206
44200
  local playerCollectibles = {}
44207
- for ____, collectibleType in ipairs(getSortedSetValues(nil, collectibleTypesWithTag)) do
44201
+ for ____, collectibleType in ipairs(collectibleTypesWithTag) do
44208
44202
  local numCollectibles = player:GetCollectibleNum(collectibleType, true)
44209
44203
  ____repeat(
44210
44204
  nil,
@@ -44230,7 +44224,7 @@ __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleTyp
44230
44224
  function ModdedElementSets.prototype.getPlayerCollectiblesForTransformation(self, player, playerForm)
44231
44225
  local collectibleForTransformation = self:getCollectibleTypesForTransformation(playerForm)
44232
44226
  local playerCollectibles = {}
44233
- for ____, collectibleType in ipairs(getSortedSetValues(nil, collectibleForTransformation)) do
44227
+ for ____, collectibleType in ipairs(collectibleForTransformation) do
44234
44228
  local numCollectibles = player:GetCollectibleNum(collectibleType, true)
44235
44229
  ____repeat(
44236
44230
  nil,
@@ -44282,33 +44276,33 @@ end
44282
44276
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getCollectibleTypesOfQuality", true)
44283
44277
  function ModdedElementSets.prototype.getPlayerCollectiblesOfQuality(self, player, quality)
44284
44278
  local collectibleTypesOfQuality = self:getCollectibleTypesOfQuality(quality)
44285
- local playerCollectibles = {}
44286
- for ____, collectibleType in ipairs(getSortedSetValues(nil, collectibleTypesOfQuality)) do
44279
+ local playerCollectibleTypes = {}
44280
+ for ____, collectibleType in ipairs(collectibleTypesOfQuality) do
44287
44281
  local numCollectibles = player:GetCollectibleNum(collectibleType, true)
44288
44282
  ____repeat(
44289
44283
  nil,
44290
44284
  numCollectibles,
44291
44285
  function()
44292
- playerCollectibles[#playerCollectibles + 1] = collectibleType
44286
+ playerCollectibleTypes[#playerCollectibleTypes + 1] = collectibleType
44293
44287
  end
44294
44288
  )
44295
44289
  end
44296
- return playerCollectibles
44290
+ return playerCollectibleTypes
44297
44291
  end
44298
44292
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getPlayerCollectiblesOfQuality", true)
44299
44293
  function ModdedElementSets.prototype.getCardTypesOfType(self, ...)
44300
44294
  local itemConfigCardTypes = {...}
44301
44295
  self:lazyInit()
44302
- local matchingCardTypes = __TS__New(Set)
44296
+ local matchingCardTypes = {}
44303
44297
  for ____, itemConfigCardType in ipairs(itemConfigCardTypes) do
44304
- local cardTypeSet = self.itemConfigCardTypeToCardTypeMap:get(itemConfigCardType)
44298
+ local cardTypes = self.itemConfigCardTypeToCardTypeMap:get(itemConfigCardType)
44305
44299
  assertDefined(
44306
44300
  nil,
44307
- cardTypeSet,
44308
- "Failed to get the card type set for item config type: " .. tostring(itemConfigCardType)
44301
+ cardTypes,
44302
+ "Failed to get the card types for item config type: " .. tostring(itemConfigCardType)
44309
44303
  )
44310
- for ____, cardType in __TS__Iterator(cardTypeSet) do
44311
- matchingCardTypes:add(cardType)
44304
+ for ____, cardType in ipairs(cardTypes) do
44305
+ matchingCardTypes[#matchingCardTypes + 1] = cardType
44312
44306
  end
44313
44307
  end
44314
44308
  return matchingCardTypes
@@ -44318,8 +44312,8 @@ function ModdedElementSets.prototype.getRandomCardTypeOfType(self, itemConfigCar
44318
44312
  if exceptions == nil then
44319
44313
  exceptions = {}
44320
44314
  end
44321
- local cardTypeSet = self:getCardTypesOfType(itemConfigCardType)
44322
- return getRandomSetElement(nil, cardTypeSet, seedOrRNG, exceptions)
44315
+ local cardTypes = self:getCardTypesOfType(itemConfigCardType)
44316
+ return getRandomArrayElement(nil, cardTypes, seedOrRNG, exceptions)
44323
44317
  end
44324
44318
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomCardTypeOfType", true)
44325
44319
  function ModdedElementSets.prototype.getRandomCard(self, seedOrRNG, exceptions)
@@ -44327,16 +44321,16 @@ function ModdedElementSets.prototype.getRandomCard(self, seedOrRNG, exceptions)
44327
44321
  exceptions = {}
44328
44322
  end
44329
44323
  self:lazyInit()
44330
- return getRandomSetElement(nil, self.cardSet, seedOrRNG, exceptions)
44324
+ return getRandomArrayElement(nil, self.cardTypeCardArray, seedOrRNG, exceptions)
44331
44325
  end
44332
44326
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomCard", true)
44333
44327
  function ModdedElementSets.prototype.getRandomRune(self, seedOrRNG, exceptions)
44334
44328
  if exceptions == nil then
44335
44329
  exceptions = {}
44336
44330
  end
44337
- local runesSet = self:getCardTypesOfType(ItemConfigCardType.RUNE)
44338
- runesSet:delete(CardType.RUNE_SHARD)
44339
- return getRandomSetElement(nil, runesSet, seedOrRNG, exceptions)
44331
+ local runeCardTypes = self:getCardTypesOfType(ItemConfigCardType.RUNE)
44332
+ exceptions[#exceptions + 1] = CardType.RUNE_SHARD
44333
+ return getRandomArrayElement(nil, runeCardTypes, seedOrRNG, exceptions)
44340
44334
  end
44341
44335
  __TS__DecorateLegacy({Exported}, ModdedElementSets.prototype, "getRandomRune", true)
44342
44336
  return ____exports
@@ -60741,7 +60735,6 @@ return ____exports
60741
60735
  local ____lualib = require("lualib_bundle")
60742
60736
  local __TS__Class = ____lualib.__TS__Class
60743
60737
  local __TS__ClassExtends = ____lualib.__TS__ClassExtends
60744
- local __TS__Iterator = ____lualib.__TS__Iterator
60745
60738
  local __TS__DecorateLegacy = ____lualib.__TS__DecorateLegacy
60746
60739
  local ____exports = {}
60747
60740
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.index")
@@ -60765,13 +60758,13 @@ end
60765
60758
  function FlyingDetection.prototype.hasFlyingTemporaryEffect(self, player)
60766
60759
  local effects = player:GetEffects()
60767
60760
  local flyingCollectibles = self.moddedElementSets:getFlyingCollectibleTypes(true)
60768
- for ____, collectibleType in __TS__Iterator(flyingCollectibles) do
60761
+ for ____, collectibleType in ipairs(flyingCollectibles) do
60769
60762
  if effects:HasCollectibleEffect(collectibleType) then
60770
60763
  return true
60771
60764
  end
60772
60765
  end
60773
60766
  local flyingTrinkets = self.moddedElementSets:getFlyingTrinketTypes()
60774
- for ____, trinketType in __TS__Iterator(flyingTrinkets) do
60767
+ for ____, trinketType in ipairs(flyingTrinkets) do
60775
60768
  if effects:HasTrinketEffect(trinketType) then
60776
60769
  return true
60777
60770
  end
@@ -1,4 +1,4 @@
1
1
  import { ItemConfigCardType } from "isaac-typescript-definitions";
2
2
  /** The set of all `ItemConfigCardType` values that are not a rune or special object. */
3
- export declare const ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET: ReadonlySet<ItemConfigCardType>;
4
- //# sourceMappingURL=itemConfigCardTypesForCardsSet.d.ts.map
3
+ export declare const ITEM_CONFIG_CARD_TYPES_FOR_CARDS: ReadonlySet<ItemConfigCardType>;
4
+ //# sourceMappingURL=itemConfigCardTypesForCards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"itemConfigCardTypesForCards.d.ts","sourceRoot":"","sources":["../../src/sets/itemConfigCardTypesForCards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGlE,wFAAwF;AACxF,eAAO,MAAM,gCAAgC,iCAQzC,CAAC"}
@@ -6,5 +6,5 @@ local ItemConfigCardType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigCardTy
6
6
  local ____ReadonlySet = require("types.ReadonlySet")
7
7
  local ReadonlySet = ____ReadonlySet.ReadonlySet
8
8
  --- The set of all `ItemConfigCardType` values that are not a rune or special object.
9
- ____exports.ITEM_CONFIG_CARD_TYPES_FOR_CARDS_SET = __TS__New(ReadonlySet, {ItemConfigCardType.TAROT, ItemConfigCardType.SUIT, ItemConfigCardType.SPECIAL, ItemConfigCardType.TAROT_REVERSE})
9
+ ____exports.ITEM_CONFIG_CARD_TYPES_FOR_CARDS = __TS__New(ReadonlySet, {ItemConfigCardType.TAROT, ItemConfigCardType.SUIT, ItemConfigCardType.SPECIAL, ItemConfigCardType.TAROT_REVERSE})
10
10
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "76.3.0",
3
+ "version": "77.0.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -54,7 +54,7 @@ export class ItemPoolDetection extends Feature {
54
54
  @Exported
55
55
  public getCollectiblesInItemPool(
56
56
  itemPoolType: ItemPoolType,
57
- ): CollectibleType[] {
57
+ ): readonly CollectibleType[] {
58
58
  const collectibleArray = this.moddedElementSets.getCollectibleTypes();
59
59
  return collectibleArray.filter((collectibleType) =>
60
60
  this.isCollectibleInItemPool(collectibleType, itemPoolType),