The Enchant File
On this page(10)
An enchant file has a few root keys that describe the enchant: name, chance, trigger and price. One actions: list says what a proc does. This page covers the root keys. The actions
have their own pages, starting at Actions.
modules/sword/enchants/<id>.yml
display-name: '&e&lLightning' # the name in messages, menus and {enchant}
icon: LIGHTNING_ROD # checked when the file loads
description: # %sndungeons_enchant_<id>_description%
- "&7Strikes the mobs around your"
- "&7target with lightning."
max-level: 1000 # 1 to 1000000
chance: { min: 0.5, max: 5 } # percent: min at level 1, max at max-level
trigger: swing # swing or kill
cooldown-ticks: 20 # 0 to 72000, per player
mode: normal # normal, second-hand or momentum
cost: { currency: souls, starting-cost: 100, increase-cost-by: 50 }
prestige: { max-stars: 5 } # optional: overrides the global prestige
actions: # what a proc does, top to bottom
- preset: lightning-strike
with: { damage: '{damage} * (2 + {level} / 100)' }The id and the file
- The id is the file name:
lightning.ymlis the enchantlightning. - Use lowercase letters, digits and
-only, at most 56 characters, and the extension.yml. - The id is what commands, placeholders, boosters (
enchant:<id>) and menu actions use. example.ymlis never loaded as an enchant. Copy it under another name and it becomes one.- Renaming a file creates a new enchant. Players keep their levels under the old id, and get them back if you rename it back.
Root keys
| Key | Default | Range and rules |
|---|---|---|
display-name | the id | Any text with colors. Shown in messages, menus and {enchant} |
icon | ENCHANTED_BOOK | A material (NETHERITE_SWORD, any case, minecraft: allowed) or a head texture texture-<base64>. No menu shows it (the tiles have their own material), but it is still checked |
description | none | A list of lines, or one text. Read by %sndungeons_enchant_<id>_description% |
max-level | 1, with a warning | A whole number from 1 to 1000000. Plain number only, no expression |
chance | 100, with a warning | Percent, 0 to 100. One number, or { min, max } (see below) |
trigger | swing | swing or kill (see below) |
cooldown-ticks | 0 | A whole number from 0 to 72000 (20 ticks = 1 second), per player |
mode | normal | normal, second-hand or momentum (see below) |
cost | unbuyable | The price of each level (see below) |
prestige | the global one | Optional overrides of the prestige rules (see below) |
actions | none | The list of actions a proc runs. See Actions |
A key that is not listed here is ignored. Root keys take plain numbers only: no expressions, no variables.
chance
Two forms:
chance: 5 # 5% at every level
chance: { min: 1, max: 25 } # 1% at level 1, 25% at max-level, evenly in betweenThe chance at a level L is min + (max - min) x (L - 1) / (max-level - 1). With
{ min: 1, max: 25 } and max-level: 1000, level 500 rolls about 13%.
- A value below 0 or above 100 is clamped, with a warning.
- A
minabovemaxis swapped, with a warning. - The final chance of a roll is this chance, times the prestige factor, times your enchant chance boosters, capped at 100%. Those boosters are the
enchantsandenchant:<id>targets of Boosters.
A chance of 100 with a cooldown makes a reliable "every N seconds" effect: it procs on the first swing after each cooldown ends.
trigger
| Value | When it rolls |
|---|---|
swing | Every automatic swing of the sword on a zone mob, the killing one too |
kill | Only a swing that killed its target |
On each swing the swing enchants roll first, by id, then the kill enchants when the swing
killed. An enchant's own hits never count as swings, so they never trigger anything.
cooldown-ticks
The ticks after a proc before this enchant can proc again for that player. A quit or a
/dungeons reload forgets every cooldown. Players see it through
%sndungeons_enchant_<id>_cooldown% and _cooldown_left.
mode
| Value | What the enchant is |
|---|---|
normal | Its actions run when it procs. Almost every enchant |
second-hand | A copy of your sword floats beside you in the zone and dashes through mobs when it procs. See Second Hand |
momentum | It builds a value while you keep fighting, with boosters that follow it. See Momentum |
An unknown value is a warning and reads as normal.
cost
What one level costs in the enchants menu. The price of going from level L to L + 1 (L
starts at 0, so the first level costs starting-cost):
is-exponential | Price of level L to L + 1 |
|---|---|
false (default) | starting-cost + increase-cost-by x L |
true | starting-cost x exponential-growth ^ L |
| Key | Default | Rules |
|---|---|---|
currency | '' | A currency id (a file of currencies/). '' or missing = the enchant cannot be bought. An unknown id is kept, with a warning (the menu shows it as unbuyable) |
starting-cost | 100 | Above 0. A number or a text in the currency's number format: 1500, '1.5K', '2e5' |
increase-cost-by | 0 | 0 or more (the linear formula) |
exponential-growth | 1.15 | 1 or more (the exponential formula) |
is-exponential | false | true = exponential; anything else = linear |
Worked examples from the shipped files:
| Enchant | cost | Levels 1, 2, 3, 4 cost |
|---|---|---|
lightning | { currency: souls, starting-cost: 100, increase-cost-by: 50 } | 100, 150, 200, 250 souls |
greed | { currency: souls, starting-cost: 200, is-exponential: true, exponential-growth: 1.08 } | 200, 216, 233, 252 souls |
Prestige stars multiply every level price. Pricing and Prestige covers the buying flow, prestige math and balancing.
prestige
Optional. Any key you write here overrides the same key of enchants.prestige in
modules/sword/config.yml for this enchant only. A missing key keeps the global value.
prestige:
max-stars: 10 # 0 to 1000; 0 = this enchant has no prestige
cost-multiplier: 3 # every level costs x this per star
power-per-star: 0.04 # chance x (1 + power-per-star x stars)
price: # the price of the prestige itself
currency: '' # '' = free
base: 0
growth: 1 # base x growth ^ (stars before)actions
A list of actions that run in order, top to bottom, when the enchant procs. A normal enchant
without actions does nothing. A momentum enchant needs none: its boosters are the effect.
Continue with Expressions and Variables, then Positions, then Actions.
What a broken value does
The console prints one warning with the file and the key. The rule is always the same:
| What is broken | What happens |
|---|---|
| An optional value | Its default is used |
| A required value of an action | That action is skipped, the rest of the enchant loads |
| A number out of its range | It is clamped (or its default is used), with a warning |
| The whole file (bad YAML) | That enchant is skipped, every other enchant loads |