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('

Profectus / game/formulas/formulas / calculateCost

Function: calculateCost()

Call Signature

calculateCost(formula, amountToBuy, cumulativeCost?, directSum?): DecimalSource

Utility for calculating the cost of a formula for a given amount of purchases. If cumulativeCost is changed to false, the calculation will be much faster with higher numbers.

Parameters

formula

InvertibleFormula

The formula to use for calculating buy max from

amountToBuy

DecimalSource

The amount of purchases to calculate the cost for

cumulativeCost?

true

Whether or not to count spent resources on each purchase or not. If true, costs will be approximated for performance, skewing towards higher cost

directSum?

number

How many purchases to manually sum for improved accuracy. If not specified, defaults to 10 when cost is cumulative and 0 when not

Returns

DecimalSource

Defined in

profectus/src/game/formulas/formulas.ts:1522

Call Signature

calculateCost(formula, amountToBuy, cumulativeCost, directSum?): DecimalSource

Utility for calculating the cost of a formula for a given amount of purchases. If cumulativeCost is changed to false, the calculation will be much faster with higher numbers.

Parameters

formula

InvertibleIntegralFormula

The formula to use for calculating buy max from

amountToBuy

DecimalSource

The amount of purchases to calculate the cost for

cumulativeCost

boolean

Whether or not to count spent resources on each purchase or not. If true, costs will be approximated for performance, skewing towards higher cost

directSum?

number

How many purchases to manually sum for improved accuracy. If not specified, defaults to 10 when cost is cumulative and 0 when not

Returns

DecimalSource

Defined in

profectus/src/game/formulas/formulas.ts:1528

',42)]))}const f=e(c,[["render",l]]);export{d as __pageData,f as default};