import { Familiar, Item, Skill } from "kolmafia"; import { Macro } from "../combat.js"; import { Requirement } from "../maximize.js"; export type FindActionSourceConstraints = { /** * Function returning true if we only accept familiar-based actions. */ requireFamiliar?: () => boolean; /** * Function returning true if we only accept sources that are unlimited. */ requireUnlimited?: () => boolean; /** * Function returning whether to disallow actions requiring familiar change. */ noFamiliar?: () => boolean; /** * Function returning whether to disallow actions requiring equipment change. */ noRequirements?: () => boolean; /** * Function returning whether to disallow actions requiring preparation. */ noPreparation?: () => boolean; /** * Function returning maximum cost of allowed actions. If undefined, allow * only actions that cost nothing. */ maximumCost?: () => number; /** * Function allowing for custom logic if an action should be allowed. * If undefined, allow all actions to be considered by other constraints. * * @param action The action that is being considered. * @returns True if the action should be allowed. */ allowedAction?: (action: ActionSource) => boolean; }; export type ActionConstraints = { /** * Equipment requirements to have this action available. */ equipmentRequirements?: () => Requirement; /** * Familiar required to be in use to have this action available. */ familiar?: () => Familiar; /** * Miscellaneous preparation to ensure this action is available. */ preparation?: () => boolean; /** * Cost in meat per usage of this action. */ cost?: () => number; }; /** * A combat-based action resource in the game (e.g. a free run or free kill). */ export declare class ActionSource { static defaultPriceFunction: (item: Item) => number; source: Item | Skill | Familiar | Array; potential: () => number; macro: Macro; constraints: ActionConstraints; /** * @param source Source(s) of the action (e.g. item, skill, or familiar needed). * @param potential Function returning how many times this action can be used. * @param macro Macro to execute this action in combat. * @param constraints Constraints required for this action to be available. */ constructor(source: Item | Skill | Familiar | Array, potential: () => number, macro: Macro, constraints?: ActionConstraints); /** * @returns Name of the action source. */ name(): string; /** * @returns Whether the action is available. */ available(): boolean; /** * @returns Cost in meat per usage of the action. */ cost(): number; /** * @returns Whether the action costs 0 meat to use. */ isFree(): boolean; /** * @returns Whether unlimited uses of the action are available. */ isUnlimited(): boolean; /** * Create a compound action source with merged constraints. * * @param others Other actions to have available. * @returns Merged constraints, or null if they are inconsistent. */ merge(...others: ActionSource[]): ActionSource | null; /** * Perform all preparation necessary to make this action available. * * @param otherRequirements Any other equipment requirements. * @returns Whether preparation succeeded. */ prepare(otherRequirements?: Requirement): boolean; /** * Perform all preparation necessary to make this action available. * Throws an error if preparation fails. * * @param otherRequirements Any other equipment requirements. */ ensure(otherRequirements?: Requirement): void; } /** * Find an available action source subject to constraints. * * @param actions Action source list. * @param constraints Preexisting constraints that restrict possible sources. * @returns Available action source satisfying constraints, or null. */ export declare function findActionSource(actions: ActionSource[], constraints?: FindActionSourceConstraints): ActionSource | null; /** * Count available action sources subject to constraints. Note that, if * constraints.maximumCost is high enough, this will return Infinity. * * @param actions Action source list. * @param constraints Preexisting constraints that restrict possible sources. * @returns Count of available action sources. */ export declare function actionSourcesAvailable(actions: ActionSource[], constraints?: FindActionSourceConstraints): number;