Reagents
Reagents are the resources a player spends to cast a spell — mana is the canonical example. MythicRPG ships with one hardcoded reagent and lets you define any number of custom reagents, each of which can scale dynamically with the stat system.
Hardcoded Reagents
| Reagent | Aliases | Description |
|---|---|---|
health |
hp |
Costs the player health when the spell is cast (deals damage equal to the consumed amount). |
Hardcoded reagents accept an amount (alias a) argument:
Cost:
- health 5 # shorthand
- health{amount=5} # full form
Custom Reagents
Custom reagents are defined in a reagents.yml file inside any pack folder. Each top-level key becomes a reagent id (case-insensitive); you can define as many as you'd like.
Mana:
Display: 'Mana'
MinValue: 0
MaxValue: stat.MAX_MANA
Global: true
Stamina:
Display: '&aStamina'
MinValue: 0
MaxValue: 100
Global: true
Options
| Option | Description | Default |
|---|---|---|
Display |
How the reagent is displayed in messages and GUIs. Accepts legacy color codes / language keys. | |
MinValue |
Lower bound. Either a fixed number or stat.<STAT_KEY> to bind the floor to a player stat. |
0 |
MaxValue |
Upper bound. Either a fixed number or stat.<STAT_KEY> to bind the cap to a player stat. |
100 |
Global |
If true, every player has this reagent and starts with it tracked. If false, only players whose archetype/talent setup grants it will. |
false |
ResourceBarStates |
List of bar states used to render the reagent on the action bar. Optional. |
Stat-backed Min/Max
Either MinValue or MaxValue can be tied to a stat using the stat.<STAT_KEY> form. This lets the reagent's range scale with whatever modifies that stat — gear, talents, archetype level, etc.
Define the supporting stat in a stats.yml file inside any pack:
MAX_MANA:
Enabled: true
Display: 'Max Mana'
BaseValue: 1000
Formatting:
Additive: '+<value> Max Mana'
Multiply: '+<value> Max Mana'
Compound: 'x<value> Max Mana'
Then MaxValue: stat.MAX_MANA makes the reagent's cap follow the stat's resolved value.
Resource Bar States
A reagent can declare one or more bar states under ResourceBarStates:. Each state has display tokens, optional conditions for when it's shown, and optional bar styling.
Mana:
Display: 'Mana'
MinValue: 0
MaxValue: stat.MAX_MANA
Global: true
ResourceBarStates:
Default:
Display: '&b<name> &f<amount>/<max> <bar>'
BarLength: 20
BarFiller: '|'
BarSpacer: '.'
LowMana:
Display: '&c<name> &f<amount>/<max> <bar>'
BarLength: 20
Conditions:
- score{objective=combat;value=>0} true
State options
| Option | Description | Default |
|---|---|---|
Display |
The rendered string. Supports the placeholders below. | <bar> |
BarLength |
Total number of cells in the rendered <bar> / <rechargebar>. |
20 |
BarFiller |
Character used for filled cells. | = |
BarSpacer |
Character used for empty cells. | - |
Conditions |
List of Mythic conditions — the first state in declaration order whose conditions all pass is the one rendered. |
Display tokens
These tokens can appear inside Display: and are substituted at render time:
| Token | Replaced with |
|---|---|
<name> |
The reagent's display name |
<amount> |
The player's current value |
<max> |
The reagent's max value |
<percent> |
Current value as an integer percentage of max |
<bar> |
A filled bar of length BarLength, filled proportionally to <percent> |
<rechargebar> |
A bar reflecting the player's main-hand item recharge state |
Consuming Reagents
There are two ways to spend a reagent:
As a spell cost
Listed under a spell's Cost: block. The player must have at least the configured amount available; if they don't, the cast fails. On a successful cast, the amount is deducted automatically.
Fireball:
Spell: true
Trigger: ~onUse
Cost:
- mana 50
- health 5
Programmatically via mechanics
Use the modifyResource mechanic (alias modifyReagent) to add or subtract a reagent at any time. Negative amounts deduct, positive amounts grant.
Skills:
- modifyResource{resource=mana;amount=10} @self ~onTimer:20 # passive mana regen
- modifyResource{resource=mana;amount=-25} @target # drain target
Placeholders
Reagent values are exposed as %mythic_reagent_<name>% and %mythic_reagent_max_<name>%. See the Placeholders page for the full list.