isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
67 lines • 3.61 kB
TypeScript
import type { ItemPoolType } from "isaac-typescript-definitions";
import { CollectibleType } from "isaac-typescript-definitions";
import type { WeightedArray } from "../../../types/WeightedArray";
import { Feature } from "../../private/Feature";
export declare class CustomItemPools extends Feature {
private readonly postGameStartedReorderedFalse;
/**
* Helper function to register a custom item pool. Use this function once when your mod first
* loads to declare the items that you want to be in the item pools. Then, in the middle of a run,
* you can use `getCustomItemPoolCollectible`.
*
* For example:
*
* ```ts
* const ItemPoolTypeCustom = {
* FOO = 0 as ItemPoolType,
* } as const;
*
* const FOO_ITEM_POOL = [
* [CollectibleType.SAD_ONION, 1],
* [CollectibleType.INNER_EYE, 0.5],
* ];
*
* registerCustomItemPool(ItemPoolTypeCustom.FOO, FOO_ITEM_POOL);
* ```
*
* Note that custom item pools do not currently support partial weight decrementation on sight.
*
* In order to use this function, you must upgrade your mod with `ISCFeature.CUSTOM_ITEM_POOLS`.
*
* @param itemPoolTypeCustom An integer that identifies what kind of item pool you are creating.
* It should correspond to a local `ItemPoolTypeCustom` enum in your
* mod. The integer can be any unique value and can safely overlap with
* the vanilla item pool type values (or values chosen by other mods).
* @param collectibles An array of weighted collectible tuples that represent the item pool that
* you are creating. The first element in he tuple is the `CollectibleType`,
* and the second element in the tuple is the float that represents the weight
* of the collectible.
* @public
*/
registerCustomItemPool(itemPoolTypeCustom: ItemPoolType, collectibles: Readonly<WeightedArray<CollectibleType>>): void;
/**
* Helper function to get a new collectible from a custom item pool created with the
* `registerCustomItemPool` function. This function has the same format as the
* `ItemPool.GetCollectible` method.
*
* By default, a collectible will not be removed from the pool once it is selected, unless the
* `decrease` argument is set to true (similar to how a vanilla item pool works).
*
* If you want to get an unseeded collectible type, you must explicitly pass `undefined` to the
* `seedOrRNG` parameter.
*
* In order to use this function, you must upgrade your mod with `ISCFeature.CUSTOM_ITEM_POOLS`.
*
* @param itemPoolTypeCustom An integer representing the custom item pool to use.
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
* `RNG.Next` method will be called. If `undefined` is provided, it will default
* to a random seed.
* @param decrease Optional. Whether to remove the selected collectible from the item pool.
* Default is true.
* @param defaultItem Optional. The collectible to return if the item pool is depleted. Default is
* `CollectibleType.NULL`.
* @public
*/
getCustomItemPoolCollectible(itemPoolTypeCustom: ItemPoolType, seedOrRNG: Seed | RNG | undefined, decrease?: boolean, defaultItem?: CollectibleType): CollectibleType;
}
//# sourceMappingURL=CustomItemPools.d.ts.map