Skip to content
On this page

Interface: CostRequirementOptions

game/requirements.CostRequirementOptions

An object that configures a Requirement based on a resource cost.

Properties

cost

cost: Computable<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:75


pay

Optional pay: (amount?: DecimalSource) => void

Type declaration

▸ (amount?): void

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

See

cost for restrictions on maximizing support.

Parameters
NameType
amount?DecimalSource
Returns

void

Defined in

profectus/src/game/requirements.tsx:93


requiresPay

Optional requiresPay: Computable<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:83


resource

resource: Resource<DecimalSource>

The resource that will be checked for meeting the cost.

Defined in

profectus/src/game/requirements.tsx:71


spendResources

Optional spendResources: Computable<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:88


visibility

Optional visibility: Computable<boolean | Visible | None>

Pass-through to visibility.

Defined in

profectus/src/game/requirements.tsx:79