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:36

Functions

createAdditiveModifier

createAdditiveModifier<T, S, R>(addend, description?, enabled?): R

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

Type parameters

NameType
Textends undefined | Computable<CoercableComponent>
Sextends undefined | Computable<boolean>
RModifierFromOptionalParams<T, S>

Parameters

NameTypeDescription
addendComputable<DecimalSource>The amount to add to the input value.
description?TDescription of what this modifier is doing.
enabled?SA computable that will be processed and passed directly into the returned modifier.

Returns

R

Defined in

profectus/src/game/modifiers.tsx:50


createExponentialModifier

createExponentialModifier<T, S, R>(exponent, description?, enabled?): R

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

Type parameters

NameType
Textends undefined | Computable<CoercableComponent>
Sextends undefined | Computable<boolean>
RModifierFromOptionalParams<T, S>

Parameters

NameTypeDescription
exponentComputable<DecimalSource>The value to raise the input value to the power of.
description?TDescription of what this modifier is doing.
enabled?SA computable that will be processed and passed directly into the returned modifier.

Returns

R

Defined in

profectus/src/game/modifiers.tsx:120


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

NameTypeDefault valueDescription
titlestringundefinedThe header for the section.
subtitlestringundefinedSmaller text that appears in the header after the title.
modifierWithRequired<Modifier, "description">undefinedThe modifier to render.
baseDecimalSource1The base value that'll be passed into the modifier.
unitstring""The unit of the value being modified, if any.
baseTextCoercableComponent"Base"The label to use for the base value.

Returns

Element

Defined in

profectus/src/game/modifiers.tsx:198


createMultiplicativeModifier

createMultiplicativeModifier<T, S, R>(multiplier, description?, enabled?): R

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

Type parameters

NameType
Textends undefined | Computable<CoercableComponent>
Sextends undefined | Computable<boolean>
RModifierFromOptionalParams<T, S>

Parameters

NameTypeDescription
multiplierComputable<DecimalSource>The value to multiply the input value by.
description?TDescription of what this modifier is doing.
enabled?SA computable that will be processed and passed directly into the returned modifier.

Returns

R

Defined in

profectus/src/game/modifiers.tsx:85


createSequentialModifier

createSequentialModifier<T, S>(...modifiers): 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, "revert">[] ? WithRequired<Modifier, "description" | "revert"> : Omit<WithRequired<Modifier, "description">, "revert">

Parameters

NameTypeDescription
...modifiersTThe modifiers to perform sequentially.

Returns

S

Defined in

profectus/src/game/modifiers.tsx:156