Profectus / features/conversion / ConversionOptions
Interface: ConversionOptions ​
An object that configures a Conversion.
Properties ​
actualGain? ​
optional
actualGain:MaybeRefOrGetter
<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:33
baseResource ​
baseResource:
Resource
The input features/resources/resource.Resource for this conversion.
Defined in ​
profectus/src/features/conversion.ts:48
buyMax? ​
optional
buyMax:MaybeRefOrGetter
<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:57
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:62
currentAt? ​
optional
currentAt:MaybeRefOrGetter
<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:39
currentGain? ​
optional
currentGain:MaybeRefOrGetter
<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:27
formula() ​
formula: (
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 ​
variable ​
Returns ​
Defined in ​
profectus/src/features/conversion.ts:22
gainResource ​
gainResource:
Resource
The output features/resources/resource.Resource for this conversion. i.e. the resource being generated.
Defined in ​
profectus/src/features/conversion.ts:52
nextAt? ​
optional
nextAt:MaybeRefOrGetter
<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:44
onConvert()? ​
optional
onConvert: (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 ​
amountGained ​
Returns ​
void
Defined in ​
profectus/src/features/conversion.ts:73
spend()? ​
optional
spend: (amountGained
) =>void
The function that spends the baseResource as part of the conversion. Defaults to setting the baseResource amount to 0.
Parameters ​
amountGained ​
Returns ​
void