Overview
The spell handler manages the complete lifecycle of a spell:- Initialization - Set up spell parameters and stat mapping
- Evaluation - Check if spell can be cast (cooldowns, charges, stun status)
- Execution - Process modifiers and trigger spell logic
- Channeling (Optional) - Warmup period before casting
- Casting - Execute the actual spell effect
- Cooldown - Manage cooldown and charge regeneration
Basic Usage
Core Parameters
The unique identifier for this spell. Used for cooldown tracking and charge management.
Display name shown in cooldown messages and boss bars.
Spell category or damage type. Can be a list of types separated by commas.
Cooldown duration in seconds before the spell can be cast again.
Base damage value for the spell. Scales with spell_power and can be modified by critical hits.
Whether to show cooldown messages to the player.
Warmup & Channeling
Casting time in seconds before the spell executes. During warmup, the player channels the spell.
Damage threshold for interrupting the cast. If the caster takes damage above this value during warmup, the cast is interrupted.
Metaskill executed when channeling begins.
Metaskill executed every tick during channeling. Great for visual effects and casting animations.
Metaskill executed when the spell completes casting (after warmup).
Channeling VFX
The defaultchannel-tick_fx creates a spinning triangle particle effect:
spell_cast-defaults.yml:64
Interrupt Handling
Metaskill executed when channeling is interrupted (either manually or by damage).
Metaskill executed when the cast is interrupted by taking damage above the interrupt threshold.
Metaskill executed when the player manually cancels the cast.
Charge System
Maximum number of charges. When charges > 0, the spell uses a charge system instead of simple cooldowns.
Time in seconds to regenerate one charge.
Delay in seconds before charges start regenerating after the last cast.
Number of charges regenerated per charge cooldown tick.
Cooldown Callbacks
Metaskill executed when attempting to cast while on cooldown.
Metaskill executed when the spell comes off cooldown.
Stat Mapping
Metaskill that maps spell stats and parameters. The default stat map handles damage, critical chance, cooldowns, and more.
stat_map-default) sets up these variables:
spell_power- Damage multiplier (default: 1)damage- Base damage valuecritical_chance- Crit chance (default: 0.01 = 1%)critical_damage- Crit damage bonus (default: 0 = +50%)warmup- Cast time in ticksspell_cooldown- Cooldown in tickscharge_cooldown- Charge regen time in ticksvelocity- Projectile velocity (default: 48)spread- Projectile spread (default: 0)range- Max range (default: 32)radius- AoE radius (default: 0)
Example: Frost Shard
A rapid-fire spell with charges that fires ice shards:frost_shard-spell.yml:3
Example: Burning Blast
A spell with warmup/channeling that fires after charging:burning_blast-spell.yml:2
Advanced Features
Critical Hits
Spells automatically calculate critical hits based oncritical_chance and critical_damage:
spell_handler.yml:58
Modifier Integration
The spell handler integrates with the modifier system at key points:PRE_CAST- Before spell executionCAST- After spell castCOOLDOWN_END- When cooldown expiresCOOLDOWN_RESET- When cooldown is manually reset
Cast Fatigue
The system includes a brief “cast fatigue” to prevent accidental double-casting:spell_handler.yml:160
Related Systems
- Modifier Handler - Add buffs/debuffs that modify spell behavior
- Damage Core - Handle spell damage calculations
- Knockback Core - Add knockback to spell hits