import { Effect, Familiar, Item, Skill } from "kolmafia"; import { BooleanModifier, ModifierType, MultiStringModifier, NumericModifier, StringModifier } from "./modifierTypes.js"; import { StringProperty } from "./propertyTypes.js"; /** * Type guard that determines if a given string is a boolean modifier * @param modifier The modifier in question * @returns Whether the string in question is a valid boolean modifier */ export declare function isBooleanModifier(modifier: string): modifier is BooleanModifier; /** * Type guard that determines if a given string is a numeric modifier * @param modifier The modifier in question * @returns Whether the string in question is a valid numeric modifier */ export declare function isNumericModifier(modifier: string): modifier is NumericModifier; /** * Type guard that determines if a given string is a string modifier * @param modifier The modifier in question * @returns Whether the string in question is a valid string modifier */ export declare function isStringModifier(modifier: string): modifier is StringModifier; /** * Type guard that determines if a given string is a multistring modifier * @param modifier The modifier in question * @returns Whether the string in question is a valid multistring modifier */ export declare function isMultiStringModifier(modifier: string): modifier is MultiStringModifier; /** * Type guard that determines if a given string is a valid modifier * @param modifier The modifier in question * @returns Whether the string in question is a valid modifier */ export declare function isValidModifier(modifier: string): modifier is ModifierType; export declare function get(name: BooleanModifier, subject?: string | Item | Effect): boolean; export declare function get(name: NumericModifier, subject?: string | Item | Effect | Skill | Familiar): number; export declare function get(name: StringModifier, subject?: string | Effect | Item): string; export declare function get(name: MultiStringModifier, subject?: string | Item | Effect | Skill | Familiar): string[]; export type ModifierValue = T extends BooleanModifier ? boolean : T extends NumericModifier ? number : T extends MultiStringModifier ? string[] : string; export type Modifiers = Partial<{ [K in T]: ModifierValue; }>; /** * Merge arbitrarily many Modifiers objects into one, summing all numeric modifiers, and ||ing all boolean modifiers. * * @param modifiers Modifiers objects to be merged together. * @returns A single Modifiers object obtained by merging. */ export declare function mergeModifiers(...modifiers: Modifiers[]): Modifiers; /** * Prints the modtrace to the log. * Example: printModtrace("Meat Drop") or printModtrace(["Item Drop", "Booze Drop"]) * * @param inputModifiers A string (or string[]) containing the modtrace lookup term(s). * @param baseModifier A string where all the info about modifiers in the string[] array can be grabbed with this one lookup term. (Automatically generated in most cases) * @param componentColor The print color for the sum returned for each input modifier * @param totalColor The print color for the total sum over every input modifier * @returns void */ export declare function printModtrace(inputModifiers: string | string[], // the user's list of modifiers to look up baseModifier?: string, componentColor?: string, totalColor?: string): void; /** * Take the sum of a modifier over an array of Skills, Effects, and Items * * @param modifier A NumericModifier that we want to find the total value of * @param subjects A rested array of Skills, Effects, and Items that we want to find the total value of * @returns The sum of the appropriate modifier for all of the subjects */ export declare function getTotalModifier(modifier: NumericModifier, ...subjects: (Skill | Effect | Item)[]): number; export type ModifierParser = { numeric: (value: string) => number; str: (value: string) => string; bool: (value: string) => boolean; multiString: (value: string) => string[]; }; /** * Parse a modifier string into a Modifiers object * @param modifiers The modifier string to parse * @param parser An optional partial object for transforming string values into modifier values * @param parser.numeric How to translate values into numeric modifiers; defaults to the Number function * @param parser.str How to translate values into string modifiers; defaults to the String function * @param parser.bool How to translate values into boolean modifiers; defaults to checking equality with `"true"` * @param parser.multiString How to parse multistring modifiers; defaults to splitting on `,` * @returns A `Modifiers` object */ export declare function parseModifierString(modifiers: string, { numeric, str, bool, multiString, }?: Partial): Modifiers; /** * Translate a pref into a `Modifiers` object by wrapping mafia's `splitModifiers` * @param pref The name of the mafia preference in question * @param parsers Optional object to help translate fields into their appropriate values * @param parsers.numeric How to translate the values from `splitModifiers` into numbers for numeric modifiers; defaults to Number * @param parsers.str How to translate the values from `splitModifiers` into strings for string modifiers; defaults to String * @param parsers.bool How to translate the values from `splitModifiers` into booleans for boolean modifiers; defaults to comparing to the string `"true"` * @param parsers.multiString How to translate the values from `splitModifiers` into string[]s for multistring modifiers; defaults to splitting by a comma * @returns A `Modifiers` object corresponding to the given preference. */ export declare function parseModifiers(pref: StringProperty, parsers?: Partial): Modifiers; /** * Compile together all `Modifiers` something has * @param thing An Item, Effect, or string to check all modifiers of * @returns A `Modifiers` object corresponding to the givem Effect, Item, or string */ export declare function allModifiers(thing: Effect | Item | string): Modifiers;