import{_ as e,c as t,o as r,N as a}from"./chunks/framework.0799945b.js";const p=JSON.parse('{"title":"Module: game/requirements","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"api/modules/game/requirements.md","lastUpdated":null}'),i={name:"api/modules/game/requirements.md"},o=a('

Module: game/requirements

Interfaces

CostRequirementOptions

CostRequirementOptions: Object

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

NameTypeDescription
costComputable<DecimalSource> | GenericFormulaThe 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.
pay?(amount?: DecimalSource) => voidPass-through to pay. May be required for maximizing support. See cost for restrictions on maximizing support.
requiresPay?Computable<boolean>Pass-through to requiresPay. If not set to false, the default pay function will remove cost from resource.
resourceResource<DecimalSource>The resource that will be checked for meeting the cost.
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
visibility?Computable<boolean | Visible | None>Pass-through to visibility.

Defined in

profectus/src/game/requirements.tsx:68


Requirement

Requirement: Object

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

See

createCostRequirement

NameTypeDescription
canMaximize?ProcessedComputable<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.
display?(amount?: DecimalSource) => ElementThe display for this specific requirement. Required if visibility can be Visibility.Visible.
partialDisplay?(amount?: DecimalSource) => ElementThe display for this specific requirement. This is used for displays multiple requirements condensed. Required if visibility can be Visibility.Visible.
pay?(amount?: DecimalSource) => voidPerform any effects to the game state that should happen when the requirement gets triggered.
requirementMetProcessedComputable<boolean | DecimalSource>Whether or not this requirement has been met.
requiresPayProcessedComputable<boolean>Whether or not this requirement will need to affect the game state when whatever is using this requirement gets triggered.
visibilityProcessedComputable<boolean | Visible | None>Whether or not this requirement should be displayed in Vue Features. displayRequirements will respect this property.

Defined in

profectus/src/game/requirements.tsx:30

Type Aliases

CostRequirement

Ƭ CostRequirement: Replace<Requirement & CostRequirementOptions, { cost: ProcessedComputable<DecimalSource> | GenericFormula ; requiresPay: ProcessedComputable<boolean> ; spendResources: ProcessedComputable<boolean> ; visibility: ProcessedComputable<Visible | None | boolean> }>

Defined in

profectus/src/game/requirements.tsx:97


Requirements

Ƭ Requirements: Requirement | Requirement[]

Utility type for accepting 1 or more Requirements.

Defined in

profectus/src/game/requirements.tsx:65

Functions

createBooleanRequirement

createBooleanRequirement(requirement, display?): Requirement

Creates a requirement based on a true/false value

Parameters
NameTypeDescription
requirementComputable<boolean>The boolean requirement to use
display?CoercableComponentHow to display this requirement to the user
Returns

Requirement

Defined in

profectus/src/game/requirements.tsx:206


createCostRequirement

createCostRequirement<T>(optionsFunc): CostRequirement

Lazily creates a requirement with the given options, that is based on meeting an amount of a resource.

Type parameters
NameType
Textends CostRequirementOptions
Parameters
NameTypeDescription
optionsFuncOptionsFunc<T>Cost requirement options.
Returns

CostRequirement

Defined in

profectus/src/game/requirements.tsx:111


createVisibilityRequirement

createVisibilityRequirement(feature): Requirement

Utility function for creating a requirement that a specified vue feature is visible

Parameters
NameTypeDescription
featureObjectThe feature to check the visibility of
feature.visibilityProcessedComputable<boolean | Visibility>-
Returns

Requirement

Defined in

profectus/src/game/requirements.tsx:191


displayRequirements

displayRequirements(requirements, amount?): Element

Utility function for display 1+ requirements compactly.

Parameters
NameTypeDefault valueDescription
requirementsRequirementsundefinedThe 1+ requirements to display
amountDecimalSource1The amount of levels earned to be displayed
Returns

Element

Defined in

profectus/src/game/requirements.tsx:253


maxRequirementsMet

maxRequirementsMet(requirements): DecimalSource

Calculates the maximum number of levels that could be acquired with the current requirement states. True/false requirements will be counted as Infinity or 0.

Parameters
NameTypeDescription
requirementsRequirementsThe 1+ requirements to check
Returns

DecimalSource

Defined in

profectus/src/game/requirements.tsx:235


payByDivision

payByDivision(this, amount?): void

NameType
thisCostRequirement
amount?DecimalSource

Defined in

profectus/src/game/requirements.tsx:303


payByReset

payByReset(overrideDefaultValue?): (this: CostRequirement) => void

NameType
overrideDefaultValue?DecimalSource

Defined in

profectus/src/game/requirements.tsx:315


payRequirements

payRequirements(requirements, amount?): void

Utility function for paying the costs for 1+ requirements

Parameters
NameTypeDefault valueDescription
requirementsRequirementsundefinedThe 1+ requirements to pay
amountDecimalSource1How many levels to pay for
Returns

void

Defined in

profectus/src/game/requirements.tsx:295


requirementsMet

requirementsMet(requirements): boolean

Utility for checking if 1+ requirements are all met

Parameters
NameTypeDescription
requirementsRequirementsThe 1+ requirements to check
Returns

boolean

Defined in

profectus/src/game/requirements.tsx:223

',112),n=[o];function s(l,d,c,u,h,m){return r(),t("div",null,n)}const b=e(i,[["render",s]]);export{p as __pageData,b as default};