The spell action 
This is the base action for how many of the game's spells (and spell adjacent) abilities function. These spells function off of a cooldown-based system.
Pre-spell checks:
- can_cast_spell checks if the OWNER of the spell is able to cast the spell.
- is_valid_target checks if the TARGET THE SPELL IS BEING CAST ON is a valid target for the spell. NOTE: The CAST TARGET is often THE SAME as THE OWNER OF THE SPELL, but is not always - depending on how Pre Activate is resolved.
- try_invoke is run in can_cast_spell to check if the OWNER of the spell is able to say the current invocation.
The spell chain:
- before_cast is the last chance for being able to interrupt a spell cast. This returns a bitflag. if SPELL_CANCEL_CAST is set, the spell will not continue.
- spell_feedback is called right before cast, and handles invocation and sound effects. Overridable, if you want a special method of invocation or sound effects, or you want your spell to handle invocation / sound via special means.
- cast is where the brunt of the spell effects should be done and implemented.
- after_cast is the aftermath - final effects that follow the main cast of the spell. By now, the spell cooldown has already started
Other procs called / may be called within the chain:
- invocation handles saying any vocal (or emotive) invocations the spell may have, and can be overriden or extended. Called by spell_feedback.
- reset_spell_cooldown is a way to handle reverting a spell's cooldown and making it ready again if it fails to go off at any point. Not called anywhere by default. If you want to cancel a spell in before_cast and would like the cooldown restart, call this.
Other procs of note:
- level_spell is where the process of adding a spell level is handled. this can be extended if you wish to add unique effects on level up for wizards.
- delevel_spell is where the process of removing a spell level is handled. this can be extended if you wish to undo unique effects on level up for wizards.
- get_spell_title returns the prefix of the spell name based on its level, for use in updating the button name / spell name.