Skip to content
On this page

Interface: ScalingFunction

features/conversion.ScalingFunction

A collection of functions that allow a conversion to scale the amount of resources gained based on the input resource. This typically shouldn't be created directly. Instead use one of the scaling function constructors.

See

Properties

currentAt

currentAt: (conversion: GenericConversion) => DecimalSource

Type declaration

▸ (conversion): DecimalSource

Calculates the amount of the input resource that is required for the current value of conversion.currentGain. Note that conversion.currentGain has been modified by conversion.gainModifier, so you will need to revert that as appropriate. The conversion is responsible for rounding up the amount as appropriate. The returned value should not be below 0.

Parameters
NameType
conversionGenericConversion
Returns

DecimalSource

Defined in

profectus/src/features/conversion.ts:227


currentGain

currentGain: (conversion: GenericConversion) => DecimalSource

Type declaration

▸ (conversion): DecimalSource

Calculates the amount of the output resource a conversion should be able to currently produce. This should be based off of conversion.baseResource.value. The conversion is responsible for applying the gainModifier, so this function should be un-modified. It does not need to be clamped or rounded.

Parameters
NameType
conversionGenericConversion
Returns

DecimalSource

Defined in

profectus/src/features/conversion.ts:220


nextAt

nextAt: (conversion: GenericConversion) => DecimalSource

Type declaration

▸ (conversion): DecimalSource

Calculates the amount of the input resource that would be required for the current value of conversion.currentGain to increase. Note that conversion.currentGain has been modified by conversion.gainModifier, so you will need to revert that as appropriate. The conversion is responsible for rounding up the amount as appropriate. The returned value should not be below 0.

Parameters
NameType
conversionGenericConversion
Returns

DecimalSource

Defined in

profectus/src/features/conversion.ts:234