Skip to content

Profectus / game/requirements / CostRequirement

Interface: CostRequirement ​

An object that can be used to describe a requirement to perform some purchase or other action.

See ​

createCostRequirement

Extends ​

Properties ​

canMaximize? ​

optional canMaximize: MaybeRef<boolean>

Whether or not this requirement can have multiple levels of requirements that can be met at once. Requirement is assumed to not have multiple levels if this property not present.

Inherited from ​

Requirement.canMaximize

Defined in ​

profectus/src/game/requirements.tsx:40


cost ​

cost: MaybeRef<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:99


cumulativeCost ​

cumulativeCost: MaybeRef<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:104


directSum? ​

optional directSum: MaybeRef<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:112


display()? ​

optional display: (amount?) => Renderable

The display for this specific requirement. Required if visibility can be Visibility.Visible.

Parameters ​

amount? ​

DecimalSource

Returns ​

Renderable

Inherited from ​

Requirement.display

Defined in ​

profectus/src/game/requirements.tsx:24


maxBulkAmount? ​

optional maxBulkAmount: MaybeRef<DecimalSource>

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

Defined in ​

profectus/src/game/requirements.tsx:108


partialDisplay()? ​

optional partialDisplay: (amount?) => Renderable

The display for this specific requirement. This is used for displays multiple requirements condensed. Required if visibility can be Visibility.Visible.

Parameters ​

amount? ​

DecimalSource

Returns ​

Renderable

Inherited from ​

Requirement.partialDisplay

Defined in ​

profectus/src/game/requirements.tsx:20


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.

Overrides ​

Requirement.pay

Defined in ​

profectus/src/game/requirements.tsx:117


requirementMet ​

requirementMet: MaybeRef<boolean | DecimalSource>

Whether or not this requirement has been met.

Inherited from ​

Requirement.requirementMet

Defined in ​

profectus/src/game/requirements.tsx:32


requiresPay ​

requiresPay: MaybeRef<boolean>

Whether or not this requirement will need to affect the game state when whatever is using this requirement gets triggered.

Inherited from ​

Requirement.requiresPay

Defined in ​

profectus/src/game/requirements.tsx:36


resource ​

resource: Resource

The resource that will be checked for meeting the cost.

Defined in ​

profectus/src/game/requirements.tsx:95


visibility ​

visibility: MaybeRef<boolean | Visibility>

Whether or not this requirement should be displayed in Vue Features. displayRequirements will respect this property.

Inherited from ​

Requirement.visibility

Defined in ​

profectus/src/game/requirements.tsx:28