isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
133 lines • 7.04 kB
TypeScript
import { ActiveSlot, CollectibleType } from "isaac-typescript-definitions";
/**
* Helper function to add one or more collectibles to a player.
*
* This function is variadic, meaning that you can supply as many collectible types as you want to
* add.
*/
export declare function addCollectible(player: EntityPlayer, ...collectibleTypes: readonly CollectibleType[]): void;
export declare function addCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType): void;
/**
* Helper function to check to see if any player has a particular collectible.
*
* @param collectibleType The collectible type to check for.
* @param ignoreModifiers If set to true, only counts collectibles the player actually owns and
* ignores effects granted by items like Zodiac, 3 Dollar Bill and Lemegeton.
* Default is false.
*/
export declare function anyPlayerHasCollectible(collectibleType: CollectibleType, ignoreModifiers?: boolean): boolean;
/**
* Helper function to find the active slots that the player has the corresponding collectible type
* in. Returns an empty array if the player does not have the collectible in any active slot.
*/
export declare function getActiveItemSlots(player: EntityPlayer, collectibleType: CollectibleType): readonly ActiveSlot[];
/**
* Helper function to get the adjusted price for a pickup, depending on how many Steam Sales all
* players currently have. (For example, if Jacob has one Steam Sale and Esau has one Steam Sale,
* the prices for items in the shop would be the same as if Isaac had two Steam Sales.)
*/
export declare function getAdjustedPrice(basePrice: int): int;
/**
* Helper function to return the total amount of collectibles that a player has that match the
* collectible type(s) provided.
*
* This function is variadic, meaning that you can specify N collectible types.
*
* Note that this will filter out non-real collectibles like Lilith's Incubus.
*/
export declare function getPlayerCollectibleCount(player: EntityPlayer, ...collectibleTypes: readonly CollectibleType[]): int;
/**
* Helper function to get only the players that have a certain collectible.
*
* This function is variadic, meaning that you can supply as many collectible types as you want to
* check for. It only returns the players that have all of the collectibles.
*/
export declare function getPlayersWithCollectible(...collectibleTypes: readonly CollectibleType[]): readonly EntityPlayer[];
/**
* Returns the total number of collectibles amongst all players. For example, if player 1 has 1 Sad
* Onion and player 2 has 2 Sad Onions, then this function would return 3.
*
* Note that this will filter out non-real collectibles like Lilith's Incubus.
*/
export declare function getTotalPlayerCollectibles(collectibleType: CollectibleType): int;
/**
* Helper function to check to see if a player has one or more collectibles.
*
* This function is variadic, meaning that you can supply as many collectible types as you want to
* check for. Returns true if the player has any of the supplied collectible types.
*
* This function always passes `false` to the `ignoreModifiers` argument.
*/
export declare function hasCollectible(player: EntityPlayer, ...collectibleTypes: readonly CollectibleType[]): boolean;
/**
* Helper function to check to see if a player has a specific collectible in one or more active
* slots.
*
* This function is variadic, meaning that you can specify as many active slots as you want to check
* for. This function will return true if the collectible type is located in any of the active slots
* provided.
*/
export declare function hasCollectibleInActiveSlot(player: EntityPlayer, collectibleType: CollectibleType, ...activeSlots: readonly ActiveSlot[]): boolean;
/**
* Returns whether the player can hold an additional active item, beyond what they are currently
* carrying. This takes the Schoolbag into account.
*
* If the player is the Tainted Soul, this always returns false, since that character cannot pick up
* items. (Only Tainted Forgotten can pick up items.)
*/
export declare function hasOpenActiveItemSlot(player: EntityPlayer): boolean;
/**
* Helper function to check if the active slot of a particular player is empty.
*
* @param player The player to check.
* @param activeSlot Optional. The active slot to check. Default is `ActiveSlot.PRIMARY`.
*/
export declare function isActiveSlotEmpty(player: EntityPlayer, activeSlot?: ActiveSlot): boolean;
/**
* Helper function to remove all of the active items from a player. This includes the Schoolbag item
* and any pocket actives.
*/
export declare function removeAllActiveItems(player: EntityPlayer): void;
/**
* Helper function to remove one or more collectibles to a player.
*
* This function is variadic, meaning that you can supply as many collectible types as you want to
* remove.
*/
export declare function removeCollectible(player: EntityPlayer, ...collectibleTypes: readonly CollectibleType[]): void;
/**
* Helper function to remove a collectible costume from a player. Use this helper function to avoid
* having to request the collectible from the item config.
*/
export declare function removeCollectibleCostume(player: EntityPlayer, collectibleType: CollectibleType): void;
/**
* Helper function to remove one or more collectibles from all players. If any player has more than
* one copy of the item, then all copies of it will be removed.
*
* This function is variadic, meaning that you can specify as many collectibles as you want to
* remove.
*/
export declare function removeCollectibleFromAllPlayers(...collectibleTypes: readonly CollectibleType[]): void;
/**
* Helper function to set an active collectible to a particular slot. This has different behavior
* than calling the `player.AddCollectible` method with the `activeSlot` argument, because this
* function will not shift existing items into the Schoolbag and it handles
* `ActiveSlot.SLOT_POCKET2`.
*
* Note that if an item is set to `ActiveSlot.SLOT_POCKET2`, it will disappear after being used and
* will be automatically removed upon entering a new room.
*
* @param player The player to give the item to.
* @param collectibleType The collectible type of the item to give.
* @param activeSlot Optional. The slot to set. Default is `ActiveSlot.PRIMARY`.
* @param charge Optional. The argument of charges to set. If not specified, the item will be set
* with maximum charges.
* @param keepInPools Optional. Whether to remove the item from pools. Default is false.
*/
export declare function setActiveItem(player: EntityPlayer, collectibleType: CollectibleType, activeSlot?: ActiveSlot, charge?: int, keepInPools?: boolean): void;
/**
* Helper function to use an active item without showing an animation, keeping the item, or adding
* any costumes.
*/
export declare function useActiveItemTemp(player: EntityPlayer, collectibleType: CollectibleType): void;
//# sourceMappingURL=playerCollectibles.d.ts.map