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('
• AdditiveModifierOptions: Object
An object that configures an additive modifier via createAdditiveModifier.
Name | Type | Description |
---|---|---|
addend | Computable <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? | boolean | Determines if numbers larger or smaller than 0 should be displayed as red. |
profectus/src/game/modifiers.tsx:53
• ExponentialModifierOptions: Object
An object that configures an exponential modifier via createExponentialModifier.
Name | Type | Description |
---|---|---|
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. |
exponent | Computable <DecimalSource > | The amount to raise the input value to the power of. |
smallerIsBetter? | boolean | Determines if numbers larger or smaller than 1 should be displayed as red. |
supportLowNumbers? | boolean | Add 1 before calculating, then remove it afterwards. This prevents low numbers from becoming lower. |
profectus/src/game/modifiers.tsx:182
• 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.
Name | Type | Description |
---|---|---|
apply | (gain : DecimalSource ) => DecimalSource | Applies 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 ) => GenericFormula | Get a formula for this modifier. Required by some features. |
invert? | (gain : DecimalSource ) => DecimalSource | Reverses the operation applied by the apply property. Required by some features. |
profectus/src/game/modifiers.tsx:22
• ModifierSectionOptions: Object
An object that configures a modifier section via createModifierSection.
Name | Type | Description |
---|---|---|
base? | DecimalSource | The base value that'll be passed into the modifier. Defaults to 1. |
baseText? | CoercableComponent | The label to use for the base value. Defaults to "Base". |
modifier | WithRequired <Modifier , "description" > | The modifier to render. |
smallerIsBetter? | boolean | Determines if numbers larger or smaller than the base should be displayed as red. |
subtitle? | string | Smaller text that appears in the header after the title. |
title | string | The header for the section. |
unit? | string | The unit of the value being modified, if any. |
profectus/src/game/modifiers.tsx:324
• MultiplicativeModifierOptions: Object
An object that configures an multiplicative modifier via createMultiplicativeModifier.
Name | Type | Description |
---|---|---|
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. |
multiplier | Computable <DecimalSource > | The amount to multiply the input value by. |
smallerIsBetter? | boolean | Determines if numbers larger or smaller than 1 should be displayed as red. |
profectus/src/game/modifiers.tsx:118
Ƭ 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).
Name |
---|
T |
S |
profectus/src/game/modifiers.tsx:44
▸ createAdditiveModifier<T
>(optionsFunc
): ModifierFromOptionalParams
<T
["description"
], T
["enabled"
]>
Create a modifier that adds some value to the input value.
Name | Type |
---|---|
T | extends AdditiveModifierOptions |
Name | Type | Description |
---|---|---|
optionsFunc | OptionsFunc <T > | Additive modifier options. |
ModifierFromOptionalParams
<T
["description"
], T
["enabled"
]>
profectus/src/game/modifiers.tsx:68
▸ createExponentialModifier<T
>(optionsFunc
): ModifierFromOptionalParams
<T
["description"
], T
["enabled"
]>
Create a modifier that raises the input value to the power of some value.
Name | Type |
---|---|
T | extends ExponentialModifierOptions |
Name | Type | Description |
---|---|---|
optionsFunc | OptionsFunc <T > | Exponential modifier options. |
ModifierFromOptionalParams
<T
["description"
], T
["enabled"
]>
profectus/src/game/modifiers.tsx:199
▸ createModifierSection(options
): Element
Create a JSX element that displays a modifier. Intended to be used with the output from createSequentialModifier.
Name | Type | Description |
---|---|---|
options | ModifierSectionOptions | Modifier section options. |
Element
profectus/src/game/modifiers.tsx:346
▸ createMultiplicativeModifier<T
>(optionsFunc
): ModifierFromOptionalParams
<T
["description"
], T
["enabled"
]>
Create a modifier that multiplies the input value by some value.
Name | Type |
---|---|
T | extends MultiplicativeModifierOptions |
Name | Type | Description |
---|---|---|
optionsFunc | OptionsFunc <T > | Multiplicative modifier options. |
ModifierFromOptionalParams
<T
["description"
], T
["enabled"
]>
profectus/src/game/modifiers.tsx:133
▸ 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
Name | Type |
---|---|
T | extends Modifier [] |
S | T extends WithRequired <Modifier , "invert" >[] ? WithRequired <Modifier , "description" | "invert" > : Omit <WithRequired <Modifier , "description" >, "invert" > |
Name | Type | Description |
---|---|---|
modifiersFunc | () => T | The modifiers to perform sequentially. |
S