diff --git a/docs/guide/important-concepts/requirements.md b/docs/guide/important-concepts/requirements.md index 57cade10..dc51cc6b 100644 --- a/docs/guide/important-concepts/requirements.md +++ b/docs/guide/important-concepts/requirements.md @@ -6,6 +6,18 @@ The requirements system in Profectus is designed to handle various conditions th To create a requirement, you can use one of the provided utility functions like [createCostRequirement](/api/modules/game/requirements#createcostrequirement), [createVisibilityRequirement](/api/modules/game/requirements#createvisibilityrequirement), or [createBooleanRequirement](/api/modules/game/requirements#createbooleanrequirement). These functions return a `Requirement` object with specific properties that define the requirement conditions. +Cost requirements are probably the most common requirement you'll be using. For something with multiple levels, like repeatables, you'll typically want to use a formula for the cost instead of a function, and the input to the formula will be the repeatable's `amount` property. Typically that means the code will look like this: + +```ts +createRepeatable(repeatable => ({ + requirements: createCostRequirement(() => ({ + resource: points, + cost: Formula.variable(repeatable.amount).add(1).times(100) + })) +})); +``` +Important to note here is the parameter added to the `createRepeatable`'s options function. That is a reference to the repeatable being created, so you can access it's `amount` property in the formula. + ## Using Requirements Several features will have a `requirements` property that takes one or more requirements that must be fulfilled for a certain action to be performed with that feature.