Skip to content

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? ​

optional cumulativeCost: 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? ​

optional directSum: 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? ​

optional maxBulkAmount: MaybeRefOrGetter<DecimalSource>

Upper limit on levels that can be performed at once. Defaults to 1.

Defined in ​

profectus/src/game/requirements.tsx:79


pay()? ​

optional pay: (amount?) => void

Pass-through to Requirement.pay. May be required for maximizing support.

Parameters ​

amount? ​

DecimalSource

Returns ​

void

See ​

cost for restrictions on maximizing support.

Defined in ​

profectus/src/game/requirements.tsx:88


requiresPay? ​

optional requiresPay: 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? ​

optional visibility: MaybeRefOrGetter<boolean | Visible | None>

Pass-through to Requirement.visibility.

Defined in ​

profectus/src/game/requirements.tsx:66