Module: game/modifiers
Interfaces
Type Aliases
ModifierFromOptionalParams
Ƭ ModifierFromOptionalParams<T
, S
>: T
extends undefined
? S
extends undefined
? Omit
<WithRequired
<Modifier
, "revert"
>, "description"
| "enabled"
> : Omit
<WithRequired
<Modifier
, "revert"
| "enabled"
>, "description"
> : S
extends undefined
? Omit
<WithRequired
<Modifier
, "revert"
| "description"
>, "enabled"
> : WithRequired
<Modifier
, "revert"
| "enabled"
| "description"
>
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:40
Functions
createAdditiveModifier
▸ createAdditiveModifier<T
>(optionsFunc
): ModifierFromOptionalParams
<T
["description"
], T
["enabled"
]>
Create a modifier that adds some value to the input value.
Type parameters
Name | Type |
---|---|
T | extends AdditiveModifierOptions |
Parameters
Name | Type | Description |
---|---|---|
optionsFunc | () => T | Additive modifier options. |
Returns
ModifierFromOptionalParams
<T
["description"
], T
["enabled"
]>
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
Name | Type |
---|---|
T | extends ExponentialModifierOptions |
Parameters
Name | Type | Description |
---|---|---|
optionsFunc | () => T | Exponential modifier options. |
Returns
ModifierFromOptionalParams
<T
["description"
], T
["enabled"
]>
createModifierSection
▸ createModifierSection(title
, subtitle
, modifier
, base?
, unit?
, baseText?
): Element
Create a JSX element that displays a modifier. Intended to be used with the output from createSequentialModifier.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
title | string | undefined | The header for the section. |
subtitle | string | undefined | Smaller text that appears in the header after the title. |
modifier | WithRequired <Modifier , "description" > | undefined | The modifier to render. |
base | DecimalSource | 1 | The base value that'll be passed into the modifier. |
unit | string | "" | The unit of the value being modified, if any. |
baseText | CoercableComponent | "Base" | The label to use for the base value. |
Returns
Element
createMultiplicativeModifier
▸ createMultiplicativeModifier<T
>(optionsFunc
): ModifierFromOptionalParams
<T
["description"
], T
["enabled"
]>
Create a modifier that multiplies the input value by some value.
Type parameters
Name | Type |
---|---|
T | extends MultiplicativeModifierOptions |
Parameters
Name | Type | Description |
---|---|---|
optionsFunc | () => T | Multiplicative modifier options. |
Returns
ModifierFromOptionalParams
<T
["description"
], T
["enabled"
]>
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
Type parameters
Name | Type |
---|---|
T | extends Modifier [] |
S | T extends WithRequired <Modifier , "revert" >[] ? WithRequired <Modifier , "description" | "revert" > : Omit <WithRequired <Modifier , "description" >, "revert" > |
Parameters
Name | Type | Description |
---|---|---|
modifiersFunc | () => T | The modifiers to perform sequentially. |
Returns
S