Skip to content
On this page

Interface: ConversionOptions

features/conversion.ConversionOptions

An object that configures a Conversion.

Properties

actualGain

Optional actualGain: Computable<DecimalSource>

The absolute amount the output resource will be changed by. Typically this will be set for you in a conversion constructor. This will differ from currentGain in the cases where the conversion isn't just adding the converted amount to the output resource.

Defined in

profectus/src/features/conversion.ts:38


baseResource

baseResource: Resource<DecimalSource>

The input Resource for this conversion.

Defined in

profectus/src/features/conversion.ts:53


buyMax

Optional buyMax: Computable<boolean>

Whether or not to cap the amount of the output resource gained by converting at 1. Defaults to true.

Defined in

profectus/src/features/conversion.ts:62


convert

Optional convert: VoidFunction

The function that performs the actual conversion from baseResource to gainResource. Typically this will be set for you in a conversion constructor.

Defined in

profectus/src/features/conversion.ts:67


currentAt

Optional currentAt: Computable<DecimalSource>

The amount of the input resource currently being required in order to produce the currentGain. That is, if it went below this value then currentGain would decrease. Typically this will be set for you in a conversion constructor.

Defined in

profectus/src/features/conversion.ts:44


currentGain

Optional currentGain: Computable<DecimalSource>

How much of the output resource the conversion can currently convert for. Typically this will be set for you in a conversion constructor.

Defined in

profectus/src/features/conversion.ts:32


formula

formula: (variable: GenericFormula & { invert: (value: DecimalSource) => DecimalSource } & { evaluateIntegral: (variable?: DecimalSource) => DecimalSource } & { invertIntegral: (value: DecimalSource) => DecimalSource }) => InvertibleFormula

Type declaration

▸ (variable): InvertibleFormula

The formula used to determine how much gainResource should be earned by this converting. The passed value will be a Formula representing the baseResource variable.

Parameters
NameType
variableGenericFormula & { invert: (value: DecimalSource) => DecimalSource } & { evaluateIntegral: (variable?: DecimalSource) => DecimalSource } & { invertIntegral: (value: DecimalSource) => DecimalSource }
Returns

InvertibleFormula

Defined in

profectus/src/features/conversion.ts:25


gainResource

gainResource: Resource<DecimalSource>

The output Resource for this conversion. i.e. the resource being generated.

Defined in

profectus/src/features/conversion.ts:57


nextAt

Optional nextAt: Computable<DecimalSource>

The amount of the input resource required to make currentGain increase. Typically this will be set for you in a conversion constructor.

Defined in

profectus/src/features/conversion.ts:49


onConvert

Optional onConvert: (amountGained: DecimalSource) => void

Type declaration

▸ (amountGained): void

A callback that happens after a conversion has been completed. Receives the amount gained via conversion. This will not be called whenever using currentGain without calling convert (e.g. passive generation)

Parameters
NameType
amountGainedDecimalSource
Returns

void

Defined in

profectus/src/features/conversion.ts:78


spend

Optional spend: (amountGained: DecimalSource) => void

Type declaration

▸ (amountGained): void

The function that spends the baseResource as part of the conversion. Defaults to setting the baseResource amount to 0.

Parameters
NameType
amountGainedDecimalSource
Returns

void

Defined in

profectus/src/features/conversion.ts:72