/tg/ Station 13 - Modules - TypesVar Details - Proc Details

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:

The spell chain:

Other procs called / may be called within the chain:

Other procs of note:

Vars

antimagic_flagsThis determines what type of antimagic is needed to block the spell. (MAGIC_RESISTANCE, MAGIC_RESISTANCE_MIND, MAGIC_RESISTANCE_HOLY) If SPELL_REQUIRES_NO_ANTIMAGIC is set in Spell requirements, The spell cannot be cast if the caster has any of the antimagic flags set.
cooldown_reduction_per_rankIf the spell uses the wizard spell rank system, the cooldown reduction per rank of the spell
invocationWhat is uttered when the user casts the spell
invocation_self_messageWhat is shown in chat when the user casts the spell, only matters for INVOCATION_EMOTE
invocation_typeWhat type of invocation the spell is. Can be "none", "whisper", "shout", "emote"
schoolThe school of magic the spell belongs to. Checked by some holy sects to punish the caster for casting things that do not align with their sect's alignment - see magic.dm in defines to learn more
smoke_amtThe amount of smoke to create on cast. This is a range, so a value of 5 will create enough smoke to cover everything within 5 steps.
smoke_typeThe typepath of the smoke to create on cast.
soundThe sound played on cast.
sparks_amtIf set to a positive number, the spell will produce sparks when casted.
spell_levelThe current spell level, if taken multiple times by a wizard
spell_max_levelThe max possible spell level
spell_requirementsFlag for certain states that the spell requires the user be in to cast.

Procs

after_castActions done after the main cast is finished. This is called after the cooldown's already begun.
before_castActions done before the actual cast is called. This is the last chance to cancel the spell from being cast.
can_cast_spellChecks if the owner of the spell can currently cast it. Does not check anything involving potential targets.
can_invokeChecks if the current OWNER of the spell is in a valid state to say the spell's invocation
castActions done as the main effect of the spell.
delevel_spellLevels the spell down a single level, down to 1.
invocationThe invocation that accompanies the spell, called from spell_feedback() before cast().
is_valid_targetCheck if the target we're casting on is a valid target. For self-casted spells, the target being checked (cast_on) is the caster.
level_spellLevels the spell up a single level, reducing the cooldown. If bypass_cap is TRUE, will level the spell up past it's set cap.
reset_spell_cooldownResets the cooldown of the spell, sending COMSIG_SPELL_CAST_RESET and allowing it to be used immediately (+ updating button icon accordingly)
spell_feedbackProvides feedback after a spell cast occurs, in the form of a cast sound and/or invocation
update_spell_nameUpdates the spell's name based on its level.

Var Details

antimagic_flags

This determines what type of antimagic is needed to block the spell. (MAGIC_RESISTANCE, MAGIC_RESISTANCE_MIND, MAGIC_RESISTANCE_HOLY) If SPELL_REQUIRES_NO_ANTIMAGIC is set in Spell requirements, The spell cannot be cast if the caster has any of the antimagic flags set.

cooldown_reduction_per_rank

If the spell uses the wizard spell rank system, the cooldown reduction per rank of the spell

invocation

What is uttered when the user casts the spell

invocation_self_message

What is shown in chat when the user casts the spell, only matters for INVOCATION_EMOTE

invocation_type

What type of invocation the spell is. Can be "none", "whisper", "shout", "emote"

school

The school of magic the spell belongs to. Checked by some holy sects to punish the caster for casting things that do not align with their sect's alignment - see magic.dm in defines to learn more

smoke_amt

The amount of smoke to create on cast. This is a range, so a value of 5 will create enough smoke to cover everything within 5 steps.

smoke_type

The typepath of the smoke to create on cast.

sound

The sound played on cast.

sparks_amt

If set to a positive number, the spell will produce sparks when casted.

spell_level

The current spell level, if taken multiple times by a wizard

spell_max_level

The max possible spell level

spell_requirements

Flag for certain states that the spell requires the user be in to cast.

Proc Details

after_cast

Actions done after the main cast is finished. This is called after the cooldown's already begun.

It can be used to apply late spell effects where order matters (for example, causing smoke after a teleport occurs in cast()) or to clean up variables or references post-cast.

before_cast

Actions done before the actual cast is called. This is the last chance to cancel the spell from being cast.

Can be used for target selection or to validate checks on the caster (cast_on).

Returns a bitflag.

can_cast_spell

Checks if the owner of the spell can currently cast it. Does not check anything involving potential targets.

can_invoke

Checks if the current OWNER of the spell is in a valid state to say the spell's invocation

cast

Actions done as the main effect of the spell.

For spells without a click intercept, [cast_on] will be the owner. For click spells, [cast_on] is whatever the owner clicked on in casting the spell.

delevel_spell

Levels the spell down a single level, down to 1.

invocation

The invocation that accompanies the spell, called from spell_feedback() before cast().

is_valid_target

Check if the target we're casting on is a valid target. For self-casted spells, the target being checked (cast_on) is the caster.

Return TRUE if cast_on is valid, FALSE otherwise

level_spell

Levels the spell up a single level, reducing the cooldown. If bypass_cap is TRUE, will level the spell up past it's set cap.

reset_spell_cooldown

Resets the cooldown of the spell, sending COMSIG_SPELL_CAST_RESET and allowing it to be used immediately (+ updating button icon accordingly)

spell_feedback

Provides feedback after a spell cast occurs, in the form of a cast sound and/or invocation

update_spell_name

Updates the spell's name based on its level.