Spell

preconditionsSatisfied :: (SpellTarget) -> Boolean

This function is used to determine whether it's possible to cast the spell on the given target. Depending on the return value, the engine will continue with either startSpellcast or failSpellcast.

failSpellcast :: (SpellTarget) ->

This function is called when the preconditions are not satisfied.

startSpellcast :: (SpellTarget) ->

Called when all preconditions are satisfied and the unit is about to start casting the spell. After a certaine amount of time (cast time), it'll be followed by finishSpellcast (unless the spellcasting is canceled or interrupted).

finishSpellcast :: (SpellTarget) ->

Called when the unit has finished casting the spell. Here you would apply the spell effects to the target.

cancelSpellcast :: (SpellTarget) ->

Called when the player cancels the spellcast out of his free will. Usually no penalities will result when canceling a spellcast.

interruptSpellcast :: (SpellTarget) ->

Called when the spellcast was interrupted (by a counterspell for example). This may result in penalties.

handleEvent :: (Event) ->

Any event that is generated by the engine is passed to the spell that is being cast. The spell has a chance to react on it. For example, interrupting the spellcast if the object moves.