Skip to content
On this page

Module: game/formulas/formulas

Classes

InternalFormula

Abstract InternalFormula<T>: Object

Type parameters

NameType
Textends [FormulaSource] | FormulaSource[]
NameType
constructor<T>(options: FormulaOptions<T>) => InternalFormula<T>
applySubstitutionundefined | SubstitutionFunction<T>
divide<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
divideBy<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
dividedBy<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
innermostVariableundefined | ProcessedComputable<DecimalSource>
inputsT
internalEvaluateundefined | EvaluateFunction<T>
internalIntegrateundefined | IntegrateFunction<T>
internalIntegrateInnerundefined | IntegrateFunction<T>
internalInvertundefined | InvertFunction<T>
internalVariablesnumber
logarithm<T>(this: T, value: FormulaSource) => T<T>(this: FormulaSource, value: T) => T(this: FormulaSource, value: FormulaSource) => GenericFormula
minus<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
multiply<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
negate<T>(this: T) => T(this: GenericFormula) => GenericFormula
negated<T>(this: T) => T(this: GenericFormula) => GenericFormula
plus<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
reciprocal<T>(this: T) => T(this: FormulaSource) => GenericFormula
reciprocate<T>(this: T) => T(this: FormulaSource) => GenericFormula
sgn() => default<[FormulaSource]>
subtract<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
times<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
clampMax(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
clampMin(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
divide<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
divideBy<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
dividedBy<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
logarithm<T>(value: T, base: FormulaSource) => T<T>(value: FormulaSource, base: T) => T(value: FormulaSource, base: FormulaSource) => default<[FormulaSource, FormulaSource]>
max(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
maxabs(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
min(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
minabs(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
minus<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
multiply<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
negate<T>(value: T) => T(value: FormulaSource) => GenericFormula
negated<T>(value: T) => T(value: FormulaSource) => GenericFormula
plus<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => InternalFormula<[FormulaSource, FormulaSource]>
reciprocal<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
reciprocate<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
sgn(value: FormulaSource) => default<[FormulaSource]>
subtract<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
times<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
abs() => default<[FormulaSource]>
absLog10() => default<[FormulaSource]>
acos<T>(this: T) => T(this: FormulaSource) => GenericFormula
acosh<T>(this: T) => T(this: FormulaSource) => GenericFormula
add<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
asin<T>(this: T) => T(this: FormulaSource) => GenericFormula
asinh<T>(this: T) => T(this: FormulaSource) => GenericFormula
atan<T>(this: T) => T(this: FormulaSource) => GenericFormula
atanh<T>(this: T) => T(this: FormulaSource) => GenericFormula
calculateConstantOfIntegration?() => default
cbrt<T>(this: T) => T(this: FormulaSource) => GenericFormula
ceil() => default<[FormulaSource]>
clamp(min: FormulaSource, max: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
clampMax(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
clampMin(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
conditional(condition: Computable<boolean>, formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula) => default<[FormulaSource]>
cos<T>(this: T) => T(this: FormulaSource) => GenericFormula
cosh<T>(this: T) => T(this: FormulaSource) => GenericFormula
cube<T>(this: T) => T(this: FormulaSource) => GenericFormula
div<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
equals(other: GenericFormula) => boolean
evaluate(variable?: DecimalSource) => DecimalSource
evaluateIntegral?(variable?: DecimalSource) => DecimalSource
exp<T>(this: T) => T(this: FormulaSource) => GenericFormula
factorial() => default<[FormulaSource]>
floor() => default<[FormulaSource]>
gamma() => default<[FormulaSource]>
getIntegralFormula?(stack?: SubstitutionStack) => GenericFormula
hasVariable() => boolean
if(condition: Computable<boolean>, formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula) => default<[FormulaSource]>
invert?(value: DecimalSource) => DecimalSource
invertIntegral?(value: DecimalSource) => DecimalSource
isIntegrable() => this is IntegrableFormula
isIntegralInvertible() => this is InvertibleIntegralFormula
isInvertible() => this is InvertibleFormula
iteratedexp<T>(this: T, height?: FormulaSource, payload?: FormulaSource) => InvertibleFormula(this: FormulaSource, height?: FormulaSource, payload?: FormulaSource) => GenericFormula
iteratedlog(base: FormulaSource, times: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
lambertw<T>(this: T) => InvertibleFormula(this: FormulaSource) => GenericFormula
layeradd<T>(this: T, diff: FormulaSource, base?: FormulaSource) => InvertibleFormula(this: FormulaSource, diff: FormulaSource, base?: FormulaSource) => GenericFormula
layeradd10(diff: FormulaSource) => default<[FormulaSource, FormulaSource]>
ln<T>(this: T) => T(this: FormulaSource) => GenericFormula
lngamma() => default<[FormulaSource]>
log<T>(this: T, value: FormulaSource) => T<T>(this: FormulaSource, value: T) => T(this: FormulaSource, value: FormulaSource) => GenericFormula
log10<T>(this: T) => T(this: FormulaSource) => GenericFormula
log2<T>(this: T) => T(this: FormulaSource) => GenericFormula
max(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
maxabs(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
min(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
minabs(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
mul<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
neg<T>(this: T) => T(this: GenericFormula) => GenericFormula
pLog10() => default<[FormulaSource]>
pentate(height: FormulaSource, payload: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
pow<T>(this: T, value: FormulaSource) => T<T>(this: FormulaSource, value: T) => T(this: FormulaSource, value: FormulaSource) => GenericFormula
pow10<T>(this: T) => T(this: FormulaSource) => GenericFormula
pow_base<T>(this: T, value: FormulaSource) => T<T>(this: FormulaSource, value: T) => T(this: FormulaSource, value: FormulaSource) => GenericFormula
recip<T>(this: T) => T(this: FormulaSource) => GenericFormula
root<T>(this: T, value: FormulaSource) => T<T>(this: FormulaSource, value: T) => T(this: FormulaSource, value: FormulaSource) => GenericFormula
round() => default<[FormulaSource]>
setupConstant(__namedParameters: { inputs: [FormulaSource] }) => InternalFormulaProperties<T>
setupFormula(options: GeneralFormulaOptions<T>) => InternalFormulaProperties<T>
setupVariable(__namedParameters: { variable: ProcessedComputable<DecimalSource> }) => InternalFormulaProperties<T>
sign() => default<[FormulaSource]>
sin<T>(this: T) => T(this: FormulaSource) => GenericFormula
sinh<T>(this: T) => T(this: FormulaSource) => GenericFormula
slog<T>(this: T, base?: FormulaSource) => InvertibleFormula(this: FormulaSource, base?: FormulaSource) => GenericFormula
sqr<T>(this: T) => T(this: FormulaSource) => GenericFormula
sqrt<T>(this: T) => T(this: FormulaSource) => GenericFormula
ssqrt<T>(this: T) => InvertibleFormula(this: FormulaSource) => GenericFormula
step(start: Computable<DecimalSource>, formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula) => default<[FormulaSource]>
sub<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
tan<T>(this: T) => T(this: FormulaSource) => GenericFormula
tanh<T>(this: T) => T(this: FormulaSource) => GenericFormula
tetrate<T>(this: T, height?: FormulaSource, payload?: FormulaSource) => InvertibleFormula(this: FormulaSource, height?: FormulaSource, payload?: FormulaSource) => GenericFormula
trunc() => default<[FormulaSource]>
abs(value: FormulaSource) => default<[FormulaSource]>
absLog10(value: FormulaSource) => default<[FormulaSource]>
acos<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
acosh<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
add<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => InternalFormula<[FormulaSource, FormulaSource]>
asin<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
asinh<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
atan<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
atanh<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
cbrt<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
ceil(value: FormulaSource) => default<[FormulaSource]>
clamp(value: FormulaSource, min: FormulaSource, max: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
conditional(value: FormulaSource, condition: Computable<boolean>, formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula, elseFormulaModifier?: (value: InvertibleIntegralFormula) => GenericFormula) => default<[FormulaSource]>
constant(value: ProcessedComputable<DecimalSource>) => InvertibleIntegralFormula
cos<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
cosh<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
cube<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
div<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
exp<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
factorial(value: FormulaSource) => default<[FormulaSource]>
floor(value: FormulaSource) => default<[FormulaSource]>
gamma(value: FormulaSource) => default<[FormulaSource]>
if(value: FormulaSource, condition: Computable<boolean>, formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula, elseFormulaModifier?: (value: InvertibleIntegralFormula) => GenericFormula) => default<[FormulaSource]>
iteratedexp<T>(value: T, height?: FormulaSource, payload?: FormulaSource) => InvertibleFormula(value: FormulaSource, height?: FormulaSource, payload?: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
iteratedlog(value: FormulaSource, base: FormulaSource, times: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
lambertw<T>(value: T) => InvertibleFormula(value: FormulaSource) => default<[FormulaSource]>
layeradd<T>(value: T, diff: FormulaSource, base?: FormulaSource) => InvertibleFormula(value: FormulaSource, diff: FormulaSource, base?: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
layeradd10(value: FormulaSource, diff: FormulaSource) => default<[FormulaSource, FormulaSource]>
ln<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
lngamma(value: FormulaSource) => default<[FormulaSource]>
log<T>(value: T, base: FormulaSource) => T<T>(value: FormulaSource, base: T) => T(value: FormulaSource, base: FormulaSource) => default<[FormulaSource, FormulaSource]>
log10<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
log2<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
mul<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
neg<T>(value: T) => T(value: FormulaSource) => GenericFormula
pLog10(value: FormulaSource) => default<[FormulaSource]>
pentate(value: FormulaSource, height: FormulaSource, payload: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
pow<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
pow10<T>(value: T) => T(value: FormulaSource) => GenericFormula
pow_base<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
recip<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
root<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
round(value: FormulaSource) => default<[FormulaSource]>
sign(value: FormulaSource) => default<[FormulaSource]>
sin<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
sinh<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
slog<T>(value: T, base?: FormulaSource) => InvertibleFormula(value: FormulaSource, base?: FormulaSource) => default<[FormulaSource, FormulaSource]>
sqr<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
sqrt<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
ssqrt<T>(value: T) => InvertibleFormula(value: FormulaSource) => default<[FormulaSource]>
step(value: FormulaSource, start: Computable<DecimalSource>, formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula) => default<[FormulaSource]>
sub<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
tan<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
tanh<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
tetrate<T>(value: T, height?: FormulaSource, payload?: FormulaSource) => InvertibleFormula(value: FormulaSource, height?: FormulaSource, payload?: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
trunc(value: FormulaSource) => default<[FormulaSource]>
variable(value: ProcessedComputable<DecimalSource>) => InvertibleIntegralFormula

Defined in

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

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


default

default<T>: Object

A class that can be used for cost/goal functions. It can be evaluated similar to a cost function, but also provides extra features for supported formulas. For example, a lot of math functions can be inverted. Typically, the use of these extra features is to support cost/goal functions that have multiple levels purchased/completed at once efficiently.

See

Type parameters

NameType
Textends [FormulaSource] | FormulaSource[]
NameType
constructor<T>(options: FormulaOptions<T>) => default<T>
applySubstitutionundefined | SubstitutionFunction<T>
divide<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
divideBy<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
dividedBy<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
innermostVariableundefined | ProcessedComputable<DecimalSource>
inputsT
integralFormulaundefined | GenericFormula
internalEvaluateundefined | EvaluateFunction<T>
internalIntegrateundefined | IntegrateFunction<T>
internalIntegrateInnerundefined | IntegrateFunction<T>
internalInvertundefined | InvertFunction<T>
internalVariablesnumber
logarithm<T>(this: T, value: FormulaSource) => T<T>(this: FormulaSource, value: T) => T(this: FormulaSource, value: FormulaSource) => GenericFormula
minus<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
multiply<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
negate<T>(this: T) => T(this: GenericFormula) => GenericFormula
negated<T>(this: T) => T(this: GenericFormula) => GenericFormula
plus<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
reciprocal<T>(this: T) => T(this: FormulaSource) => GenericFormula
reciprocate<T>(this: T) => T(this: FormulaSource) => GenericFormula
sgn() => default<[FormulaSource]>
subtract<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
times<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
clampMax(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
clampMin(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
divide<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
divideBy<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
dividedBy<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
logarithm<T>(value: T, base: FormulaSource) => T<T>(value: FormulaSource, base: T) => T(value: FormulaSource, base: FormulaSource) => default<[FormulaSource, FormulaSource]>
max(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
maxabs(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
min(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
minabs(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
minus<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
multiply<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
negate<T>(value: T) => T(value: FormulaSource) => GenericFormula
negated<T>(value: T) => T(value: FormulaSource) => GenericFormula
plus<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => InternalFormula<[FormulaSource, FormulaSource]>
reciprocal<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
reciprocate<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
sgn(value: FormulaSource) => default<[FormulaSource]>
subtract<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
times<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
abs() => default<[FormulaSource]>
absLog10() => default<[FormulaSource]>
acos<T>(this: T) => T(this: FormulaSource) => GenericFormula
acosh<T>(this: T) => T(this: FormulaSource) => GenericFormula
add<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
asin<T>(this: T) => T(this: FormulaSource) => GenericFormula
asinh<T>(this: T) => T(this: FormulaSource) => GenericFormula
atan<T>(this: T) => T(this: FormulaSource) => GenericFormula
atanh<T>(this: T) => T(this: FormulaSource) => GenericFormula
calculateConstantOfIntegration() => default
cbrt<T>(this: T) => T(this: FormulaSource) => GenericFormula
ceil() => default<[FormulaSource]>
clamp(min: FormulaSource, max: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
clampMax(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
clampMin(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
conditional(condition: Computable<boolean>, formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula) => default<[FormulaSource]>
cos<T>(this: T) => T(this: FormulaSource) => GenericFormula
cosh<T>(this: T) => T(this: FormulaSource) => GenericFormula
cube<T>(this: T) => T(this: FormulaSource) => GenericFormula
div<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
equals(other: GenericFormula) => boolean
evaluate(variable?: DecimalSource) => DecimalSource
evaluateIntegral(variable?: DecimalSource) => DecimalSource
exp<T>(this: T) => T(this: FormulaSource) => GenericFormula
factorial() => default<[FormulaSource]>
floor() => default<[FormulaSource]>
gamma() => default<[FormulaSource]>
getIntegralFormula(stack?: SubstitutionStack) => GenericFormula
hasVariable() => boolean
if(condition: Computable<boolean>, formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula) => default<[FormulaSource]>
invert(value: DecimalSource) => DecimalSource
invertIntegral(value: DecimalSource) => DecimalSource
isIntegrable() => this is IntegrableFormula
isIntegralInvertible() => this is InvertibleIntegralFormula
isInvertible() => this is InvertibleFormula
iteratedexp<T>(this: T, height?: FormulaSource, payload?: FormulaSource) => InvertibleFormula(this: FormulaSource, height?: FormulaSource, payload?: FormulaSource) => GenericFormula
iteratedlog(base: FormulaSource, times: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
lambertw<T>(this: T) => InvertibleFormula(this: FormulaSource) => GenericFormula
layeradd<T>(this: T, diff: FormulaSource, base?: FormulaSource) => InvertibleFormula(this: FormulaSource, diff: FormulaSource, base?: FormulaSource) => GenericFormula
layeradd10(diff: FormulaSource) => default<[FormulaSource, FormulaSource]>
ln<T>(this: T) => T(this: FormulaSource) => GenericFormula
lngamma() => default<[FormulaSource]>
log<T>(this: T, value: FormulaSource) => T<T>(this: FormulaSource, value: T) => T(this: FormulaSource, value: FormulaSource) => GenericFormula
log10<T>(this: T) => T(this: FormulaSource) => GenericFormula
log2<T>(this: T) => T(this: FormulaSource) => GenericFormula
max(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
maxabs(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
min(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
minabs(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
mul<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
neg<T>(this: T) => T(this: GenericFormula) => GenericFormula
pLog10() => default<[FormulaSource]>
pentate(height: FormulaSource, payload: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
pow<T>(this: T, value: FormulaSource) => T<T>(this: FormulaSource, value: T) => T(this: FormulaSource, value: FormulaSource) => GenericFormula
pow10<T>(this: T) => T(this: FormulaSource) => GenericFormula
pow_base<T>(this: T, value: FormulaSource) => T<T>(this: FormulaSource, value: T) => T(this: FormulaSource, value: FormulaSource) => GenericFormula
recip<T>(this: T) => T(this: FormulaSource) => GenericFormula
root<T>(this: T, value: FormulaSource) => T<T>(this: FormulaSource, value: T) => T(this: FormulaSource, value: FormulaSource) => GenericFormula
round() => default<[FormulaSource]>
sign() => default<[FormulaSource]>
sin<T>(this: T) => T(this: FormulaSource) => GenericFormula
sinh<T>(this: T) => T(this: FormulaSource) => GenericFormula
slog<T>(this: T, base?: FormulaSource) => InvertibleFormula(this: FormulaSource, base?: FormulaSource) => GenericFormula
sqr<T>(this: T) => T(this: FormulaSource) => GenericFormula
sqrt<T>(this: T) => T(this: FormulaSource) => GenericFormula
ssqrt<T>(this: T) => InvertibleFormula(this: FormulaSource) => GenericFormula
step(start: Computable<DecimalSource>, formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula) => default<[FormulaSource]>
sub<T>(this: T, value: FormulaSource) => T<T>(this: GenericFormula, value: T) => T(this: GenericFormula, value: FormulaSource) => GenericFormula
tan<T>(this: T) => T(this: FormulaSource) => GenericFormula
tanh<T>(this: T) => T(this: FormulaSource) => GenericFormula
tetrate<T>(this: T, height?: FormulaSource, payload?: FormulaSource) => InvertibleFormula(this: FormulaSource, height?: FormulaSource, payload?: FormulaSource) => GenericFormula
trunc() => default<[FormulaSource]>
abs(value: FormulaSource) => default<[FormulaSource]>
absLog10(value: FormulaSource) => default<[FormulaSource]>
acos<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
acosh<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
add<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => InternalFormula<[FormulaSource, FormulaSource]>
asin<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
asinh<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
atan<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
atanh<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
cbrt<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
ceil(value: FormulaSource) => default<[FormulaSource]>
clamp(value: FormulaSource, min: FormulaSource, max: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
conditional(value: FormulaSource, condition: Computable<boolean>, formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula, elseFormulaModifier?: (value: InvertibleIntegralFormula) => GenericFormula) => default<[FormulaSource]>
constant(value: ProcessedComputable<DecimalSource>) => InvertibleIntegralFormula
cos<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
cosh<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
cube<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
div<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
exp<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
factorial(value: FormulaSource) => default<[FormulaSource]>
floor(value: FormulaSource) => default<[FormulaSource]>
gamma(value: FormulaSource) => default<[FormulaSource]>
if(value: FormulaSource, condition: Computable<boolean>, formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula, elseFormulaModifier?: (value: InvertibleIntegralFormula) => GenericFormula) => default<[FormulaSource]>
iteratedexp<T>(value: T, height?: FormulaSource, payload?: FormulaSource) => InvertibleFormula(value: FormulaSource, height?: FormulaSource, payload?: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
iteratedlog(value: FormulaSource, base: FormulaSource, times: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
lambertw<T>(value: T) => InvertibleFormula(value: FormulaSource) => default<[FormulaSource]>
layeradd<T>(value: T, diff: FormulaSource, base?: FormulaSource) => InvertibleFormula(value: FormulaSource, diff: FormulaSource, base?: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
layeradd10(value: FormulaSource, diff: FormulaSource) => default<[FormulaSource, FormulaSource]>
ln<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
lngamma(value: FormulaSource) => default<[FormulaSource]>
log<T>(value: T, base: FormulaSource) => T<T>(value: FormulaSource, base: T) => T(value: FormulaSource, base: FormulaSource) => default<[FormulaSource, FormulaSource]>
log10<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
log2<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
mul<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
neg<T>(value: T) => T(value: FormulaSource) => GenericFormula
pLog10(value: FormulaSource) => default<[FormulaSource]>
pentate(value: FormulaSource, height: FormulaSource, payload: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
pow<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
pow10<T>(value: T) => T(value: FormulaSource) => GenericFormula
pow_base<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
recip<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
root<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
round(value: FormulaSource) => default<[FormulaSource]>
sign(value: FormulaSource) => default<[FormulaSource]>
sin<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
sinh<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
slog<T>(value: T, base?: FormulaSource) => InvertibleFormula(value: FormulaSource, base?: FormulaSource) => default<[FormulaSource, FormulaSource]>
sqr<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
sqrt<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource, FormulaSource]>
ssqrt<T>(value: T) => InvertibleFormula(value: FormulaSource) => default<[FormulaSource]>
step(value: FormulaSource, start: Computable<DecimalSource>, formulaModifier: (value: InvertibleIntegralFormula) => GenericFormula) => default<[FormulaSource]>
sub<T>(value: T, other: FormulaSource) => T<T>(value: FormulaSource, other: T) => T(value: FormulaSource, other: FormulaSource) => default<[FormulaSource, FormulaSource]>
tan<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
tanh<T>(value: T) => T(value: FormulaSource) => default<[FormulaSource]>
tetrate<T>(value: T, height?: FormulaSource, payload?: FormulaSource) => InvertibleFormula(value: FormulaSource, height?: FormulaSource, payload?: FormulaSource) => default<[FormulaSource, FormulaSource, FormulaSource]>
trunc(value: FormulaSource) => default<[FormulaSource]>
variable(value: ProcessedComputable<DecimalSource>) => InvertibleIntegralFormula

Defined in

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

Functions

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.

Parameters
NameTypeDescription
formulaInvertibleFormulaThe formula to use for calculating buy max from
amountToBuyDecimalSourceThe amount of purchases to calculate the cost for
cumulativeCost?trueWhether or not to count spent resources on each purchase or not. If true, costs will be approximated for performance, skewing towards higher cost
directSum?numberHow many purchases to manually sum for improved accuracy. If not specified, defaults to 10 when cost is cumulative and 0 when not
Returns

DecimalSource

Other signatures

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

NameType
formulaInvertibleIntegralFormula
amountToBuyDecimalSource
cumulativeCostboolean
directSum?number

Defined in

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

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

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


calculateMaxAffordable

calculateMaxAffordable(formula, resource, cumulativeCost?, directSum?, maxBulkAmount?): ComputedRef<default | 0>

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

Parameters
NameTypeDefault valueDescription
formulaGenericFormulaundefinedThe formula to use for calculating buy max from
resourceResource<DecimalSource>undefinedThe resource used when purchasing (is only read from)
cumulativeCostComputable<boolean>trueWhether or not to count spent resources on each purchase or not. If true, costs will be approximated for performance, skewing towards fewer purchases
directSum?Computable<number>undefinedHow many of the most expensive purchases should be manually summed for better accuracy. If unspecified uses 10 when spending resources and 0 when not
maxBulkAmountComputable<DecimalSource>Decimal.dInfCap on how many can be purchased at once. If equal to 1 or lte to directSum then the formula does not need to be invertible. Defaults to Infinity.
Returns

ComputedRef<default | 0>

Defined in

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


findNonInvertible

findNonInvertible(formula): GenericFormula | null

Utility for recursively searching through a formula for the cause of non-invertibility.

Parameters
NameTypeDescription
formulaGenericFormulaThe formula to search for a non-invertible formula within
Returns

GenericFormula | null

Defined in

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


hasVariable

hasVariable(value): value is InvertibleFormula

NameType
valueFormulaSource

Defined in

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


printFormula

printFormula(formula): string

Stringifies a formula so it's more easy to read in the console

Parameters
NameTypeDescription
formulaFormulaSourceThe formula to print
Returns

string

Defined in

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


unrefFormulaSource

unrefFormulaSource(value, variable?): DecimalSource

NameType
valueFormulaSource
variable?DecimalSource

Defined in

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