profectus-docs/assets/api_modules_game_modifiers.md.023a82e6.js

1 line
17 KiB
JavaScript

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('<h1 id="module-game-modifiers" tabindex="-1">Module: game/modifiers <a class="header-anchor" href="#module-game-modifiers" aria-hidden="true">#</a></h1><h2 id="interfaces" tabindex="-1">Interfaces <a class="header-anchor" href="#interfaces" aria-hidden="true">#</a></h2><ul><li><a href="../../interfaces/game/modifiers.Modifier">Modifier</a></li></ul><h2 id="type-aliases" tabindex="-1">Type Aliases <a class="header-anchor" href="#type-aliases" aria-hidden="true">#</a></h2><h3 id="modifierfromoptionalparams" tabindex="-1">ModifierFromOptionalParams <a class="header-anchor" href="#modifierfromoptionalparams" aria-hidden="true">#</a></h3><p>\u01AC <strong>ModifierFromOptionalParams</strong>&lt;<code>T</code>, <code>S</code>&gt;: <code>T</code> extends <code>undefined</code> ? <code>S</code> extends <code>undefined</code> ? <code>Omit</code>&lt;<a href="./../util/common.html#withrequired"><code>WithRequired</code></a>&lt;<a href="../../interfaces/game/modifiers.Modifier"><code>Modifier</code></a>, <code>&quot;revert&quot;</code>&gt;, <code>&quot;description&quot;</code> | <code>&quot;enabled&quot;</code>&gt; : <code>Omit</code>&lt;<a href="./../util/common.html#withrequired"><code>WithRequired</code></a>&lt;<a href="../../interfaces/game/modifiers.Modifier"><code>Modifier</code></a>, <code>&quot;revert&quot;</code> | <code>&quot;enabled&quot;</code>&gt;, <code>&quot;description&quot;</code>&gt; : <code>S</code> extends <code>undefined</code> ? <code>Omit</code>&lt;<a href="./../util/common.html#withrequired"><code>WithRequired</code></a>&lt;<a href="../../interfaces/game/modifiers.Modifier"><code>Modifier</code></a>, <code>&quot;revert&quot;</code> | <code>&quot;description&quot;</code>&gt;, <code>&quot;enabled&quot;</code>&gt; : <a href="./../util/common.html#withrequired"><code>WithRequired</code></a>&lt;<a href="../../interfaces/game/modifiers.Modifier"><code>Modifier</code></a>, <code>&quot;revert&quot;</code> | <code>&quot;enabled&quot;</code> | <code>&quot;description&quot;</code>&gt;</p><p>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).</p><h4 id="type-parameters" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td></tr><tr><td style="text-align:left;"><code>S</code></td></tr></tbody></table><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/013092f/src/game/modifiers.tsx#L39" target="_blank" rel="noopener noreferrer">profectus/src/game/modifiers.tsx:39</a></p><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-hidden="true">#</a></h2><h3 id="createadditivemodifier" tabindex="-1">createAdditiveModifier <a class="header-anchor" href="#createadditivemodifier" aria-hidden="true">#</a></h3><p>\u25B8 <strong>createAdditiveModifier</strong>&lt;<code>T</code>, <code>S</code>, <code>R</code>&gt;(<code>addend</code>, <code>description?</code>, <code>enabled?</code>): <code>R</code></p><p>Create a modifier that adds some value to the input value.</p><h4 id="type-parameters-1" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-1" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">extends <code>undefined</code> | <a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<a href="./../features/feature.html#coercablecomponent"><code>CoercableComponent</code></a>&gt;</td></tr><tr><td style="text-align:left;"><code>S</code></td><td style="text-align:left;">extends <code>undefined</code> | <a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<code>boolean</code>&gt;</td></tr><tr><td style="text-align:left;"><code>R</code></td><td style="text-align:left;"><a href="./modifiers.html#modifierfromoptionalparams"><code>ModifierFromOptionalParams</code></a>&lt;<code>T</code>, <code>S</code>&gt;</td></tr></tbody></table><h4 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>addend</code></td><td style="text-align:left;"><a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;">The amount to add to the input value.</td></tr><tr><td style="text-align:left;"><code>description?</code></td><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">Description of what this modifier is doing.</td></tr><tr><td style="text-align:left;"><code>enabled?</code></td><td style="text-align:left;"><code>S</code></td><td style="text-align:left;">A computable that will be processed and passed directly into the returned modifier.</td></tr></tbody></table><h4 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-hidden="true">#</a></h4><p><code>R</code></p><hr><h3 id="createexponentialmodifier" tabindex="-1">createExponentialModifier <a class="header-anchor" href="#createexponentialmodifier" aria-hidden="true">#</a></h3><p>\u25B8 <strong>createExponentialModifier</strong>&lt;<code>T</code>, <code>S</code>, <code>R</code>&gt;(<code>exponent</code>, <code>description?</code>, <code>enabled?</code>): <code>R</code></p><p>Create a modifier that raises the input value to the power of some value.</p><h4 id="type-parameters-2" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-2" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">extends <code>undefined</code> | <a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<a href="./../features/feature.html#coercablecomponent"><code>CoercableComponent</code></a>&gt;</td></tr><tr><td style="text-align:left;"><code>S</code></td><td style="text-align:left;">extends <code>undefined</code> | <a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<code>boolean</code>&gt;</td></tr><tr><td style="text-align:left;"><code>R</code></td><td style="text-align:left;"><a href="./modifiers.html#modifierfromoptionalparams"><code>ModifierFromOptionalParams</code></a>&lt;<code>T</code>, <code>S</code>&gt;</td></tr></tbody></table><h4 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>exponent</code></td><td style="text-align:left;"><a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;">The value to raise the input value to the power of.</td></tr><tr><td style="text-align:left;"><code>description?</code></td><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">Description of what this modifier is doing.</td></tr><tr><td style="text-align:left;"><code>enabled?</code></td><td style="text-align:left;"><code>S</code></td><td style="text-align:left;">A computable that will be processed and passed directly into the returned modifier.</td></tr></tbody></table><h4 id="returns-1" tabindex="-1">Returns <a class="header-anchor" href="#returns-1" aria-hidden="true">#</a></h4><p><code>R</code></p><hr><h3 id="createmodifiersection" tabindex="-1">createModifierSection <a class="header-anchor" href="#createmodifiersection" aria-hidden="true">#</a></h3><p>\u25B8 <strong>createModifierSection</strong>(<code>title</code>, <code>subtitle</code>, <code>modifier</code>, <code>base?</code>, <code>unit?</code>, <code>baseText?</code>): <code>Element</code></p><p>Create a JSX element that displays a modifier. Intended to be used with the output from <a href="./modifiers.html#createsequentialmodifier">createSequentialModifier</a>.</p><h4 id="parameters-2" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-2" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Default value</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>title</code></td><td style="text-align:left;"><code>string</code></td><td style="text-align:left;"><code>undefined</code></td><td style="text-align:left;">The header for the section.</td></tr><tr><td style="text-align:left;"><code>subtitle</code></td><td style="text-align:left;"><code>string</code></td><td style="text-align:left;"><code>undefined</code></td><td style="text-align:left;">Smaller text that appears in the header after the title.</td></tr><tr><td style="text-align:left;"><code>modifier</code></td><td style="text-align:left;"><a href="./../util/common.html#withrequired"><code>WithRequired</code></a>&lt;<a href="../../interfaces/game/modifiers.Modifier"><code>Modifier</code></a>, <code>&quot;description&quot;</code>&gt;</td><td style="text-align:left;"><code>undefined</code></td><td style="text-align:left;">The modifier to render.</td></tr><tr><td style="text-align:left;"><code>base</code></td><td style="text-align:left;"><a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a></td><td style="text-align:left;"><code>1</code></td><td style="text-align:left;">The base value that&#39;ll be passed into the modifier.</td></tr><tr><td style="text-align:left;"><code>unit</code></td><td style="text-align:left;"><code>string</code></td><td style="text-align:left;"><code>&quot;&quot;</code></td><td style="text-align:left;">The unit of the value being modified, if any.</td></tr><tr><td style="text-align:left;"><code>baseText</code></td><td style="text-align:left;"><a href="./../features/feature.html#coercablecomponent"><code>CoercableComponent</code></a></td><td style="text-align:left;"><code>&quot;Base&quot;</code></td><td style="text-align:left;">The label to use for the base value.</td></tr></tbody></table><h4 id="returns-2" tabindex="-1">Returns <a class="header-anchor" href="#returns-2" aria-hidden="true">#</a></h4><p><code>Element</code></p><hr><h3 id="createmultiplicativemodifier" tabindex="-1">createMultiplicativeModifier <a class="header-anchor" href="#createmultiplicativemodifier" aria-hidden="true">#</a></h3><p>\u25B8 <strong>createMultiplicativeModifier</strong>&lt;<code>T</code>, <code>S</code>, <code>R</code>&gt;(<code>multiplier</code>, <code>description?</code>, <code>enabled?</code>): <code>R</code></p><p>Create a modifier that multiplies the input value by some value.</p><h4 id="type-parameters-3" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-3" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">extends <code>undefined</code> | <a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<a href="./../features/feature.html#coercablecomponent"><code>CoercableComponent</code></a>&gt;</td></tr><tr><td style="text-align:left;"><code>S</code></td><td style="text-align:left;">extends <code>undefined</code> | <a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<code>boolean</code>&gt;</td></tr><tr><td style="text-align:left;"><code>R</code></td><td style="text-align:left;"><a href="./modifiers.html#modifierfromoptionalparams"><code>ModifierFromOptionalParams</code></a>&lt;<code>T</code>, <code>S</code>&gt;</td></tr></tbody></table><h4 id="parameters-3" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-3" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>multiplier</code></td><td style="text-align:left;"><a href="./../util/computed.html#computable"><code>Computable</code></a>&lt;<a href="./../lib/break_eternity.html#decimalsource"><code>DecimalSource</code></a>&gt;</td><td style="text-align:left;">The value to multiply the input value by.</td></tr><tr><td style="text-align:left;"><code>description?</code></td><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">Description of what this modifier is doing.</td></tr><tr><td style="text-align:left;"><code>enabled?</code></td><td style="text-align:left;"><code>S</code></td><td style="text-align:left;">A computable that will be processed and passed directly into the returned modifier.</td></tr></tbody></table><h4 id="returns-3" tabindex="-1">Returns <a class="header-anchor" href="#returns-3" aria-hidden="true">#</a></h4><p><code>R</code></p><hr><h3 id="createsequentialmodifier" tabindex="-1">createSequentialModifier <a class="header-anchor" href="#createsequentialmodifier" aria-hidden="true">#</a></h3><p>\u25B8 <strong>createSequentialModifier</strong>&lt;<code>T</code>, <code>S</code>&gt;(...<code>modifiers</code>): <code>S</code></p><p>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.</p><p><strong><code>See</code></strong></p><p><a href="./modifiers.html#createmodifiersection">createModifierSection</a>.</p><h4 id="type-parameters-4" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters-4" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">extends <a href="../../interfaces/game/modifiers.Modifier"><code>Modifier</code></a>[]</td></tr><tr><td style="text-align:left;"><code>S</code></td><td style="text-align:left;"><code>T</code> extends <a href="./../util/common.html#withrequired"><code>WithRequired</code></a>&lt;<a href="../../interfaces/game/modifiers.Modifier"><code>Modifier</code></a>, <code>&quot;revert&quot;</code>&gt;[] ? <a href="./../util/common.html#withrequired"><code>WithRequired</code></a>&lt;<a href="../../interfaces/game/modifiers.Modifier"><code>Modifier</code></a>, <code>&quot;description&quot;</code> | <code>&quot;revert&quot;</code>&gt; : <code>Omit</code>&lt;<a href="./../util/common.html#withrequired"><code>WithRequired</code></a>&lt;<a href="../../interfaces/game/modifiers.Modifier"><code>Modifier</code></a>, <code>&quot;description&quot;</code>&gt;, <code>&quot;revert&quot;</code>&gt;</td></tr></tbody></table><h4 id="parameters-4" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-4" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;"><code>...modifiers</code></td><td style="text-align:left;"><code>T</code></td><td style="text-align:left;">The modifiers to perform sequentially.</td></tr></tbody></table><h4 id="returns-4" tabindex="-1">Returns <a class="header-anchor" href="#returns-4" aria-hidden="true">#</a></h4><p><code>S</code></p>',61),r=[i];function l(c,n,s,h,f,m){return d(),t("div",null,r)}var g=e(o,[["render",l]]);export{p as __pageData,g as default};