import{_ as e,c as t,o as d,a}from"./app.ab34650d.js";const p=JSON.parse('{"title":"Module: game/modifiers","description":"","frontmatter":{"editLink":false},"headers":[{"level":2,"title":"Interfaces","slug":"interfaces"},{"level":2,"title":"Type Aliases","slug":"type-aliases"},{"level":3,"title":"ModifierFromOptionalParams","slug":"modifierfromoptionalparams"},{"level":2,"title":"Functions","slug":"functions"},{"level":3,"title":"createAdditiveModifier","slug":"createadditivemodifier"},{"level":3,"title":"createExponentialModifier","slug":"createexponentialmodifier"},{"level":3,"title":"createModifierSection","slug":"createmodifiersection"},{"level":3,"title":"createMultiplicativeModifier","slug":"createmultiplicativemodifier"},{"level":3,"title":"createSequentialModifier","slug":"createsequentialmodifier"}],"relativePath":"api/modules/game/modifiers.md","lastUpdated":null}'),o={name:"api/modules/game/modifiers.md"},i=a('
\u01AC 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).
Name |
---|
T |
S |
profectus/src/game/modifiers.tsx:39
\u25B8 createAdditiveModifier<T
, S
, R
>(addend
, description?
, enabled?
): R
Create a modifier that adds some value to the input value.
Name | Type |
---|---|
T | extends undefined | Computable <CoercableComponent > |
S | extends undefined | Computable <boolean > |
R | ModifierFromOptionalParams <T , S > |
Name | Type | Description |
---|---|---|
addend | Computable <DecimalSource > | The amount to add to the input value. |
description? | T | Description of what this modifier is doing. |
enabled? | S | A computable that will be processed and passed directly into the returned modifier. |
R
\u25B8 createExponentialModifier<T
, S
, R
>(exponent
, description?
, enabled?
): R
Create a modifier that raises the input value to the power of some value.
Name | Type |
---|---|
T | extends undefined | Computable <CoercableComponent > |
S | extends undefined | Computable <boolean > |
R | ModifierFromOptionalParams <T , S > |
Name | Type | Description |
---|---|---|
exponent | Computable <DecimalSource > | The value to raise the input value to the power of. |
description? | T | Description of what this modifier is doing. |
enabled? | S | A computable that will be processed and passed directly into the returned modifier. |
R
\u25B8 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.
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. |
Element
\u25B8 createMultiplicativeModifier<T
, S
, R
>(multiplier
, description?
, enabled?
): R
Create a modifier that multiplies the input value by some value.
Name | Type |
---|---|
T | extends undefined | Computable <CoercableComponent > |
S | extends undefined | Computable <boolean > |
R | ModifierFromOptionalParams <T , S > |
Name | Type | Description |
---|---|---|
multiplier | Computable <DecimalSource > | The value to multiply the input value by. |
description? | T | Description of what this modifier is doing. |
enabled? | S | A computable that will be processed and passed directly into the returned modifier. |
R
\u25B8 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
Name | Type |
---|---|
T | extends Modifier [] |
S | T extends WithRequired <Modifier , "revert" >[] ? WithRequired <Modifier , "description" | "revert" > : Omit <WithRequired <Modifier , "description" >, "revert" > |
Name | Type | Description |
---|---|---|
...modifiers | T | The modifiers to perform sequentially. |
S