import{_ase,cast,oasi,Nasr}from"./chunks/framework.0799945b.js";constq=JSON.parse('{"title":"Requirements","description":"","frontmatter":{},"headers":[],"relativePath":"guide/important-concepts/requirements.md","lastUpdated":1681454585000}'),a={name:"guide/important-concepts/requirements.md"},n=r('<h1 id="requirements" tabindex="-1">Requirements <a class="header-anchor" href="#requirements" aria-label="Permalink to "Requirements""></a></h1><p>The requirements system in Profectus is designed to handle various conditions that must be met before certain actions or features can be accessed by the player. These conditions can include resource amounts, completed challenges, or other milestones within the game.</p><h2 id="creating-requirements" tabindex="-1">Creating Requirements <a class="header-anchor" href="#creating-requirements" aria-label="Permalink to "Creating Requirements""></a></h2><p>To create a requirement, you can use one of the provided utility functions like <a href="/api/modules/game/requirements#createcostrequirement">createCostRequirement</a>, <a href="/api/modules/game/requirements#createvisibilityrequirement">createVisibilityRequirement</a>, or <a href="/api/modules/game/requirements#createbooleanrequirement">createBooleanRequirement</a>. These functions return a <code>Requirement</code> object with specific properties that define the requirement conditions.</p><h2 id="using-requirements" tabindex="-1">Using Requirements <a class="header-anchor" href="#using-requirements" aria-label="Permalink to "Using Requirements""></a></h2><p>Several features will have a <code>requirements</code> property that takes one or more requirements that must be fulfilled for a certain action to be performed with that feature.</p><p>When implementing requirements, you can use the <a href="/api/modules/game/requirements#displayrequirements">displayRequirements</a> utility. This utility is designed to give a human-readable string generated by the requirement(s) given, making it easier for players to understand the conditions needed to progress in the game. Typically features that support requirements will already use this utility internally.</p><p>You may need to "pay" requirements upon meeting their conditions and performing the associated action. This action typically involves spending resources or making other adjustments to the game state. The <a href="/api/modules/game/requirements#payrequirements">payRequirements</a> function simplifies this process by handling the payment for one or more requirements, considering the number of levels to pay for. Additionally, custom pay functions like <a href="/api/modules/game/requirements#paybydivision">payByDivision</a> and <a href="/api/modules/game/requirements#paybyreset">payByReset</a> can be passed into <code>createCostRequirement</code> for more specialized cases.</p><h2 id="multi-level-requirements" tabindex="-1">Multi-Level Requirements <a class="header-anchor" href="#multi-level-requirements" aria-label="Permalink to "Multi-Level Requirements""></a></h2><p>Requirements can have multiple "levels", which are typically used for things like multi-level challenges with scaling requirements. When checking if requirements are met, the <a href="/api/modules/game/requirements#requirementsmet">requirementsMet</a> function can be used. It accepts a single requirement or an array of requirements.</p><p>Requirements that are just on/off, such as boolean or visibility requirements, will count as infinite levels when in the same array. This allows you to combine different types of requirements in the same array and use the <a href="/api/modules/game/requirements#maxrequirementsmet">maxRequirementsMet</a> function to calculate the maximum number of levels that could be acquired with the current requirement states.</p>',11),s=[n];functiono(u,m,l,c,h,d){returni(),t("div",null,s)}constf=e(a,[["render",o]]);export{qas__pageData,fasdefault};