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
createLinearScaling.
Methods
currentAt
▸ currentAt(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
Name | Type |
---|---|
conversion | GenericConversion |
Returns
Defined in
profectus/src/features/conversion.ts:206
currentGain
▸ currentGain(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
Name | Type |
---|---|
conversion | GenericConversion |
Returns
Defined in
profectus/src/features/conversion.ts:199
nextAt
▸ nextAt(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
Name | Type |
---|---|
conversion | GenericConversion |