Skip to content

Support mana, stamina, and blood costs in crafting recipes - #88191

Closed
Relvl wants to merge 2 commits into
CleverRaven:masterfrom
Relvl:master
Closed

Support mana, stamina, and blood costs in crafting recipes#88191
Relvl wants to merge 2 commits into
CleverRaven:masterfrom
Relvl:master

Conversation

@Relvl

@Relvl Relvl commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Features "Allow crafting recipes to consume character resources"

Purpose of change

Allow recipes to require character resources in addition to tools and components.

This is intended for recipes and practice activities that should consume mana, stamina, or blood while progressing, such as magical crafting, strenuous training, or blood-based rituals.

Describe the solution

Adds a new optional recipe field:

"character_resources": {
  "mana": 1000,
  "stamina": 500,
  "blood": 100
}

Supported resources are mana, stamina, and blood.

Character resource costs scale linearly with batch size and are consumed gradually according to crafting progress. Before each progress increment, all required resources are checked together. If any resource cannot be consumed, the current crafting turn is rolled back in the same way as a failed tool-charge consumption.

Mana and stamina cannot be reduced below zero. Blood cannot be reduced past the threshold for critical hypovolemia.

For unattended recipe steps, the remaining character resource cost is consumed before the passive step begins, since resources cannot be drawn from the crafter while they are no longer actively working on the item.

Characters with DEBUG_HS are treated as having sufficient resources and do not consume them.

The crafting interface displays a new Character resources section below tools and components. A resource is displayed normally when the character currently has enough for the full recipe cost, and highlighted when the full amount is unavailable.

Describe alternatives you've considered

Character resources could have been represented as tool charges or pseudo-items, but that would not accurately model resources stored directly on the character and would require additional supporting items or special-case behavior.

Another option was to require the entire resource cost before crafting could begin. This would prevent recipes from using resources that regenerate during long crafts, so the implementation instead checks and consumes the required amount incrementally.

Blood costs could be expressed in milliliters rather than internal blood units. This version uses the existing internal units to avoid introducing a new conversion convention without prior agreement.

Testing

Tested recipes with separate mana, stamina, and blood costs, also together.

Verified that:

  • character resources are displayed in the crafting interface;
  • costs scale with batch size;
  • resources are consumed progressively during crafting;
  • the exact total cost is consumed by recipe completion;
  • crafting progress is rolled back when the next resource payment cannot be made;
  • no partial resource payment occurs when one of several required resources is unavailable;
  • blood consumption stops before critical hypovolemia;
  • unattended steps consume the remaining cost before beginning;
  • DEBUG_HS bypasses resource checks and consumption;
  • recipes without character_resources retain their existing behavior;
  • practice recipes can use character resource costs.

Additional context

The initial implementation intentionally supports only mana, stamina, and blood. Additional character resources can be added later when there is a concrete use case and agreed behavior for their availability and consumption.

@github-actions github-actions Bot added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Info / User Interface Game - player communication, menus, etc. labels Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

You are creating a pull request with the master branch as the head branch. This is completely fine if you plan to make contribution once or do not plan to do it often, but if you are interested in making multiple pull requests within a short span of time, this would prevent you from doing it comfortably. You may read https://docs.github.com/en/get-started/quickstart/contributing-to-projects#creating-a-branch-to-work-on for a typical workflow of contributing to a project on GitHub.

@github-actions github-actions Bot added the astyled astyled PR, label is assigned by github actions label Aug 2, 2026
@Relvl Relvl closed this Aug 2, 2026
@Relvl

Relvl commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Wrong branch sorry :0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

astyled astyled PR, label is assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Crafting / Construction / Recipes Includes: Uncrafting / Disassembling <Enhancement / Feature> New features, or enhancements on existing Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant