isaacscript-common 72.2.0 → 72.3.1

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.
@@ -9087,6 +9087,12 @@ export declare function isCoin(pickup: EntityPickup): pickup is EntityPickupCoin
9087
9087
  /** For `PickupVariant.COLLECTIBLE` (100). */
9088
9088
  export declare function isCollectible(pickup: EntityPickup): pickup is EntityPickupCollectible;
9089
9089
 
9090
+ /**
9091
+ * Helper function to check if a particular collectibles is in a particular item pool at the
9092
+ * beginning of a vanilla run.
9093
+ */
9094
+ export declare function isCollectibleTypeInDefaultItemPool(collectibleType: CollectibleType, itemPoolType: ItemPoolType): boolean;
9095
+
9090
9096
  /** Helper function to check if something is an instantiated `Color` object. */
9091
9097
  export declare function isColor(object: unknown): object is Color;
9092
9098
 
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 72.2.0
3
+ isaacscript-common 72.3.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -57651,19 +57651,24 @@ function ____exports.getDefaultCollectibleTypesInItemPool(self, itemPoolType)
57651
57651
  return ITEM_POOL_TYPE_TO_COLLECTIBLE_TYPES_SET[itemPoolType]
57652
57652
  end
57653
57653
  function ____exports.getDefaultItemPoolsForCollectibleType(self, collectibleType)
57654
- local itemPoolTypes = {}
57655
- for ____, itemPoolType in ipairs(ITEM_POOL_TYPE_VALUES) do
57654
+ local collectibleItemPoolTypes = {}
57655
+ local itemPoolTypes = game:IsGreedMode() and GREED_MODE_ITEM_POOL_TYPES or NORMAL_MODE_ITEM_POOL_TYPES
57656
+ for ____, itemPoolType in ipairs(itemPoolTypes) do
57656
57657
  local collectibleTypesSet = ITEM_POOL_TYPE_TO_COLLECTIBLE_TYPES_SET[itemPoolType]
57657
57658
  if collectibleTypesSet:has(collectibleType) then
57658
- itemPoolTypes[#itemPoolTypes + 1] = itemPoolType
57659
+ collectibleItemPoolTypes[#collectibleItemPoolTypes + 1] = itemPoolType
57659
57660
  end
57660
57661
  end
57661
- return itemPoolTypes
57662
+ return collectibleItemPoolTypes
57662
57663
  end
57663
57664
  function ____exports.getRandomItemPool(self, seedOrRNG)
57664
57665
  local itemPoolTypes = game:IsGreedMode() and GREED_MODE_ITEM_POOL_TYPES or NORMAL_MODE_ITEM_POOL_TYPES
57665
57666
  return getRandomArrayElement(nil, itemPoolTypes, seedOrRNG)
57666
57667
  end
57668
+ function ____exports.isCollectibleTypeInDefaultItemPool(self, collectibleType, itemPoolType)
57669
+ local collectibleTypesSet = ITEM_POOL_TYPE_TO_COLLECTIBLE_TYPES_SET[itemPoolType]
57670
+ return collectibleTypesSet:has(collectibleType)
57671
+ end
57667
57672
  function ____exports.removeCollectibleFromPools(self, ...)
57668
57673
  local collectibleTypes = {...}
57669
57674
  local itemPool = game:GetItemPool()
@@ -26,6 +26,11 @@ export declare function getDefaultItemPoolsForCollectibleType(collectibleType: C
26
26
  * a random seed.
27
27
  */
28
28
  export declare function getRandomItemPool(seedOrRNG: Seed | RNG | undefined): ItemPoolType;
29
+ /**
30
+ * Helper function to check if a particular collectibles is in a particular item pool at the
31
+ * beginning of a vanilla run.
32
+ */
33
+ export declare function isCollectibleTypeInDefaultItemPool(collectibleType: CollectibleType, itemPoolType: ItemPoolType): boolean;
29
34
  /**
30
35
  * Helper function to remove one or more collectibles from all item pools.
31
36
  *
@@ -1 +1 @@
1
- {"version":3,"file":"itemPool.d.ts","sourceRoot":"","sources":["../../../src/functions/itemPool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAwC5D;;;GAGG;AACH,wBAAgB,oCAAoC,CAClD,YAAY,EAAE,YAAY,GACzB,GAAG,CAAC,eAAe,CAAC,CAEtB;AAED;;;;;;GAMG;AACH,wBAAgB,qCAAqC,CACnD,eAAe,EAAE,eAAe,GAC/B,YAAY,EAAE,CAYhB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,YAAY,CAKd;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,YAAY,EAAE,WAAW,EAAE,GAAG,IAAI,CAM3E"}
1
+ {"version":3,"file":"itemPool.d.ts","sourceRoot":"","sources":["../../../src/functions/itemPool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAwC5D;;;GAGG;AACH,wBAAgB,oCAAoC,CAClD,YAAY,EAAE,YAAY,GACzB,GAAG,CAAC,eAAe,CAAC,CAEtB;AAED;;;;;;GAMG;AACH,wBAAgB,qCAAqC,CACnD,eAAe,EAAE,eAAe,GAC/B,YAAY,EAAE,CAgBhB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,IAAI,GAAG,GAAG,GAAG,SAAS,GAChC,YAAY,CAMd;AAED;;;GAGG;AACH,wBAAgB,kCAAkC,CAChD,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,GACzB,OAAO,CAIT;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,YAAY,EAAE,WAAW,EAAE,GAAG,IAAI,CAM3E"}
@@ -67,14 +67,15 @@ end
67
67
  -- This function will automatically account for Greed Mode. In other words, it will not return the
68
68
  -- "normal" item pools when playing in Greed Mode.
69
69
  function ____exports.getDefaultItemPoolsForCollectibleType(self, collectibleType)
70
- local itemPoolTypes = {}
71
- for ____, itemPoolType in ipairs(ITEM_POOL_TYPE_VALUES) do
70
+ local collectibleItemPoolTypes = {}
71
+ local itemPoolTypes = game:IsGreedMode() and GREED_MODE_ITEM_POOL_TYPES or NORMAL_MODE_ITEM_POOL_TYPES
72
+ for ____, itemPoolType in ipairs(itemPoolTypes) do
72
73
  local collectibleTypesSet = ITEM_POOL_TYPE_TO_COLLECTIBLE_TYPES_SET[itemPoolType]
73
74
  if collectibleTypesSet:has(collectibleType) then
74
- itemPoolTypes[#itemPoolTypes + 1] = itemPoolType
75
+ collectibleItemPoolTypes[#collectibleItemPoolTypes + 1] = itemPoolType
75
76
  end
76
77
  end
77
- return itemPoolTypes
78
+ return collectibleItemPoolTypes
78
79
  end
79
80
  --- Helper function to get a random item pool. This is not as simple as getting a random value from
80
81
  -- the `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the
@@ -90,6 +91,12 @@ function ____exports.getRandomItemPool(self, seedOrRNG)
90
91
  local itemPoolTypes = game:IsGreedMode() and GREED_MODE_ITEM_POOL_TYPES or NORMAL_MODE_ITEM_POOL_TYPES
91
92
  return getRandomArrayElement(nil, itemPoolTypes, seedOrRNG)
92
93
  end
94
+ --- Helper function to check if a particular collectibles is in a particular item pool at the
95
+ -- beginning of a vanilla run.
96
+ function ____exports.isCollectibleTypeInDefaultItemPool(self, collectibleType, itemPoolType)
97
+ local collectibleTypesSet = ITEM_POOL_TYPE_TO_COLLECTIBLE_TYPES_SET[itemPoolType]
98
+ return collectibleTypesSet:has(collectibleType)
99
+ end
93
100
  --- Helper function to remove one or more collectibles from all item pools.
94
101
  --
95
102
  -- This function is variadic, meaning you can pass as many collectible types as you want to remove.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "72.2.0",
3
+ "version": "72.3.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -62,17 +62,21 @@ export function getDefaultCollectibleTypesInItemPool(
62
62
  export function getDefaultItemPoolsForCollectibleType(
63
63
  collectibleType: CollectibleType,
64
64
  ): ItemPoolType[] {
65
- const itemPoolTypes: ItemPoolType[] = [];
65
+ const collectibleItemPoolTypes: ItemPoolType[] = [];
66
66
 
67
- for (const itemPoolType of ITEM_POOL_TYPE_VALUES) {
67
+ const itemPoolTypes = game.IsGreedMode()
68
+ ? GREED_MODE_ITEM_POOL_TYPES
69
+ : NORMAL_MODE_ITEM_POOL_TYPES;
70
+
71
+ for (const itemPoolType of itemPoolTypes) {
68
72
  const collectibleTypesSet =
69
73
  ITEM_POOL_TYPE_TO_COLLECTIBLE_TYPES_SET[itemPoolType];
70
74
  if (collectibleTypesSet.has(collectibleType)) {
71
- itemPoolTypes.push(itemPoolType);
75
+ collectibleItemPoolTypes.push(itemPoolType);
72
76
  }
73
77
  }
74
78
 
75
- return itemPoolTypes;
79
+ return collectibleItemPoolTypes;
76
80
  }
77
81
 
78
82
  /**
@@ -93,9 +97,23 @@ export function getRandomItemPool(
93
97
  const itemPoolTypes = game.IsGreedMode()
94
98
  ? GREED_MODE_ITEM_POOL_TYPES
95
99
  : NORMAL_MODE_ITEM_POOL_TYPES;
100
+
96
101
  return getRandomArrayElement(itemPoolTypes, seedOrRNG);
97
102
  }
98
103
 
104
+ /**
105
+ * Helper function to check if a particular collectibles is in a particular item pool at the
106
+ * beginning of a vanilla run.
107
+ */
108
+ export function isCollectibleTypeInDefaultItemPool(
109
+ collectibleType: CollectibleType,
110
+ itemPoolType: ItemPoolType,
111
+ ): boolean {
112
+ const collectibleTypesSet =
113
+ ITEM_POOL_TYPE_TO_COLLECTIBLE_TYPES_SET[itemPoolType];
114
+ return collectibleTypesSet.has(collectibleType);
115
+ }
116
+
99
117
  /**
100
118
  * Helper function to remove one or more collectibles from all item pools.
101
119
  *