isaacscript-common 21.7.0 → 21.8.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.
@@ -5921,6 +5921,13 @@ export declare function getRandomIndexFromWeightedArray<T>(weightedArray: Weight
5921
5921
  */
5922
5922
  export declare function getRandomInt(min: int, max: int, seedOrRNG?: Seed | RNG, exceptions?: int[] | readonly int[]): int;
5923
5923
 
5924
+ /**
5925
+ * Helper function to get a random item pool. This is not as simple as getting a random value from
5926
+ * the `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the
5927
+ * Greed Mode item pools should be excluded if not playing in Greed Mode.
5928
+ */
5929
+ export declare function getRandomItemPool(): ItemPoolType;
5930
+
5924
5931
  /**
5925
5932
  * Helper function to get a random JSON entity from an array of JSON entities.
5926
5933
  *
@@ -13546,11 +13553,11 @@ declare class RunInNFrames extends Feature {
13546
13553
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13547
13554
  *
13548
13555
  * @param func The function to run.
13549
- * @param gameFrames The amount of game frames to wait before running the function.
13556
+ * @param numGameFrames The amount of game frames to wait before running the function.
13550
13557
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13551
13558
  * room is loaded in the interim. Default is false.
13552
13559
  */
13553
- runInNGameFrames(func: () => void, gameFrames: int, cancelIfRoomChanges?: boolean): void;
13560
+ runInNGameFrames(func: () => void, numGameFrames: int, cancelIfRoomChanges?: boolean): void;
13554
13561
  /**
13555
13562
  * Supply a function to run N render frames from now in the `POST_RENDER` callback.
13556
13563
  *
@@ -13564,11 +13571,11 @@ declare class RunInNFrames extends Feature {
13564
13571
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13565
13572
  *
13566
13573
  * @param func The function to run.
13567
- * @param renderFrames The amount of render frames to wait before running the function.
13574
+ * @param numRenderFrames The amount of render frames to wait before running the function.
13568
13575
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13569
13576
  * room is loaded in the interim. Default is false.
13570
13577
  */
13571
- runInNRenderFrames(func: () => void, renderFrames: int, cancelIfRoomChanges?: boolean): void;
13578
+ runInNRenderFrames(func: () => void, numRenderFrames: int, cancelIfRoomChanges?: boolean): void;
13572
13579
  /**
13573
13580
  * Supply a function to run on the next `POST_UPDATE` callback.
13574
13581
  *
@@ -13633,13 +13640,13 @@ declare class RunInNFrames extends Feature {
13633
13640
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13634
13641
  *
13635
13642
  * @param func The function to repeatedly run on an interval.
13636
- * @param gameFrames The amount of game frames to wait between each run.
13643
+ * @param numGameFrames The amount of game frames to wait between each run.
13637
13644
  * @param runImmediately Whether or not to execute the function right now before waiting for the
13638
13645
  * interval.
13639
13646
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13640
13647
  * room is loaded in the interim. Default is false.
13641
13648
  */
13642
- setIntervalGameFrames(func: () => boolean, gameFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
13649
+ setIntervalGameFrames(func: () => boolean, numGameFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
13643
13650
  /**
13644
13651
  * Supply a function to be repeatedly run on an interval of N render frames in the `POST_RENDER`
13645
13652
  * callback. The function will continue to be fired until `false` is returned from the function.
@@ -13654,13 +13661,13 @@ declare class RunInNFrames extends Feature {
13654
13661
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
13655
13662
  *
13656
13663
  * @param func The function to repeatedly run on an interval.
13657
- * @param renderFrames The amount of game frames to wait between each run.
13664
+ * @param numRenderFrames The amount of game frames to wait between each run.
13658
13665
  * @param runImmediately Whether or not to execute the function right now before waiting for the
13659
13666
  * interval.
13660
13667
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
13661
13668
  * room is loaded in the interim. Default is false.
13662
13669
  */
13663
- setIntervalRenderFrames(func: () => boolean, renderFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
13670
+ setIntervalRenderFrames(func: () => boolean, numRenderFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
13664
13671
  }
13665
13672
 
13666
13673
  /**
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 21.7.0
3
+ isaacscript-common 21.8.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -20336,6 +20336,7 @@ local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
20336
20336
  local GridEntityXMLType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityXMLType
20337
20337
  local ItemConfigCardType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigCardType
20338
20338
  local ItemConfigTag = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTag
20339
+ local ItemPoolType = ____isaac_2Dtypescript_2Ddefinitions.ItemPoolType
20339
20340
  local Keyboard = ____isaac_2Dtypescript_2Ddefinitions.Keyboard
20340
20341
  local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
20341
20342
  local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
@@ -20360,6 +20361,7 @@ ____exports.GRID_ENTITY_TYPE_VALUES = getEnumValues(nil, GridEntityType)
20360
20361
  ____exports.GRID_ENTITY_XML_TYPE_VALUES = getEnumValues(nil, GridEntityXMLType)
20361
20362
  ____exports.ITEM_CONFIG_TAG_VALUES = getEnumValues(nil, ItemConfigTag)
20362
20363
  ____exports.ITEM_CONFIG_CARD_TYPE_VALUES = getEnumValues(nil, ItemConfigCardType)
20364
+ ____exports.ITEM_POOL_TYPE_VALUES = getEnumValues(nil, ItemPoolType)
20363
20365
  ____exports.KEYBOARD_VALUES = getEnumValues(nil, Keyboard)
20364
20366
  ____exports.HEALTH_TYPE_VALUES = getEnumValues(nil, HealthType)
20365
20367
  ____exports.PILL_COLOR_VALUES = getEnumValues(nil, PillColor)
@@ -32292,9 +32294,9 @@ local ____run = require("src.functions.run")
32292
32294
  local restart = ____run.restart
32293
32295
  local ____Feature = require("src.classes.private.Feature")
32294
32296
  local Feature = ____Feature.Feature
32295
- function checkExecuteQueuedFunctions(self, functionTuples, frameCount, newNumRoomsEntered)
32297
+ function checkExecuteQueuedFunctions(self, queuedFunctions, frameCount, newNumRoomsEntered)
32296
32298
  local firingFunctions = __TS__ArrayFilter(
32297
- functionTuples,
32299
+ queuedFunctions,
32298
32300
  function(____, ____bindingPattern0)
32299
32301
  local frameCountToFire
32300
32302
  frameCountToFire = ____bindingPattern0.frameCountToFire
@@ -32308,12 +32310,12 @@ function checkExecuteQueuedFunctions(self, functionTuples, frameCount, newNumRoo
32308
32310
  if not cancelIfRoomChanges or numRoomsEntered == newNumRoomsEntered then
32309
32311
  func(nil)
32310
32312
  end
32311
- arrayRemoveInPlace(nil, functionTuples, firingFunction)
32313
+ arrayRemoveInPlace(nil, queuedFunctions, firingFunction)
32312
32314
  end
32313
32315
  end
32314
- function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumRoomsEntered)
32316
+ function checkExecuteIntervalFunctions(self, intervalFunctions, frameCount, newNumRoomsEntered)
32315
32317
  local firingFunctions = __TS__ArrayFilter(
32316
- functionTuples,
32318
+ intervalFunctions,
32317
32319
  function(____, ____bindingPattern0)
32318
32320
  local frameCountToFire
32319
32321
  frameCountToFire = ____bindingPattern0.frameCountToFire
@@ -32329,7 +32331,7 @@ function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumR
32329
32331
  if not cancelIfRoomChanges or numRoomsEntered == newNumRoomsEntered then
32330
32332
  returnValue = func(nil)
32331
32333
  end
32332
- arrayRemoveInPlace(nil, functionTuples, firingFunction)
32334
+ arrayRemoveInPlace(nil, intervalFunctions, firingFunction)
32333
32335
  if returnValue then
32334
32336
  local newIntervalFunction = {
32335
32337
  func = func,
@@ -32338,7 +32340,7 @@ function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumR
32338
32340
  cancelIfRoomChanges = cancelIfRoomChanges,
32339
32341
  numIntervalFrames = numIntervalFrames
32340
32342
  }
32341
- functionTuples[#functionTuples + 1] = newIntervalFunction
32343
+ intervalFunctions[#intervalFunctions + 1] = newIntervalFunction
32342
32344
  end
32343
32345
  end
32344
32346
  end
@@ -32371,24 +32373,24 @@ function RunInNFrames.prototype.restartNextRenderFrame(self, character)
32371
32373
  restart(nil, character)
32372
32374
  end)
32373
32375
  end
32374
- function RunInNFrames.prototype.runInNGameFrames(self, func, gameFrames, cancelIfRoomChanges)
32376
+ function RunInNFrames.prototype.runInNGameFrames(self, func, numGameFrames, cancelIfRoomChanges)
32375
32377
  if cancelIfRoomChanges == nil then
32376
32378
  cancelIfRoomChanges = false
32377
32379
  end
32378
32380
  local gameFrameCount = game:GetFrameCount()
32379
32381
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
32380
- local frameCountToFire = gameFrameCount + gameFrames
32382
+ local frameCountToFire = gameFrameCount + numGameFrames
32381
32383
  local queuedFunction = {func = func, frameCountToFire = frameCountToFire, numRoomsEntered = numRoomsEntered, cancelIfRoomChanges = cancelIfRoomChanges}
32382
32384
  local ____self_v_run_queuedGameFunctions_0 = self.v.run.queuedGameFunctions
32383
32385
  ____self_v_run_queuedGameFunctions_0[#____self_v_run_queuedGameFunctions_0 + 1] = queuedFunction
32384
32386
  end
32385
- function RunInNFrames.prototype.runInNRenderFrames(self, func, renderFrames, cancelIfRoomChanges)
32387
+ function RunInNFrames.prototype.runInNRenderFrames(self, func, numRenderFrames, cancelIfRoomChanges)
32386
32388
  if cancelIfRoomChanges == nil then
32387
32389
  cancelIfRoomChanges = false
32388
32390
  end
32389
32391
  local renderFrameCount = Isaac.GetFrameCount()
32390
32392
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
32391
- local frameCountToFire = renderFrameCount + renderFrames
32393
+ local frameCountToFire = renderFrameCount + numRenderFrames
32392
32394
  local queuedFunction = {func = func, frameCountToFire = frameCountToFire, numRoomsEntered = numRoomsEntered, cancelIfRoomChanges = cancelIfRoomChanges}
32393
32395
  local ____self_v_run_queuedRenderFunctions_1 = self.v.run.queuedRenderFunctions
32394
32396
  ____self_v_run_queuedRenderFunctions_1[#____self_v_run_queuedRenderFunctions_1 + 1] = queuedFunction
@@ -32405,43 +32407,49 @@ function RunInNFrames.prototype.runNextRenderFrame(self, func, cancelIfRoomChang
32405
32407
  end
32406
32408
  self:runInNRenderFrames(func, 1, cancelIfRoomChanges)
32407
32409
  end
32408
- function RunInNFrames.prototype.setIntervalGameFrames(self, func, gameFrames, runImmediately, cancelIfRoomChanges)
32410
+ function RunInNFrames.prototype.setIntervalGameFrames(self, func, numGameFrames, runImmediately, cancelIfRoomChanges)
32409
32411
  if cancelIfRoomChanges == nil then
32410
32412
  cancelIfRoomChanges = false
32411
32413
  end
32414
+ if runImmediately then
32415
+ local returnValue = func(nil)
32416
+ if not returnValue then
32417
+ return
32418
+ end
32419
+ end
32412
32420
  local gameFrameCount = game:GetFrameCount()
32413
32421
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
32414
32422
  local intervalFunction = {
32415
32423
  func = func,
32416
- frameCountToFire = gameFrameCount + gameFrames,
32424
+ frameCountToFire = gameFrameCount + numGameFrames,
32417
32425
  numRoomsEntered = numRoomsEntered,
32418
32426
  cancelIfRoomChanges = cancelIfRoomChanges,
32419
- numIntervalFrames = gameFrames
32427
+ numIntervalFrames = numGameFrames
32420
32428
  }
32421
32429
  local ____self_v_run_intervalGameFunctions_2 = self.v.run.intervalGameFunctions
32422
32430
  ____self_v_run_intervalGameFunctions_2[#____self_v_run_intervalGameFunctions_2 + 1] = intervalFunction
32423
- if runImmediately then
32424
- func(nil)
32425
- end
32426
32431
  end
32427
- function RunInNFrames.prototype.setIntervalRenderFrames(self, func, renderFrames, runImmediately, cancelIfRoomChanges)
32432
+ function RunInNFrames.prototype.setIntervalRenderFrames(self, func, numRenderFrames, runImmediately, cancelIfRoomChanges)
32428
32433
  if cancelIfRoomChanges == nil then
32429
32434
  cancelIfRoomChanges = false
32430
32435
  end
32436
+ if runImmediately then
32437
+ local returnValue = func(nil)
32438
+ if not returnValue then
32439
+ return
32440
+ end
32441
+ end
32431
32442
  local renderFrameCount = Isaac.GetFrameCount()
32432
32443
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
32433
32444
  local intervalFunction = {
32434
32445
  func = func,
32435
- frameCountToFire = renderFrameCount + renderFrames,
32446
+ frameCountToFire = renderFrameCount + numRenderFrames,
32436
32447
  numRoomsEntered = numRoomsEntered,
32437
32448
  cancelIfRoomChanges = cancelIfRoomChanges,
32438
- numIntervalFrames = renderFrames
32449
+ numIntervalFrames = numRenderFrames
32439
32450
  }
32440
- local ____self_v_run_intervalGameFunctions_3 = self.v.run.intervalGameFunctions
32441
- ____self_v_run_intervalGameFunctions_3[#____self_v_run_intervalGameFunctions_3 + 1] = intervalFunction
32442
- if runImmediately then
32443
- func(nil)
32444
- end
32451
+ local ____self_v_run_intervalRenderFunctions_3 = self.v.run.intervalRenderFunctions
32452
+ ____self_v_run_intervalRenderFunctions_3[#____self_v_run_intervalRenderFunctions_3 + 1] = intervalFunction
32445
32453
  end
32446
32454
  __TS__Decorate({Exported}, RunInNFrames.prototype, "restartNextRenderFrame", true)
32447
32455
  __TS__Decorate({Exported}, RunInNFrames.prototype, "runInNGameFrames", true)
@@ -51382,6 +51390,68 @@ function ____exports.initArray(self, defaultValue, size)
51382
51390
  )
51383
51391
  return array
51384
51392
  end
51393
+ return ____exports
51394
+ end,
51395
+ ["src.functions.itemPool"] = function(...)
51396
+ local ____lualib = require("lualib_bundle")
51397
+ local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
51398
+ local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
51399
+ local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
51400
+ local ____exports = {}
51401
+ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
51402
+ local ItemPoolType = ____isaac_2Dtypescript_2Ddefinitions.ItemPoolType
51403
+ local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
51404
+ local ITEM_POOL_TYPE_VALUES = ____cachedEnumValues.ITEM_POOL_TYPE_VALUES
51405
+ local ____array = require("src.functions.array")
51406
+ local arrayRemove = ____array.arrayRemove
51407
+ local getRandomArrayElement = ____array.getRandomArrayElement
51408
+ local ____run = require("src.functions.run")
51409
+ local isGreedMode = ____run.isGreedMode
51410
+ local NORMAL_MODE_ONLY_ITEM_POOL_TYPES = {
51411
+ ItemPoolType.TREASURE,
51412
+ ItemPoolType.BOSS,
51413
+ ItemPoolType.SHOP,
51414
+ ItemPoolType.DEVIL,
51415
+ ItemPoolType.ANGEL,
51416
+ ItemPoolType.CURSE,
51417
+ ItemPoolType.SECRET
51418
+ }
51419
+ local GREED_MODE_ONLY_ITEM_POOL_TYPES = {
51420
+ ItemPoolType.GREED_TREASURE,
51421
+ ItemPoolType.GREED_BOSS,
51422
+ ItemPoolType.GREED_SHOP,
51423
+ ItemPoolType.GREED_DEVIL,
51424
+ ItemPoolType.GREED_ANGEL,
51425
+ ItemPoolType.GREED_CURSE,
51426
+ ItemPoolType.GREED_SECRET
51427
+ }
51428
+ local FAKE_ITEM_POOL_TYPES = {ItemPoolType.SHELL_GAME}
51429
+ local ____arrayRemove_1 = arrayRemove
51430
+ local ____array_0 = __TS__SparseArrayNew(
51431
+ nil,
51432
+ ITEM_POOL_TYPE_VALUES,
51433
+ table.unpack(GREED_MODE_ONLY_ITEM_POOL_TYPES)
51434
+ )
51435
+ __TS__SparseArrayPush(
51436
+ ____array_0,
51437
+ table.unpack(FAKE_ITEM_POOL_TYPES)
51438
+ )
51439
+ local NORMAL_MODE_ITEM_POOL_TYPES = ____arrayRemove_1(__TS__SparseArraySpread(____array_0))
51440
+ local ____arrayRemove_3 = arrayRemove
51441
+ local ____array_2 = __TS__SparseArrayNew(
51442
+ nil,
51443
+ ITEM_POOL_TYPE_VALUES,
51444
+ table.unpack(NORMAL_MODE_ONLY_ITEM_POOL_TYPES)
51445
+ )
51446
+ __TS__SparseArrayPush(
51447
+ ____array_2,
51448
+ table.unpack(FAKE_ITEM_POOL_TYPES)
51449
+ )
51450
+ local GREED_MODE_ITEM_POOL_TYPES = ____arrayRemove_3(__TS__SparseArraySpread(____array_2))
51451
+ function ____exports.getRandomItemPool(self)
51452
+ local itemPoolTypes = isGreedMode(nil) and GREED_MODE_ITEM_POOL_TYPES or NORMAL_MODE_ITEM_POOL_TYPES
51453
+ return getRandomArrayElement(nil, itemPoolTypes)
51454
+ end
51385
51455
  return ____exports
51386
51456
  end,
51387
51457
  ["src.objects.languageNames"] = function(...)
@@ -52408,6 +52478,14 @@ do
52408
52478
  end
52409
52479
  end
52410
52480
  end
52481
+ do
52482
+ local ____export = require("src.functions.itemPool")
52483
+ for ____exportKey, ____exportValue in pairs(____export) do
52484
+ if ____exportKey ~= "default" then
52485
+ ____exports[____exportKey] = ____exportValue
52486
+ end
52487
+ end
52488
+ end
52411
52489
  do
52412
52490
  local ____export = require("src.functions.jsonHelpers")
52413
52491
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -53508,6 +53586,14 @@ do
53508
53586
  end
53509
53587
  end
53510
53588
  end
53589
+ do
53590
+ local ____export = require("src.functions.itemPool")
53591
+ for ____exportKey, ____exportValue in pairs(____export) do
53592
+ if ____exportKey ~= "default" then
53593
+ ____exports[____exportKey] = ____exportValue
53594
+ end
53595
+ end
53596
+ end
53511
53597
  do
53512
53598
  local ____export = require("src.functions.jsonHelpers")
53513
53599
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -1,4 +1,4 @@
1
- import { ActiveSlot, CacheFlag, ControllerIndex, DoorSlot, DoorSlotFlag, GridEntityType, GridEntityXMLType, ItemConfigCardType, ItemConfigTag, Keyboard, PillColor, PlayerForm, PocketItemSlot, RoomShape, SoundEffect, TrinketSlot } from "isaac-typescript-definitions";
1
+ import { ActiveSlot, CacheFlag, ControllerIndex, DoorSlot, DoorSlotFlag, GridEntityType, GridEntityXMLType, ItemConfigCardType, ItemConfigTag, ItemPoolType, Keyboard, PillColor, PlayerForm, PocketItemSlot, RoomShape, SoundEffect, TrinketSlot } from "isaac-typescript-definitions";
2
2
  import { HealthType } from "../enums/HealthType";
3
3
  import { SerializationBrand } from "../enums/SerializationBrand";
4
4
  import { StatType } from "../enums/StatType";
@@ -11,6 +11,7 @@ export declare const GRID_ENTITY_TYPE_VALUES: readonly GridEntityType[];
11
11
  export declare const GRID_ENTITY_XML_TYPE_VALUES: readonly GridEntityXMLType[];
12
12
  export declare const ITEM_CONFIG_TAG_VALUES: readonly ItemConfigTag[];
13
13
  export declare const ITEM_CONFIG_CARD_TYPE_VALUES: readonly ItemConfigCardType[];
14
+ export declare const ITEM_POOL_TYPE_VALUES: readonly ItemPoolType[];
14
15
  export declare const KEYBOARD_VALUES: readonly Keyboard[];
15
16
  export declare const HEALTH_TYPE_VALUES: readonly HealthType[];
16
17
  export declare const PILL_COLOR_VALUES: readonly PillColor[];
@@ -1 +1 @@
1
- {"version":3,"file":"cachedEnumValues.d.ts","sourceRoot":"","sources":["../../../src/arrays/cachedEnumValues.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,SAAS,EACT,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,EACT,WAAW,EACX,WAAW,EACZ,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,eAAO,MAAM,kBAAkB,EAAE,SAAS,UAAU,EACzB,CAAC;AAE5B,eAAO,MAAM,iBAAiB,EAAE,SAAS,SAAS,EAA6B,CAA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SAAS,kBAAkB,EACjC,CAAC;AAEpC,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAC1B,CAAC;AAE7B,eAAO,MAAM,gBAAgB,EAAE,SAAS,QAAQ,EAA4B,CAAC;AAE7E,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAC1B,CAAC"}
@@ -9,6 +9,7 @@ local GridEntityType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityType
9
9
  local GridEntityXMLType = ____isaac_2Dtypescript_2Ddefinitions.GridEntityXMLType
10
10
  local ItemConfigCardType = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigCardType
11
11
  local ItemConfigTag = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTag
12
+ local ItemPoolType = ____isaac_2Dtypescript_2Ddefinitions.ItemPoolType
12
13
  local Keyboard = ____isaac_2Dtypescript_2Ddefinitions.Keyboard
13
14
  local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
14
15
  local PlayerForm = ____isaac_2Dtypescript_2Ddefinitions.PlayerForm
@@ -33,6 +34,7 @@ ____exports.GRID_ENTITY_TYPE_VALUES = getEnumValues(nil, GridEntityType)
33
34
  ____exports.GRID_ENTITY_XML_TYPE_VALUES = getEnumValues(nil, GridEntityXMLType)
34
35
  ____exports.ITEM_CONFIG_TAG_VALUES = getEnumValues(nil, ItemConfigTag)
35
36
  ____exports.ITEM_CONFIG_CARD_TYPE_VALUES = getEnumValues(nil, ItemConfigCardType)
37
+ ____exports.ITEM_POOL_TYPE_VALUES = getEnumValues(nil, ItemPoolType)
36
38
  ____exports.KEYBOARD_VALUES = getEnumValues(nil, Keyboard)
37
39
  ____exports.HEALTH_TYPE_VALUES = getEnumValues(nil, HealthType)
38
40
  ____exports.PILL_COLOR_VALUES = getEnumValues(nil, PillColor)
@@ -28,11 +28,11 @@ export declare class RunInNFrames extends Feature {
28
28
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
29
29
  *
30
30
  * @param func The function to run.
31
- * @param gameFrames The amount of game frames to wait before running the function.
31
+ * @param numGameFrames The amount of game frames to wait before running the function.
32
32
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
33
33
  * room is loaded in the interim. Default is false.
34
34
  */
35
- runInNGameFrames(func: () => void, gameFrames: int, cancelIfRoomChanges?: boolean): void;
35
+ runInNGameFrames(func: () => void, numGameFrames: int, cancelIfRoomChanges?: boolean): void;
36
36
  /**
37
37
  * Supply a function to run N render frames from now in the `POST_RENDER` callback.
38
38
  *
@@ -46,11 +46,11 @@ export declare class RunInNFrames extends Feature {
46
46
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
47
47
  *
48
48
  * @param func The function to run.
49
- * @param renderFrames The amount of render frames to wait before running the function.
49
+ * @param numRenderFrames The amount of render frames to wait before running the function.
50
50
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
51
51
  * room is loaded in the interim. Default is false.
52
52
  */
53
- runInNRenderFrames(func: () => void, renderFrames: int, cancelIfRoomChanges?: boolean): void;
53
+ runInNRenderFrames(func: () => void, numRenderFrames: int, cancelIfRoomChanges?: boolean): void;
54
54
  /**
55
55
  * Supply a function to run on the next `POST_UPDATE` callback.
56
56
  *
@@ -115,13 +115,13 @@ export declare class RunInNFrames extends Feature {
115
115
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
116
116
  *
117
117
  * @param func The function to repeatedly run on an interval.
118
- * @param gameFrames The amount of game frames to wait between each run.
118
+ * @param numGameFrames The amount of game frames to wait between each run.
119
119
  * @param runImmediately Whether or not to execute the function right now before waiting for the
120
120
  * interval.
121
121
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
122
122
  * room is loaded in the interim. Default is false.
123
123
  */
124
- setIntervalGameFrames(func: () => boolean, gameFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
124
+ setIntervalGameFrames(func: () => boolean, numGameFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
125
125
  /**
126
126
  * Supply a function to be repeatedly run on an interval of N render frames in the `POST_RENDER`
127
127
  * callback. The function will continue to be fired until `false` is returned from the function.
@@ -136,12 +136,12 @@ export declare class RunInNFrames extends Feature {
136
136
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
137
137
  *
138
138
  * @param func The function to repeatedly run on an interval.
139
- * @param renderFrames The amount of game frames to wait between each run.
139
+ * @param numRenderFrames The amount of game frames to wait between each run.
140
140
  * @param runImmediately Whether or not to execute the function right now before waiting for the
141
141
  * interval.
142
142
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
143
143
  * room is loaded in the interim. Default is false.
144
144
  */
145
- setIntervalRenderFrames(func: () => boolean, renderFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
145
+ setIntervalRenderFrames(func: () => boolean, numRenderFrames: int, runImmediately: boolean, cancelIfRoomChanges?: boolean): void;
146
146
  }
147
147
  //# sourceMappingURL=RunInNFrames.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RunInNFrames.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/RunInNFrames.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAMvE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAwBhD,qBAAa,YAAa,SAAQ,OAAO;IAYvB,gBAAgB,QAAO,OAAO,CAAU;IAExD,OAAO,CAAC,WAAW,CAAc;IAoBjC,OAAO,CAAC,UAAU,CAchB;IAGF,OAAO,CAAC,UAAU,CAchB;IAEF;;;;;;;;OAQG;IAEI,sBAAsB,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,IAAI;IAM3D;;;;;;;;;;;;;;;;OAgBG;IAEI,gBAAgB,CACrB,IAAI,EAAE,MAAM,IAAI,EAChB,UAAU,EAAE,GAAG,EACf,mBAAmB,UAAQ,GAC1B,IAAI;IAc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,GAAG,EAClB,mBAAmB,UAAQ,GAC1B,IAAI;IAcP;;;;;;;;;;;;;;;;OAgBG;IAEI,kBAAkB,CACvB,IAAI,EAAE,MAAM,IAAI,EAChB,eAAe,EAAE,GAAG,EACpB,mBAAmB,UAAQ,GAC1B,IAAI;IAcP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IAEI,gBAAgB,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,mBAAmB,UAAQ,GAAG,IAAI;IAI5E;;;;;;;;;;;;;OAaG;IAEI,kBAAkB,CACvB,IAAI,EAAE,MAAM,IAAI,EAChB,mBAAmB,UAAQ,GAC1B,IAAI;IAIP;;;;;;;;;;;;;;;;;;;OAmBG;IAEI,qBAAqB,CAC1B,IAAI,EAAE,MAAM,OAAO,EACnB,aAAa,EAAE,GAAG,EAClB,cAAc,EAAE,OAAO,EACvB,mBAAmB,UAAQ,GAC1B,IAAI;IAqBP;;;;;;;;;;;;;;;;;;;OAmBG;IAEI,uBAAuB,CAC5B,IAAI,EAAE,MAAM,OAAO,EACnB,eAAe,EAAE,GAAG,EACpB,cAAc,EAAE,OAAO,EACvB,mBAAmB,UAAQ,GAC1B,IAAI;CAoBR"}
@@ -19,9 +19,9 @@ local ____run = require("src.functions.run")
19
19
  local restart = ____run.restart
20
20
  local ____Feature = require("src.classes.private.Feature")
21
21
  local Feature = ____Feature.Feature
22
- function checkExecuteQueuedFunctions(self, functionTuples, frameCount, newNumRoomsEntered)
22
+ function checkExecuteQueuedFunctions(self, queuedFunctions, frameCount, newNumRoomsEntered)
23
23
  local firingFunctions = __TS__ArrayFilter(
24
- functionTuples,
24
+ queuedFunctions,
25
25
  function(____, ____bindingPattern0)
26
26
  local frameCountToFire
27
27
  frameCountToFire = ____bindingPattern0.frameCountToFire
@@ -35,12 +35,12 @@ function checkExecuteQueuedFunctions(self, functionTuples, frameCount, newNumRoo
35
35
  if not cancelIfRoomChanges or numRoomsEntered == newNumRoomsEntered then
36
36
  func(nil)
37
37
  end
38
- arrayRemoveInPlace(nil, functionTuples, firingFunction)
38
+ arrayRemoveInPlace(nil, queuedFunctions, firingFunction)
39
39
  end
40
40
  end
41
- function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumRoomsEntered)
41
+ function checkExecuteIntervalFunctions(self, intervalFunctions, frameCount, newNumRoomsEntered)
42
42
  local firingFunctions = __TS__ArrayFilter(
43
- functionTuples,
43
+ intervalFunctions,
44
44
  function(____, ____bindingPattern0)
45
45
  local frameCountToFire
46
46
  frameCountToFire = ____bindingPattern0.frameCountToFire
@@ -56,7 +56,7 @@ function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumR
56
56
  if not cancelIfRoomChanges or numRoomsEntered == newNumRoomsEntered then
57
57
  returnValue = func(nil)
58
58
  end
59
- arrayRemoveInPlace(nil, functionTuples, firingFunction)
59
+ arrayRemoveInPlace(nil, intervalFunctions, firingFunction)
60
60
  if returnValue then
61
61
  local newIntervalFunction = {
62
62
  func = func,
@@ -65,7 +65,7 @@ function checkExecuteIntervalFunctions(self, functionTuples, frameCount, newNumR
65
65
  cancelIfRoomChanges = cancelIfRoomChanges,
66
66
  numIntervalFrames = numIntervalFrames
67
67
  }
68
- functionTuples[#functionTuples + 1] = newIntervalFunction
68
+ intervalFunctions[#intervalFunctions + 1] = newIntervalFunction
69
69
  end
70
70
  end
71
71
  end
@@ -98,24 +98,24 @@ function RunInNFrames.prototype.restartNextRenderFrame(self, character)
98
98
  restart(nil, character)
99
99
  end)
100
100
  end
101
- function RunInNFrames.prototype.runInNGameFrames(self, func, gameFrames, cancelIfRoomChanges)
101
+ function RunInNFrames.prototype.runInNGameFrames(self, func, numGameFrames, cancelIfRoomChanges)
102
102
  if cancelIfRoomChanges == nil then
103
103
  cancelIfRoomChanges = false
104
104
  end
105
105
  local gameFrameCount = game:GetFrameCount()
106
106
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
107
- local frameCountToFire = gameFrameCount + gameFrames
107
+ local frameCountToFire = gameFrameCount + numGameFrames
108
108
  local queuedFunction = {func = func, frameCountToFire = frameCountToFire, numRoomsEntered = numRoomsEntered, cancelIfRoomChanges = cancelIfRoomChanges}
109
109
  local ____self_v_run_queuedGameFunctions_0 = self.v.run.queuedGameFunctions
110
110
  ____self_v_run_queuedGameFunctions_0[#____self_v_run_queuedGameFunctions_0 + 1] = queuedFunction
111
111
  end
112
- function RunInNFrames.prototype.runInNRenderFrames(self, func, renderFrames, cancelIfRoomChanges)
112
+ function RunInNFrames.prototype.runInNRenderFrames(self, func, numRenderFrames, cancelIfRoomChanges)
113
113
  if cancelIfRoomChanges == nil then
114
114
  cancelIfRoomChanges = false
115
115
  end
116
116
  local renderFrameCount = Isaac.GetFrameCount()
117
117
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
118
- local frameCountToFire = renderFrameCount + renderFrames
118
+ local frameCountToFire = renderFrameCount + numRenderFrames
119
119
  local queuedFunction = {func = func, frameCountToFire = frameCountToFire, numRoomsEntered = numRoomsEntered, cancelIfRoomChanges = cancelIfRoomChanges}
120
120
  local ____self_v_run_queuedRenderFunctions_1 = self.v.run.queuedRenderFunctions
121
121
  ____self_v_run_queuedRenderFunctions_1[#____self_v_run_queuedRenderFunctions_1 + 1] = queuedFunction
@@ -132,43 +132,49 @@ function RunInNFrames.prototype.runNextRenderFrame(self, func, cancelIfRoomChang
132
132
  end
133
133
  self:runInNRenderFrames(func, 1, cancelIfRoomChanges)
134
134
  end
135
- function RunInNFrames.prototype.setIntervalGameFrames(self, func, gameFrames, runImmediately, cancelIfRoomChanges)
135
+ function RunInNFrames.prototype.setIntervalGameFrames(self, func, numGameFrames, runImmediately, cancelIfRoomChanges)
136
136
  if cancelIfRoomChanges == nil then
137
137
  cancelIfRoomChanges = false
138
138
  end
139
+ if runImmediately then
140
+ local returnValue = func(nil)
141
+ if not returnValue then
142
+ return
143
+ end
144
+ end
139
145
  local gameFrameCount = game:GetFrameCount()
140
146
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
141
147
  local intervalFunction = {
142
148
  func = func,
143
- frameCountToFire = gameFrameCount + gameFrames,
149
+ frameCountToFire = gameFrameCount + numGameFrames,
144
150
  numRoomsEntered = numRoomsEntered,
145
151
  cancelIfRoomChanges = cancelIfRoomChanges,
146
- numIntervalFrames = gameFrames
152
+ numIntervalFrames = numGameFrames
147
153
  }
148
154
  local ____self_v_run_intervalGameFunctions_2 = self.v.run.intervalGameFunctions
149
155
  ____self_v_run_intervalGameFunctions_2[#____self_v_run_intervalGameFunctions_2 + 1] = intervalFunction
150
- if runImmediately then
151
- func(nil)
152
- end
153
156
  end
154
- function RunInNFrames.prototype.setIntervalRenderFrames(self, func, renderFrames, runImmediately, cancelIfRoomChanges)
157
+ function RunInNFrames.prototype.setIntervalRenderFrames(self, func, numRenderFrames, runImmediately, cancelIfRoomChanges)
155
158
  if cancelIfRoomChanges == nil then
156
159
  cancelIfRoomChanges = false
157
160
  end
161
+ if runImmediately then
162
+ local returnValue = func(nil)
163
+ if not returnValue then
164
+ return
165
+ end
166
+ end
158
167
  local renderFrameCount = Isaac.GetFrameCount()
159
168
  local numRoomsEntered = self.roomHistory:getNumRoomsEntered()
160
169
  local intervalFunction = {
161
170
  func = func,
162
- frameCountToFire = renderFrameCount + renderFrames,
171
+ frameCountToFire = renderFrameCount + numRenderFrames,
163
172
  numRoomsEntered = numRoomsEntered,
164
173
  cancelIfRoomChanges = cancelIfRoomChanges,
165
- numIntervalFrames = renderFrames
174
+ numIntervalFrames = numRenderFrames
166
175
  }
167
- local ____self_v_run_intervalGameFunctions_3 = self.v.run.intervalGameFunctions
168
- ____self_v_run_intervalGameFunctions_3[#____self_v_run_intervalGameFunctions_3 + 1] = intervalFunction
169
- if runImmediately then
170
- func(nil)
171
- end
176
+ local ____self_v_run_intervalRenderFunctions_3 = self.v.run.intervalRenderFunctions
177
+ ____self_v_run_intervalRenderFunctions_3[#____self_v_run_intervalRenderFunctions_3 + 1] = intervalFunction
172
178
  end
173
179
  __TS__Decorate({Exported}, RunInNFrames.prototype, "restartNextRenderFrame", true)
174
180
  __TS__Decorate({Exported}, RunInNFrames.prototype, "runInNGameFrames", true)
@@ -0,0 +1,8 @@
1
+ import { ItemPoolType } from "isaac-typescript-definitions";
2
+ /**
3
+ * Helper function to get a random item pool. This is not as simple as getting a random value from
4
+ * the `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the
5
+ * Greed Mode item pools should be excluded if not playing in Greed Mode.
6
+ */
7
+ export declare function getRandomItemPool(): ItemPoolType;
8
+ //# sourceMappingURL=itemPool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"itemPool.d.ts","sourceRoot":"","sources":["../../../src/functions/itemPool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAuC5D;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,CAKhD"}
@@ -0,0 +1,63 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local __TS__SparseArrayNew = ____lualib.__TS__SparseArrayNew
3
+ local __TS__SparseArrayPush = ____lualib.__TS__SparseArrayPush
4
+ local __TS__SparseArraySpread = ____lualib.__TS__SparseArraySpread
5
+ local ____exports = {}
6
+ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
7
+ local ItemPoolType = ____isaac_2Dtypescript_2Ddefinitions.ItemPoolType
8
+ local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
9
+ local ITEM_POOL_TYPE_VALUES = ____cachedEnumValues.ITEM_POOL_TYPE_VALUES
10
+ local ____array = require("src.functions.array")
11
+ local arrayRemove = ____array.arrayRemove
12
+ local getRandomArrayElement = ____array.getRandomArrayElement
13
+ local ____run = require("src.functions.run")
14
+ local isGreedMode = ____run.isGreedMode
15
+ local NORMAL_MODE_ONLY_ITEM_POOL_TYPES = {
16
+ ItemPoolType.TREASURE,
17
+ ItemPoolType.BOSS,
18
+ ItemPoolType.SHOP,
19
+ ItemPoolType.DEVIL,
20
+ ItemPoolType.ANGEL,
21
+ ItemPoolType.CURSE,
22
+ ItemPoolType.SECRET
23
+ }
24
+ local GREED_MODE_ONLY_ITEM_POOL_TYPES = {
25
+ ItemPoolType.GREED_TREASURE,
26
+ ItemPoolType.GREED_BOSS,
27
+ ItemPoolType.GREED_SHOP,
28
+ ItemPoolType.GREED_DEVIL,
29
+ ItemPoolType.GREED_ANGEL,
30
+ ItemPoolType.GREED_CURSE,
31
+ ItemPoolType.GREED_SECRET
32
+ }
33
+ local FAKE_ITEM_POOL_TYPES = {ItemPoolType.SHELL_GAME}
34
+ local ____arrayRemove_1 = arrayRemove
35
+ local ____array_0 = __TS__SparseArrayNew(
36
+ nil,
37
+ ITEM_POOL_TYPE_VALUES,
38
+ table.unpack(GREED_MODE_ONLY_ITEM_POOL_TYPES)
39
+ )
40
+ __TS__SparseArrayPush(
41
+ ____array_0,
42
+ table.unpack(FAKE_ITEM_POOL_TYPES)
43
+ )
44
+ local NORMAL_MODE_ITEM_POOL_TYPES = ____arrayRemove_1(__TS__SparseArraySpread(____array_0))
45
+ local ____arrayRemove_3 = arrayRemove
46
+ local ____array_2 = __TS__SparseArrayNew(
47
+ nil,
48
+ ITEM_POOL_TYPE_VALUES,
49
+ table.unpack(NORMAL_MODE_ONLY_ITEM_POOL_TYPES)
50
+ )
51
+ __TS__SparseArrayPush(
52
+ ____array_2,
53
+ table.unpack(FAKE_ITEM_POOL_TYPES)
54
+ )
55
+ local GREED_MODE_ITEM_POOL_TYPES = ____arrayRemove_3(__TS__SparseArraySpread(____array_2))
56
+ --- Helper function to get a random item pool. This is not as simple as getting a random value from
57
+ -- the `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the
58
+ -- Greed Mode item pools should be excluded if not playing in Greed Mode.
59
+ function ____exports.getRandomItemPool(self)
60
+ local itemPoolTypes = isGreedMode(nil) and GREED_MODE_ITEM_POOL_TYPES or NORMAL_MODE_ITEM_POOL_TYPES
61
+ return getRandomArrayElement(nil, itemPoolTypes)
62
+ end
63
+ return ____exports
@@ -61,6 +61,7 @@ export * from "./functions/hex";
61
61
  export * from "./functions/initArray";
62
62
  export * from "./functions/input";
63
63
  export * from "./functions/isaacAPIClass";
64
+ export * from "./functions/itemPool";
64
65
  export * from "./functions/jsonHelpers";
65
66
  export * from "./functions/jsonRoom";
66
67
  export * from "./functions/kColor";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;A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  end
505
505
  end
506
+ do
507
+ local ____export = require("src.functions.itemPool")
508
+ for ____exportKey, ____exportValue in pairs(____export) do
509
+ if ____exportKey ~= "default" then
510
+ ____exports[____exportKey] = ____exportValue
511
+ end
512
+ end
513
+ end
506
514
  do
507
515
  local ____export = require("src.functions.jsonHelpers")
508
516
  for ____exportKey, ____exportValue in pairs(____export) do
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "21.7.0",
3
+ "version": "21.8.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -10,6 +10,7 @@ import {
10
10
  GridEntityXMLType,
11
11
  ItemConfigCardType,
12
12
  ItemConfigTag,
13
+ ItemPoolType,
13
14
  Keyboard,
14
15
  PillColor,
15
16
  PlayerForm,
@@ -48,6 +49,9 @@ export const ITEM_CONFIG_TAG_VALUES: readonly ItemConfigTag[] =
48
49
  export const ITEM_CONFIG_CARD_TYPE_VALUES: readonly ItemConfigCardType[] =
49
50
  getEnumValues(ItemConfigCardType);
50
51
 
52
+ export const ITEM_POOL_TYPE_VALUES: readonly ItemPoolType[] =
53
+ getEnumValues(ItemPoolType);
54
+
51
55
  export const KEYBOARD_VALUES: readonly Keyboard[] = getEnumValues(Keyboard);
52
56
 
53
57
  export const HEALTH_TYPE_VALUES: readonly HealthType[] =
@@ -20,11 +20,8 @@ interface QueuedFunction {
20
20
  *
21
21
  * The return value is whether or not to continue the function from firing.
22
22
  */
23
- interface IntervalFunction {
23
+ interface IntervalFunction extends QueuedFunction {
24
24
  func: () => boolean;
25
- frameCountToFire: int;
26
- numRoomsEntered: int;
27
- cancelIfRoomChanges: boolean;
28
25
  numIntervalFrames: int;
29
26
  }
30
27
 
@@ -124,20 +121,20 @@ export class RunInNFrames extends Feature {
124
121
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
125
122
  *
126
123
  * @param func The function to run.
127
- * @param gameFrames The amount of game frames to wait before running the function.
124
+ * @param numGameFrames The amount of game frames to wait before running the function.
128
125
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
129
126
  * room is loaded in the interim. Default is false.
130
127
  */
131
128
  @Exported
132
129
  public runInNGameFrames(
133
130
  func: () => void,
134
- gameFrames: int,
131
+ numGameFrames: int,
135
132
  cancelIfRoomChanges = false,
136
133
  ): void {
137
134
  const gameFrameCount = game.GetFrameCount();
138
135
  const numRoomsEntered = this.roomHistory.getNumRoomsEntered();
139
136
 
140
- const frameCountToFire = gameFrameCount + gameFrames;
137
+ const frameCountToFire = gameFrameCount + numGameFrames;
141
138
  const queuedFunction: QueuedFunction = {
142
139
  func,
143
140
  frameCountToFire,
@@ -160,20 +157,20 @@ export class RunInNFrames extends Feature {
160
157
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
161
158
  *
162
159
  * @param func The function to run.
163
- * @param renderFrames The amount of render frames to wait before running the function.
160
+ * @param numRenderFrames The amount of render frames to wait before running the function.
164
161
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
165
162
  * room is loaded in the interim. Default is false.
166
163
  */
167
164
  @Exported
168
165
  public runInNRenderFrames(
169
166
  func: () => void,
170
- renderFrames: int,
167
+ numRenderFrames: int,
171
168
  cancelIfRoomChanges = false,
172
169
  ): void {
173
170
  const renderFrameCount = Isaac.GetFrameCount();
174
171
  const numRoomsEntered = this.roomHistory.getNumRoomsEntered();
175
172
 
176
- const frameCountToFire = renderFrameCount + renderFrames;
173
+ const frameCountToFire = renderFrameCount + numRenderFrames;
177
174
  const queuedFunction: QueuedFunction = {
178
175
  func,
179
176
  frameCountToFire,
@@ -258,7 +255,7 @@ export class RunInNFrames extends Feature {
258
255
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
259
256
  *
260
257
  * @param func The function to repeatedly run on an interval.
261
- * @param gameFrames The amount of game frames to wait between each run.
258
+ * @param numGameFrames The amount of game frames to wait between each run.
262
259
  * @param runImmediately Whether or not to execute the function right now before waiting for the
263
260
  * interval.
264
261
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
@@ -267,25 +264,28 @@ export class RunInNFrames extends Feature {
267
264
  @Exported
268
265
  public setIntervalGameFrames(
269
266
  func: () => boolean,
270
- gameFrames: int,
267
+ numGameFrames: int,
271
268
  runImmediately: boolean,
272
269
  cancelIfRoomChanges = false,
273
270
  ): void {
271
+ if (runImmediately) {
272
+ const returnValue = func();
273
+ if (!returnValue) {
274
+ return;
275
+ }
276
+ }
277
+
274
278
  const gameFrameCount = game.GetFrameCount();
275
279
  const numRoomsEntered = this.roomHistory.getNumRoomsEntered();
276
280
 
277
281
  const intervalFunction: IntervalFunction = {
278
282
  func,
279
- frameCountToFire: gameFrameCount + gameFrames,
283
+ frameCountToFire: gameFrameCount + numGameFrames,
280
284
  numRoomsEntered,
281
285
  cancelIfRoomChanges,
282
- numIntervalFrames: gameFrames,
286
+ numIntervalFrames: numGameFrames,
283
287
  };
284
288
  this.v.run.intervalGameFunctions.push(intervalFunction);
285
-
286
- if (runImmediately) {
287
- func();
288
- }
289
289
  }
290
290
 
291
291
  /**
@@ -302,7 +302,7 @@ export class RunInNFrames extends Feature {
302
302
  * In order to use this function, you must upgrade your mod with `ISCFeature.RUN_IN_N_FRAMES`.
303
303
  *
304
304
  * @param func The function to repeatedly run on an interval.
305
- * @param renderFrames The amount of game frames to wait between each run.
305
+ * @param numRenderFrames The amount of game frames to wait between each run.
306
306
  * @param runImmediately Whether or not to execute the function right now before waiting for the
307
307
  * interval.
308
308
  * @param cancelIfRoomChanges Optional. Whether or not to cancel running the function if a new
@@ -311,34 +311,37 @@ export class RunInNFrames extends Feature {
311
311
  @Exported
312
312
  public setIntervalRenderFrames(
313
313
  func: () => boolean,
314
- renderFrames: int,
314
+ numRenderFrames: int,
315
315
  runImmediately: boolean,
316
316
  cancelIfRoomChanges = false,
317
317
  ): void {
318
+ if (runImmediately) {
319
+ const returnValue = func();
320
+ if (!returnValue) {
321
+ return;
322
+ }
323
+ }
324
+
318
325
  const renderFrameCount = Isaac.GetFrameCount();
319
326
  const numRoomsEntered = this.roomHistory.getNumRoomsEntered();
320
327
 
321
328
  const intervalFunction: IntervalFunction = {
322
329
  func,
323
- frameCountToFire: renderFrameCount + renderFrames,
330
+ frameCountToFire: renderFrameCount + numRenderFrames,
324
331
  numRoomsEntered,
325
332
  cancelIfRoomChanges,
326
- numIntervalFrames: renderFrames,
333
+ numIntervalFrames: numRenderFrames,
327
334
  };
328
- this.v.run.intervalGameFunctions.push(intervalFunction);
329
-
330
- if (runImmediately) {
331
- func();
332
- }
335
+ this.v.run.intervalRenderFunctions.push(intervalFunction);
333
336
  }
334
337
  }
335
338
 
336
339
  function checkExecuteQueuedFunctions(
337
- functionTuples: QueuedFunction[],
340
+ queuedFunctions: QueuedFunction[],
338
341
  frameCount: int,
339
342
  newNumRoomsEntered: int,
340
343
  ) {
341
- const firingFunctions = functionTuples.filter(
344
+ const firingFunctions = queuedFunctions.filter(
342
345
  ({ frameCountToFire }) => frameCount >= frameCountToFire,
343
346
  );
344
347
 
@@ -349,16 +352,16 @@ function checkExecuteQueuedFunctions(
349
352
  func();
350
353
  }
351
354
 
352
- arrayRemoveInPlace(functionTuples, firingFunction);
355
+ arrayRemoveInPlace(queuedFunctions, firingFunction);
353
356
  }
354
357
  }
355
358
 
356
359
  function checkExecuteIntervalFunctions(
357
- functionTuples: IntervalFunction[],
360
+ intervalFunctions: IntervalFunction[],
358
361
  frameCount: int,
359
362
  newNumRoomsEntered: int,
360
363
  ) {
361
- const firingFunctions = functionTuples.filter(
364
+ const firingFunctions = intervalFunctions.filter(
362
365
  ({ frameCountToFire }) => frameCount >= frameCountToFire,
363
366
  );
364
367
 
@@ -371,7 +374,7 @@ function checkExecuteIntervalFunctions(
371
374
  returnValue = func();
372
375
  }
373
376
 
374
- arrayRemoveInPlace(functionTuples, firingFunction);
377
+ arrayRemoveInPlace(intervalFunctions, firingFunction);
375
378
 
376
379
  // Queue the next interval (as long as the function did not return false).
377
380
  if (returnValue) {
@@ -382,7 +385,7 @@ function checkExecuteIntervalFunctions(
382
385
  cancelIfRoomChanges,
383
386
  numIntervalFrames,
384
387
  };
385
- functionTuples.push(newIntervalFunction);
388
+ intervalFunctions.push(newIntervalFunction);
386
389
  }
387
390
  }
388
391
  }
@@ -0,0 +1,50 @@
1
+ import { ItemPoolType } from "isaac-typescript-definitions";
2
+ import { ITEM_POOL_TYPE_VALUES } from "../arrays/cachedEnumValues";
3
+ import { arrayRemove, getRandomArrayElement } from "./array";
4
+ import { isGreedMode } from "./run";
5
+
6
+ const NORMAL_MODE_ONLY_ITEM_POOL_TYPES = [
7
+ ItemPoolType.TREASURE, // 0
8
+ ItemPoolType.BOSS, // 2
9
+ ItemPoolType.SHOP, // 1
10
+ ItemPoolType.DEVIL, // 3
11
+ ItemPoolType.ANGEL, // 4
12
+ ItemPoolType.CURSE, // 12
13
+ ItemPoolType.SECRET, // 5
14
+ ] as const;
15
+
16
+ const GREED_MODE_ONLY_ITEM_POOL_TYPES = [
17
+ ItemPoolType.GREED_TREASURE, // 16
18
+ ItemPoolType.GREED_BOSS, // 17
19
+ ItemPoolType.GREED_SHOP, // 18
20
+ ItemPoolType.GREED_DEVIL, // 19
21
+ ItemPoolType.GREED_ANGEL, // 20
22
+ ItemPoolType.GREED_CURSE, // 21
23
+ ItemPoolType.GREED_SECRET, // 22
24
+ ] as const;
25
+
26
+ const FAKE_ITEM_POOL_TYPES = [ItemPoolType.SHELL_GAME] as const;
27
+
28
+ const NORMAL_MODE_ITEM_POOL_TYPES: readonly ItemPoolType[] = arrayRemove(
29
+ ITEM_POOL_TYPE_VALUES,
30
+ ...GREED_MODE_ONLY_ITEM_POOL_TYPES,
31
+ ...FAKE_ITEM_POOL_TYPES,
32
+ );
33
+
34
+ const GREED_MODE_ITEM_POOL_TYPES: readonly ItemPoolType[] = arrayRemove(
35
+ ITEM_POOL_TYPE_VALUES,
36
+ ...NORMAL_MODE_ONLY_ITEM_POOL_TYPES,
37
+ ...FAKE_ITEM_POOL_TYPES,
38
+ );
39
+
40
+ /**
41
+ * Helper function to get a random item pool. This is not as simple as getting a random value from
42
+ * the `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the
43
+ * Greed Mode item pools should be excluded if not playing in Greed Mode.
44
+ */
45
+ export function getRandomItemPool(): ItemPoolType {
46
+ const itemPoolTypes = isGreedMode()
47
+ ? GREED_MODE_ITEM_POOL_TYPES
48
+ : NORMAL_MODE_ITEM_POOL_TYPES;
49
+ return getRandomArrayElement(itemPoolTypes);
50
+ }
package/src/index.ts CHANGED
@@ -61,6 +61,7 @@ export * from "./functions/hex";
61
61
  export * from "./functions/initArray";
62
62
  export * from "./functions/input";
63
63
  export * from "./functions/isaacAPIClass";
64
+ export * from "./functions/itemPool";
64
65
  export * from "./functions/jsonHelpers";
65
66
  export * from "./functions/jsonRoom";
66
67
  export * from "./functions/kColor";