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
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.
The formula to use for calculating buy max from
The amount of purchases to calculate the cost for
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
number
How many purchases to manually sum for improved accuracy. If not specified, defaults to 10 when cost is cumulative and 0 when not
profectus/src/game/formulas/formulas.ts:1522
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.
The formula to use for calculating buy max from
The amount of purchases to calculate the cost for
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
number
How many purchases to manually sum for improved accuracy. If not specified, defaults to 10 when cost is cumulative and 0 when not