profectus-docs/assets/api_modules_game_formulas_formulas.md.f896b012.js

2 lines
96 KiB
JavaScript
Raw Normal View History

import{_ as e,c as o,o as t,N as c}from"./chunks/framework.0799945b.js";const h=JSON.parse('{"title":"Module: game/formulas/formulas","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/game/formulas/formulas.md","lastUpdated":null}'),d={name:"api/modules/game/formulas/formulas.md"},r=c('<h1 id="module-game-formulas-formulas" tabindex="-1">Module: game/formulas/formulas <a class="header-anchor" href="#module-game-formulas-formulas" aria-label="Permalink to &quot;Module: game/formulas/formulas&quot;"></a></h1><h2 id="classes" tabindex="-1">Classes <a class="header-anchor" href="#classes" aria-label="Permalink to &quot;Classes&quot;"></a></h2><h3 id="default" tabindex="-1">default <a class="header-anchor" href="#default" aria-label="Permalink to &quot;default&quot;"></a></h3><p> <strong>default</strong>&lt;<code>T</code>&gt;: <code>Object</code></p><p>A class that can be used for cost/goal functions. It can be evaluated similar to a cost function, but also provides extra features for supported formulas. For example, a lot of math functions can be inverted. Typically, the use of these extra features is to support cost/goal functions that have multiple levels purchased/completed at once efficiently.</p><p><strong><code>See</code></strong></p><ul><li><a href="./formulas#calculatemaxaffordable">calculateMaxAffordable</a></li><li><a href="./../requirements#createcostrequirement">createCostRequirement</a></li></ul><h4 id="type-parameters" tabindex="-1">Type parameters <a class="header-anchor" href="#type-parameters" aria-label="Permalink to &quot;Type parameters&quot;"></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="./types#formulasource"><code>FormulaSource</code></a>] | <a href="./types#formulasource"><code>FormulaSource</code></a>[]</td></tr></tbody></table><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>constructor</code></td><td style="text-align:left;">&lt;T&gt;(<code>options</code>: <a href="./types#formulaoptions"><code>FormulaOptions</code></a>&lt;<code>T</code>&gt;) =&gt; <a href="./formulas#default"><code>default</code></a>&lt;<code>T</code>&gt;</td></tr><tr><td style="text-align:left;"><code>applySubstitution</code></td><td style="text-align:left;"><code>undefined</code> | <a href="./types#substitutionfunction"><code>SubstitutionFunction</code></a>&lt;<code>T</code>&gt;</td></tr><tr><td style="text-align:left;"><code>divide</code></td><td style="text-align:left;">&lt;T&gt;(<code>this</code>: <code>T</code>, <code>value</code>: <a href="./types#formulasource"><code>FormulaSource</code></a>) =&gt; <code>T</code>&lt;T&gt;(<code>this</code>: <a href="./types#genericformula"><code>GenericFormula</code></a>, <code>value</code>: <code>T</code>) =&gt; <code>T</code>(<code>this</code>: <a href="./types#genericformula"><code>GenericFormula</code></a>, <code>value</code>: <a href="./types#formulasource"><code>FormulaSource</code></a>) =&gt; <a href="./types#genericformula"><code>GenericFormula</code></a></td></tr><tr><td style="text-align:left;"><code>divideBy</code></td><td style="text-align:left;">&lt;T&gt;(<code>this</code>: <code>T</code>, <code>value</code>: <a href="./types#formulasource"><code>FormulaSource</code></a>) =&gt; <code>T</code>&lt;T&gt;(<code>this</code>: <a href="./types#genericformula"><code>GenericFormula</code></a>, <code>value</code>: <code>T</code>) =&gt; <code>T</code>(<code>this</code>: <a href="./types#genericformula"><code>GenericFormula</code></a>, <code>value</code>: <a href="./types#formulasource"><code>FormulaSource</code></a>) =&gt; <a href="./types#genericformula"><code>GenericFormula</code></a></td></tr><tr><td style="text-align:left;"><code>dividedBy</code></td><td style="text-align:left;">&lt;T&gt;(<code>this</code>: <code>T</code>, <code>value</code>: <a href=".