Skip to content

Feature: Support mana, stamina, and blood costs in crafting recipes - #88192

Draft
Relvl wants to merge 5 commits into
CleverRaven:masterfrom
Relvl:feature/recipes-uses-character-resources
Draft

Feature: Support mana, stamina, and blood costs in crafting recipes#88192
Relvl wants to merge 5 commits into
CleverRaven:masterfrom
Relvl:feature/recipes-uses-character-resources

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 vitamins 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": 1000,
      "vitamins": [
        {
          "vitamin": "blood",
          "value": 10000,
          "//": "Stage 4 hypovolemia begins below -20000 blood units.",
          "safe_level": -20000
        }
      ]
    }

Supported resources are mana, stamina, and vitamins.

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.

Testing

Tested recipes with separate mana, stamina, and vitamins 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 (before reaching safe_level);
  • 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 vitamins. 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. astyled astyled PR, label is assigned by github actions labels Aug 2, 2026
Comment thread data/json/recipes/recipe_debug.json
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions Bot added the json-styled JSON lint passed, label assigned by github actions label Aug 2, 2026
@GuardianDll

Copy link
Copy Markdown
Member

Firstly, instead of blood, just put vitamin with a separate specification of vitamin type being consumed, this will support much more than just blood, which will be useful for mods
Secondly, and this one is not a request, but an ask you can ignore, can you add a condition of character having at least X in specific stat? there is a use case in, for example,

"//": "using brute force, so not very precise, but still relatively fast; can't make str requirement for the recipe; so assume relatively weak character tries to rip it",
, that would prefer to check character is strong enough to rip the clothes with bare arms, also again mods might benefit from it

In general, is there a reason to consume stamina specifically? training recipes already make character weary, after all

@github-actions github-actions Bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Aug 3, 2026
@Relvl

Relvl commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Firstly, instead of blood, just put vitamin with a separate specification of vitamin type being consumed, this will support much more than just blood, which will be useful for mods

Yeah, that's a good idea! I'll update that soon.

Secondly, and this one is not a request, but an ask you can ignore, can you add a condition of character having at least X in specific stat? there is a use case in, for example,

"//": "using brute force, so not very precise, but still relatively fast; can't make str requirement for the recipe; so assume relatively weak character tries to rip it",

, that would prefer to check character is strong enough to rip the clothes with bare arms, also again mods might benefit from it

That's a bit outside the scope of this feature, but I agree it would be useful. I'll make a separate PR for it.

In general, is there a reason to consume stamina specifically? training recipes already make character weary, after all

Welp. I have no answer :] Originally I only planned to support mana, but while looking through the available character resources I noticed stamina and thought, “why not?”... It didn't add much complexity to the implementation.

@Standing-Storm

Copy link
Copy Markdown
Contributor

At last, vampire-only recipes (or an easier means of doing so) for XE

@mqrause

mqrause commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Instead of using raw strings, check out the magic_energy_type enum.

@Relvl

Relvl commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@GuardianDll I replaced blood crafting costs with generic vitamin costs; please review.

@mqrause I replaces string literals with enum; please review.

Updated initial comment.

Github action bot suggestions

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@GuardianDll

Copy link
Copy Markdown
Member

Please fix the CI errors first

@Relvl

Relvl commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Yeah, I saw it, thanks. I'll fix it soon.

@Relvl
Relvl marked this pull request as draft August 3, 2026 19:32
@Relvl

Relvl commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Converted to draft: I will write a tests instead of recipe_debug.json

Comment thread src/recipe.h
#include "build_reqs.h"
#include "calendar.h"
#include "crafting_enums.h"
#include "magic_type.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include What You Use

Suggested change
#include "magic_type.h"

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 BasicBuildPassed This PR builds correctly, label 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 json-styled JSON lint passed, label assigned by github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants