profectus-docs/assets/api_game_formulas_formulas_functions_calculateCost.md.CJpOXPxn.lean.js

1 line
6.1 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as e,c as t,a0 as o,o as r}from"./chunks/framework.P9qPzDnn.js";const d=JSON.parse('{"title":"Function: calculateCost()","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/game/formulas/formulas/functions/calculateCost.md","filePath":"api/game/formulas/formulas/functions/calculateCost.md","lastUpdated":null}'),c={name:"api/game/formulas/formulas/functions/calculateCost.md"};function l(u,a,s,i,n,m){return r(),t("div",null,a[0]||(a[0]=[o('<p><a href="./../../../../">Profectus</a> / <a href="./../">game/formulas/formulas</a> / calculateCost</p><h1 id="function-calculatecost" tabindex="-1">Function: calculateCost() <a class="header-anchor" href="#function-calculatecost" aria-label="Permalink to &quot;Function: calculateCost()&quot;"></a></h1><h2 id="call-signature" tabindex="-1">Call Signature <a class="header-anchor" href="#call-signature" aria-label="Permalink to &quot;Call Signature&quot;"></a></h2><blockquote><p><strong>calculateCost</strong>(<code>formula</code>, <code>amountToBuy</code>, <code>cumulativeCost</code>?, <code>directSum</code>?): <a href="./../../../../util/bignum/type-aliases/DecimalSource"><code>DecimalSource</code></a></p></blockquote><p>Utility for calculating the cost of a formula for a given amount of purchases. If <a href="./calculateCost#cumulativecost">cumulativeCost</a> is changed to false, the calculation will be much faster with higher numbers.</p><h3 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><h4 id="formula" tabindex="-1">formula <a class="header-anchor" href="#formula" aria-label="Permalink to &quot;formula&quot;"></a></h4><p><a href="./../../types/type-aliases/InvertibleFormula"><code>InvertibleFormula</code></a></p><p>The formula to use for calculating buy max from</p><h4 id="amounttobuy" tabindex="-1">amountToBuy <a class="header-anchor" href="#amounttobuy" aria-label="Permalink to &quot;amountToBuy&quot;"></a></h4><p><a href="./../../../../lib/break_eternity/type-aliases/DecimalSource"><code>DecimalSource</code></a></p><p>The amount of purchases to calculate the cost for</p><h4 id="cumulativecost" tabindex="-1">cumulativeCost? <a class="header-anchor" href="#cumulativecost" aria-label="Permalink to &quot;cumulativeCost?&quot;"></a></h4><p><code>true</code></p><p>Whether or not to count spent resources on each purchase or not. If true, costs will be approximated for performance, skewing towards higher cost</p><h4 id="directsum" tabindex="-1">directSum? <a class="header-anchor" href="#directsum" aria-label="Permalink to &quot;directSum?&quot;"></a></h4><p><code>number</code></p><p>How many purchases to manually sum for improved accuracy. If not specified, defaults to 10 when cost is cumulative and 0 when not</p><h3 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-label="Permalink to &quot;Returns&quot;"></a></h3><p><a href="./../../../../util/bignum/type-aliases/DecimalSource"><code>DecimalSource</code></a></p><h3 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-label="Permalink to &quot;Defined in&quot;"></a></h3><p><a href="https://code.incremental.social/profectus/Profectus/src/branch/main/src/game/formulas/formulas.ts#L1522" target="_blank" rel="noreferrer">profectus/src/game/formulas/formulas.ts:1522</a></p><h2 id="call-signature-1" tabindex="-1">Call Signature <a class="header-anchor" href="#call-signature-1" aria-label="Permalink to &quot;Call Signature&quot;"></a></h2><blockquote><p><strong>calculateCost</strong>(<code>formula</code>, <code>amountToBuy</code>, <code>cumulativeCost</code>, <code>directSum</code>?): <a href="./../../../../util/bignum/type-aliases/DecimalSource"><code>DecimalSource</code></a></p></blockquote><p>Utility for calculating the cost of a formula for a given amount of purchases. If <a href="./calculateCost#cumulativecost">cumulativeCost</a> is changed to false, the calculation will be much faster with higher numbers.</p><h3 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" aria-label="Permalink to &quot;Parameters&quot;"></a></h3><h4 id="formula-1" tabindex="-1">formula <a class="header-anchor" href="#formula-1" aria-label="Permalink to &quot;formula&quot;"></a></h4><p><a href="./../../types/type-aliases/InvertibleIntegralFormula"><code>InvertibleIntegralFormula</code></a></p><p>The formula to use for calculating buy max from</p><h4 id="amounttobuy-1" tabindex="-1">amountToBuy <a class="header-anchor" href="#amounttobuy-1" aria-label="Permalink to &quot;amountToBuy&quot;"></a></h4><p><a href="./../../../../lib/break_eternity/type-aliases/DecimalSource"><code>DecimalSource</code></a></p><p>The amount of purchases to calculate the cost for</p><h4 id="cumulativecost-1" tabindex="-1">cumulativeCost <a class="header-anchor" href="#cumulativecost-1" aria-label="Permalink to &quot;cumulativeCost&quot;"></a></h4><p><code>boolean</code></p><p>Whether or not to count spent resources on each purchase or not. If true, costs will be approximated for performance, skewing towards higher cost</p><h4 id="directsum-1" tabindex="-1">directSum? <a class="header-anchor" href="#directsum-1" aria-label="Permalink to &quot;directSum?&quot;"></a></h4><p><code>number</code></p><p>How many purchases to manually sum for improved accuracy. If not specified, defaults to 10 when cost is cumulative and 0 when not</p><h3 id="returns-1" tabindex="-1">Returns <a class="header-anchor" href="#returns-1" aria-label="Permalink to &quot;Returns&quot;"></a></h3><p><a href="./../../../../util/bignum/type-aliases/DecimalSource"><code>DecimalSource</code></a></p><h3 id="defined-in-1" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-1" aria-label="Permalink to &quot;Defined in&quot;"></a></h3><p><a href="https://code.incremental.social/profectus/Profectus/src/branch/main/src/game/formulas/formulas.ts#L1528" target="_blank" rel="noreferrer">profectus/src/game/formulas/formulas.ts:1528</a></p>',42)]))}const f=e(c,[["render",l]]);export{d as __pageData,f as default};