Profectus / game/requirements / CostRequirementOptions
Interface: CostRequirementOptions ​
An object that configures a Requirement based on a resource cost.
Properties ​
cost ​
cost:
MaybeRefOrGetter<DecimalSource> |GenericFormula
The amount of resource that must be met for this requirement. You can pass a formula, in which case maximizing will work out of the box (assuming its invertible and, for more accurate calculations, its integral is invertible). If you don't pass a formula then you can still support maximizing by passing a custom pay function.
Defined in ​
profectus/src/game/requirements.tsx:62
cumulativeCost? ​
optionalcumulativeCost:MaybeRefOrGetter<boolean>
When calculating multiple levels to be handled at once, whether it should consider resources used for each level as spent. Setting this to false causes calculations to be faster with larger numbers and supports more math functions.
See ​
Defined in ​
profectus/src/game/requirements.tsx:75
directSum? ​
optionaldirectSum:MaybeRefOrGetter<number>
When calculating requirement for multiple levels, how many should be directly summed for increase accuracy. High numbers can cause lag. Defaults to 10 if cumulative cost, 0 otherwise.
Defined in ​
profectus/src/game/requirements.tsx:83
maxBulkAmount? ​
optionalmaxBulkAmount:MaybeRefOrGetter<DecimalSource>
Upper limit on levels that can be performed at once. Defaults to 1.
Defined in ​
profectus/src/game/requirements.tsx:79
pay()? ​
optionalpay: (amount?) =>void
Pass-through to Requirement.pay. May be required for maximizing support.
Parameters ​
amount? ​
Returns ​
void
See ​
cost for restrictions on maximizing support.
Defined in ​
profectus/src/game/requirements.tsx:88
requiresPay? ​
optionalrequiresPay:MaybeRefOrGetter<boolean>
Pass-through to ["requiresPay"]. If not set to false, the default pay function will remove cost from resource.
Defined in ​
profectus/src/game/requirements.tsx:70
resource ​
resource:
Resource
The resource that will be checked for meeting the cost.
Defined in ​
profectus/src/game/requirements.tsx:58
visibility? ​
optionalvisibility:MaybeRefOrGetter<boolean|Visible|None>
Pass-through to Requirement.visibility.