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 ​
The formula to use for calculating buy max from
amountToBuy ​
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 ​
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 ​
The formula to use for calculating buy max from
amountToBuy ​
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