import{_ as e,c as t,o,N as a}from"./chunks/framework.0799945b.js";const u=JSON.parse('{"title":"Module: game/modifiers","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/game/modifiers.md","lastUpdated":null}'),i={name:"api/modules/game/modifiers.md"},d=a('

Module: game/modifiers

Interfaces

AdditiveModifierOptions

AdditiveModifierOptions: Object

An object that configures an additive modifier via createAdditiveModifier.

NameTypeDescription
addendComputable<DecimalSource>The amount to add to the input value.
description?Computable<CoercableComponent>Description of what this modifier is doing.
enabled?Computable<boolean>A computable that will be processed and passed directly into the returned modifier.
smallerIsBetter?booleanDetermines if numbers larger or smaller than 0 should be displayed as red.

Defined in

profectus/src/game/modifiers.tsx:53


ExponentialModifierOptions

ExponentialModifierOptions: Object

An object that configures an exponential modifier via createExponentialModifier.

NameTypeDescription
description?Computable<CoercableComponent>Description of what this modifier is doing.
enabled?Computable<boolean>A computable that will be processed and passed directly into the returned modifier.
exponentComputable<DecimalSource>The amount to raise the input value to the power of.
smallerIsBetter?booleanDetermines if numbers larger or smaller than 1 should be displayed as red.
supportLowNumbers?booleanAdd 1 before calculating, then remove it afterwards. This prevents low numbers from becoming lower.

Defined in

profectus/src/game/modifiers.tsx:182


Modifier

Modifier: Object

An object that can be used to apply or unapply some modification to a number. Being reversible requires the operation being invertible, but some features may rely on that. Descriptions can be optionally included for displaying them to the player. The built-in modifier creators are designed to display the modifiers using createModifierSection.

NameTypeDescription
apply(gain: DecimalSource) => DecimalSourceApplies some operation on the input and returns the result.
description?ProcessedComputable<CoercableComponent>A description of this modifier. See createModifierSection.
enabled?ProcessedComputable<boolean>Whether or not this modifier should be considered enabled. Typically for use with modifiers passed into createSequentialModifier.
getFormula?(gain: FormulaSource) => GenericFormulaGet a formula for this modifier. Required by some features.
invert?(gain: DecimalSource) => DecimalSourceReverses the operation applied by the apply property. Required by some features.

Defined in

profectus/src/game/modifiers.tsx:22


ModifierSectionOptions

ModifierSectionOptions: Object

An object that configures a modifier section via createModifierSection.

NameTypeDescription
base?DecimalSourceThe base value that'll be passed into the modifier. Defaults to 1.
baseText?CoercableComponentThe label to use for the base value. Defaults to "Base".
modifierWithRequired<Modifier, "description">The modifier to render.
smallerIsBetter?booleanDetermines if numbers larger or smaller than the base should be displayed as red.
subtitle?stringSmaller text that appears in the header after the title.
titlestringThe header for the section.
unit?stringThe unit of the value being modified, if any.

Defined in

profectus/src/game/modifiers.tsx:324


MultiplicativeModifierOptions

MultiplicativeModifierOptions: Object

An object that configures an multiplicative modifier via createMultiplicativeModifier.

NameTypeDescription
description?Computable<CoercableComponent>Description of what this modifier is doing.
enabled?Computable<boolean>A computable that will be processed and passed directly into the returned modifier.
multiplierComputable<DecimalSource>The amount to multiply the input value by.
smallerIsBetter?booleanDetermines if numbers larger or smaller than 1 should be displayed as red.

Defined in

profectus/src/game/modifiers.tsx:118

Type Aliases

ModifierFromOptionalParams

Ƭ ModifierFromOptionalParams<T, S>: T extends undefined ? S extends undefined ? Omit<WithRequired<Modifier, "invert" | "getFormula">, "description" | "enabled"> : Omit<WithRequired<Modifier, "invert" | "enabled" | "getFormula">, "description"> : S extends undefined ? Omit<WithRequired<Modifier, "invert" | "description" | "getFormula">, "enabled"> : WithRequired<Modifier, "invert" | "enabled" | "description" | "getFormula">

Utility type used to narrow down a modifier type that will have a description and/or enabled property based on optional parameters, T and S (respectively).

Type parameters

Name
T
S

Defined in

profectus/src/game/modifiers.tsx:44

Functions

createAdditiveModifier

createAdditiveModifier<T>(optionsFunc): ModifierFromOptionalParams<T["description"], T["enabled"]>

Create a modifier that adds some value to the input value.

Type parameters
NameType
Textends AdditiveModifierOptions
Parameters
NameTypeDescription
optionsFuncOptionsFunc<T>Additive modifier options.
Returns

ModifierFromOptionalParams<T["description"], T["enabled"]>

Defined in

profectus/src/game/modifiers.tsx:68


createExponentialModifier

createExponentialModifier<T>(optionsFunc): ModifierFromOptionalParams<T["description"], T["enabled"]>

Create a modifier that raises the input value to the power of some value.

Type parameters
NameType
Textends ExponentialModifierOptions
Parameters
NameTypeDescription
optionsFuncOptionsFunc<T>Exponential modifier options.
Returns

ModifierFromOptionalParams<T["description"], T["enabled"]>

Defined in

profectus/src/game/modifiers.tsx:199


createModifierSection

createModifierSection(options): Element

Create a JSX element that displays a modifier. Intended to be used with the output from createSequentialModifier.

Parameters
NameTypeDescription
optionsModifierSectionOptionsModifier section options.
Returns

Element

Defined in

profectus/src/game/modifiers.tsx:346


createMultiplicativeModifier

createMultiplicativeModifier<T>(optionsFunc): ModifierFromOptionalParams<T["description"], T["enabled"]>

Create a modifier that multiplies the input value by some value.

Type parameters
NameType
Textends MultiplicativeModifierOptions
Parameters
NameTypeDescription
optionsFuncOptionsFunc<T>Multiplicative modifier options.
Returns

ModifierFromOptionalParams<T["description"], T["enabled"]>

Defined in

profectus/src/game/modifiers.tsx:133


createSequentialModifier

createSequentialModifier<T, S>(modifiersFunc): S

Takes an array of modifiers and applies and reverses them in order. Modifiers that are not enabled will not be applied nor reversed. Also joins their descriptions together.

See

createModifierSection.

Type parameters
NameType
Textends Modifier[]
ST extends WithRequired<Modifier, "invert">[] ? WithRequired<Modifier, "description" | "invert"> : Omit<WithRequired<Modifier, "description">, "invert">
Parameters
NameTypeDescription
modifiersFunc() => TThe modifiers to perform sequentially.
Returns

S

Defined in

profectus/src/game/modifiers.tsx:276

',104),r=[d];function l(n,c,s,f,h,m){return o(),t("div",null,r)}const b=e(i,[["render",l]]);export{u as __pageData,b as default};