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('
• CostRequirementOptions: Object
An object that configures a Requirement based on a resource cost.
Name | Type | Description |
---|---|---|
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. |
pay? | (amount? : DecimalSource ) => void | Pass-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. |
resource | Resource <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. |
profectus/src/game/requirements.tsx:67
• Requirement: Object
An object that can be used to describe a requirement to perform some purchase or other action.
See
Name | Type | Description |
---|---|---|
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 ) => Element | The display for this specific requirement. Required if visibility can be Visibility.Visible. |
partialDisplay? | (amount? : DecimalSource ) => Element | The display for this specific requirement. This is used for displays multiple requirements condensed. Required if visibility can be Visibility.Visible. |
pay? | (amount? : DecimalSource ) => void | Perform any effects to the game state that should happen when the requirement gets triggered. |
requirementMet | ProcessedComputable <boolean | DecimalSource > | Whether or not this requirement has been met. |
requiresPay | ProcessedComputable <boolean > | Whether or not this requirement will need to affect the game state when whatever is using this requirement gets triggered. |
visibility | ProcessedComputable <boolean | Visible | None > | Whether or not this requirement should be displayed in Vue Features. displayRequirements will respect this property. |
profectus/src/game/requirements.tsx:29
Ƭ CostRequirement: Replace
<Requirement
& CostRequirementOptions
, { cost
: ProcessedComputable
<DecimalSource
> | GenericFormula
; requiresPay
: ProcessedComputable
<boolean
> ; spendResources
: ProcessedComputable
<boolean
> ; visibility
: ProcessedComputable
<Visible
| None
| boolean
> }>
profectus/src/game/requirements.tsx:96
Ƭ Requirements: Requirement
| Requirement
[]
Utility type for accepting 1 or more Requirements.
profectus/src/game/requirements.tsx:64
▸ createBooleanRequirement(requirement
, display?
): Requirement
Creates a requirement based on a true/false value
Name | Type | Description |
---|---|---|
requirement | Computable <boolean > | The boolean requirement to use |
display? | CoercableComponent | How to display this requirement to the user |
profectus/src/game/requirements.tsx:205
▸ createCostRequirement<T
>(optionsFunc
): CostRequirement
Lazily creates a requirement with the given options, that is based on meeting an amount of a resource.
Name | Type |
---|---|
T | extends CostRequirementOptions |
Name | Type | Description |
---|---|---|
optionsFunc | () => T | Cost requirement options. |
profectus/src/game/requirements.tsx:110
▸ createVisibilityRequirement(feature
): Requirement
Utility function for creating a requirement that a specified vue feature is visible
Name | Type | Description |
---|---|---|
feature | Object | The feature to check the visibility of |
feature.visibility | ProcessedComputable <boolean | Visibility > | - |
profectus/src/game/requirements.tsx:190
▸ displayRequirements(requirements
, amount?
): Element
Utility function for display 1+ requirements compactly.
Name | Type | Default value | Description |
---|---|---|---|
requirements | Requirements | undefined | The 1+ requirements to display |
amount | DecimalSource | 1 | The amount of levels earned to be displayed |
Element
profectus/src/game/requirements.tsx:252
▸ 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.
Name | Type | Description |
---|---|---|
requirements | Requirements | The 1+ requirements to check |
profectus/src/game/requirements.tsx:234
▸ payByDivision(this
, amount?
): void
Name | Type |
---|---|
this | CostRequirement |
amount? | DecimalSource |
profectus/src/game/requirements.tsx:302
▸ payByReset(overrideDefaultValue?
): (this
: CostRequirement
) => void
Name | Type |
---|---|
overrideDefaultValue? | DecimalSource |
profectus/src/game/requirements.tsx:314
▸ payRequirements(requirements
, amount?
): void
Utility function for paying the costs for 1+ requirements
Name | Type | Default value | Description |
---|---|---|---|
requirements | Requirements | undefined | The 1+ requirements to pay |
amount | DecimalSource | 1 | How many levels to pay for |
void
profectus/src/game/requirements.tsx:294
▸ requirementsMet(requirements
): boolean
Utility for checking if 1+ requirements are all met
Name | Type | Description |
---|---|---|
requirements | Requirements | The 1+ requirements to check |
boolean