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

2 lines
15 KiB
JavaScript
Raw Normal View History

import{_ as e,c as t,o as a,N as r}from"./chunks/framework.0799945b.js";const b=JSON.parse('{"title":"Module: game/formulas/formulas","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/game/formulas/formulas.md","lastUpdated":null}'),o={name:"api/modules/game/formulas/formulas.md"},l=r('<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><ul><li><a href="../../../classes/game/formulas/formulas.default">default</a></li></ul><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-label="Permalink to &quot;Functions&quot;"></a></h2><h3 id="calculatecost" tabindex="-1">calculateCost <a class="header-anchor" href="#calculatecost" aria-label="Permalink to &quot;calculateCost&quot;"></a></h3><p> <strong>calculateCost</strong>(<code>formula</code>, <code>amountToBuy</code>, <code>spendResources?</code>, <code>summedPurchases?</code>): <a href="./../../util/bignum#decimalsource"><code>DecimalSource</code></a></p><p>Utility for calculating the cost of a formula for a given amount of purchases. If spendResources is changed to false, the calculation will be much faster with higher numbers.</p><h4 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-label="Permalink to &quot;Parameters&quot;"></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>formula</code></td><td style="text-align:left;"><a href="./types#invertibleformula"><code>InvertibleFormula</code></a></td><td style="text-align:left;">The formula to use for calculating buy max from</td></tr><tr><td style="text-align:left;"><code>amountToBuy</code></td><td style="text-align:left;"><a href="./../../lib/break_eternity#decimalsource"><code>DecimalSource</code></a></td><td style="text-align:left;">The amount of purchases to calculate the cost for</td></tr><tr><td style="text-align:left;"><code>spendResources?</code></td><td style="text-align:left;"><code>true</code></td><td style="text-align:left;">Whether or not to count spent resources on each purchase or not. If true, costs will be approximated for performance, skewing towards higher cost</td></tr><tr><td style="text-align:left;"><code>summedPurchases?</code></td><td style="text-align:left;"><code>number</code></td><td style="text-align:left;">How many purchases to manually sum for improved accuracy. If not specified, defaults to 10 when spending resources and 0 when not</td></tr></tbody></table><h4 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-label="Permalink to &quot;Returns&quot;"></a></h4><p><a href="./../../util/bignum#decimalsource"><code>DecimalSource</code></a></p><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-label="Permalink to &quot;Defined in&quot;"></a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/70cda5f/src/game/formulas/formulas.ts#L1433" target="_blank" rel="noreferrer">profectus/src/game/formulas/formulas.ts:1433</a></p><p> <strong>calculateCost</strong>(<code>formula</code>, <code>amountToBuy</code>, <code>spendResources</code>, <code>summedPurchases?</code>): <a href="./../../util/bignum#decimalsource"><code>DecimalSource</code></a></p><h4 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" aria-label="Permalink to &quot;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>formula</code></td><td style="text-align:left;"><a href="./types#invertibleint