Enchant Creation
On this page(7)
Sword enchants are the heart of the SnDungeons fight. Each enchant is one YAML file. While a player fights their zone mobs, every enchant they have a level in can proc. A proc runs the list of actions its file describes. They range from extra damage, area hits, chains and falling blades to fighters, boosters, currency, particles, sounds and titles.
There is no Java to write. You combine 26 action types, math expressions and positions. The plugin compiles each file when it loads, so a hit never parses anything.
New here? Read this page, then follow Your First Enchant. It builds a working enchant, its menu tiles and a test in about ten minutes.
| Enchant files | modules/sword/enchants/ (one file per enchant, the file name is the id) |
| Preset files | modules/sword/presets/ (reusable action lists with params) |
| Menus | modules/sword/guis/enchants.yml, enchants-2.yml, upgrade.yml |
| Limits | enchants: block of modules/sword/config.yml |
| Full key reference | modules/sword/enchants/example.yml (never loaded as an enchant) |
| Apply changes | /dungeons reload (no restart) |
The life of a proc
Every automatic swing of the sword on a zone mob runs this pipeline, in this order:
- The swing lands. The sword hits its target with
{damage}: the sword damage times your damage boosters. - Swing enchants roll, one by one in id order. Then, when the swing killed its target, the kill enchants roll, also in id order.
- Each roll checks the level (0 = skipped), the cooldown, then the chance.
- The chance is the enchant's chance at your level, times the prestige factor, times your enchant chance boosters. It never goes above 100%.
- A won roll needs a free sequence slot (
enchants.max-sequences). It then starts the cooldown and fires the proc event. - The actions run top to bottom. A
delaypauses the list, alooprepeats part of it, and aparallelbranch runs beside it.
swing -> swing enchants roll (by id) -> kill enchants roll (by id, only on a kill)
|
level > 0 ? -> cooldown over ? -> chance x prestige x boosters (max 100%) -> roll
|
free sequence slot ? -> cooldown starts
|
actions run, top to bottom, over ticksThe hits of an enchant are never swings. They never make an enchant proc, so enchants never chain into each other by accident. The two exceptions are deliberate extra swings: the proc-enchants action and the hit of a second hand. Both are one level deep.
What a player sees
- Only the owner sees and hears the effects of their enchants, even next to other players in an isolated zone world.
- Visitors of the player's fight (
/zone visit) also see the entities, particles and sounds, following their own settings. Chat lines, action bars and titles stay the owner's. - Player settings filter the effects for the player who turns them off:
core.sounds,core.particles,core.titles,core.action-bars,sword.enchant-notificationsandsword.enchant-entitiesin/settings. Damage and rewards never change.
What an enchant is made of
A complete enchant has three parts:
| Part | Where | Needed for |
|---|---|---|
| The enchant file | modules/sword/enchants/<id>.yml | Everything: it defines the enchant |
| Its tiles in the list | modules/sword/guis/enchants.yml (or enchants-2.yml) | Players to see and click it |
| Its info tile | modules/sword/guis/upgrade.yml | The top tile of its upgrade menu |
The menus are fully declared: a new enchant file does not add itself to the menus. Without its tiles the enchant still works (an admin can give levels), but players cannot buy it. Menu Tiles has copy-ready tiles.
Who else rolls your enchants
- AFK clones roll them on each of their hits, at
clones.enchant-proc-factorof the chance (modules/afk/config.yml). See AFK Clones. - Heroes roll them at
combat.enchant-proc-factorof the chance (modules/heroes/config.yml). See Heroes. - What such a proc does pays the player, but never counts for their progress. A second hand never rolls from them, and they never move a momentum run.
Hero Enchants (modules/heroes/hero-enchants/) are a different, much simpler system. Everything in
this section is about the sword enchants.
Levels, storage and files
- Players buy levels in the enchants menu (
/sword enchants, or a right click with the sword). - Admins give levels with
/dungeons admin sword enchant <player> <enchant> <levels>. - Levels are stored per player. They survive quits, restarts, reloads and even a deleted file: the level comes back with the file.
- The
enchants/andpresets/folders are owner folders. They are created with examples only while they do not exist. SnDungeons never updates them, and a file you delete stays deleted. /dungeons reloadreads both folders again. It also ends every running effect and forgets the cooldowns.
The shipped enchant pack
A new installation ships these enchants. Their numbers are a starting point: balance them freely.
| Enchant | What it does | Max level | Built with |
|---|---|---|---|
critical | Hits the mob again, harder with your level | 500 | damage, entity text |
lightning | Lightning on the mobs around the target | 1000 | preset lightning-strike |
greed | Money when a swing kills | 100 | trigger: kill, preset currency-reward |
guillotine | A giant copy of your sword falls: 12x, executes below 40% | 1000 | entity, delay, execute-below |
lucky-strike | 6x damage with a big color-changing hologram | 2500 | animated text display |
reaper | A small chance to kill the target at once | 100 | execute-below: 100 |
gravity-well | 10x to every mob within 9 blocks | 5000 | preset area-burst |
sundial | 9x to every mob of yours in the zone | 1000 | for-each-mob |
orbital-lance | A lance from the sky: 7.5x within 10 blocks | 5000 | particle line, preset area-burst |
pendulum | An axe orbits you and hits up to 4 mobs | 5000 | orbit movement, for-each-mob |
pyroclasm | An eruption: 8x within 6 blocks | 2500 | helix particle, preset area-burst |
cleave | Spreads 50% of the swing to the 3 nearest mobs | 5000 | for-each-mob |
tether | A lightning tether through 7 mobs, doubling each jump | 5000 | chain |
slime | A slime hops from mob to mob | 100 | chain, jump-to |
spinefall | 5 tridents fall, each hit lands with its trident | 2500 | loop, parallel, preset falling-blade |
sword-storm | 12 copies of your sword fall, 15x each | 5000 | loop, parallel, preset falling-blade |
infestation | Silverfish run to the mob and bite it | 1000 | entity with attack |
magma-bomb | A magma cube bounces 6 times: area damage and money | 2500 | loop, jump-to |
warband | 3 clones of you fight for 8 seconds | 5000 | npc |
bulwark | 2 iron golems fight for 15 seconds | 2500 | entity with attack |
death-blessing | Raises the rarity of up to 5 mobs | 750 | set-rarity |
effigy | The zone NPC throws 3 extra mobs | 1000 | spawn-mobs |
pinata | Money and souls, then 6x damage | 2500 | give-currency |
warden-siege | 8 wardens rise on the area border and fire sonic booms | 2500 | for-each-point, parallel |
sunder | Stacks +30% damage taken per charge, up to 3 | 1000 | debuff |
swiftness | Speed while you fight in your zone | 1000 | potion |
dice | Rolls a die: one of six timed boosters | 100 | random, presets dice-roll, dice-face |
second-hand | A copy of your sword floats beside you and dashes | 100 | mode: second-hand |
momentum | Keep swinging to build souls and damage | 1000 | mode: momentum |
This section
| Page | Read it to |
|---|---|
| Your First Enchant | Build, list and test a complete enchant step by step |
| The Enchant File | Learn every root key: chance, trigger, cooldown, cost, mode |
| Expressions and Variables | Write numbers that scale with level, damage and more |
| Positions | Aim effects at mobs, at you, at the area or along a path |
| Actions | Look up every action type and its keys |
| Presets | Reuse an action list with params |
| Second Hand | Build a floating sword that dashes through mobs |
| Momentum | Build a value that grows while the player keeps fighting |
| Menu Tiles | Add the enchant to the enchants and upgrade menus |
| Pricing and Prestige | Set level prices, prestige stars and balance |
| Limits and Performance | Keep heavy enchants smooth on a busy server |
| Testing and Errors | Test a file and read its console warnings |
| Cookbook | Copy proven patterns: blade rains, chains, rings, buffs |
| AI Agent Skill | Let an AI agent write enchants for you, correctly |