/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
garbled_invocation_probif true, doesn't garble the invocation sometimes with backticks
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.
castActions done as the main effect of the spell.
delevel_spellLevels the spell down a single level, down to 1.
get_caster_from_targetUsed to get the cast_on atom if a self cast spell is being cast.
get_spell_titleGets the title of the spell based on its level.
invocationeven INVOCATION_NONE should go through this because the signal might change that The 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. For click_to_activate spells, the target being checked is the clicked atom.
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
try_invokeChecks if the current OWNER of the spell is in a valid state to say the spell's invocation

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

garbled_invocation_prob

if true, doesn't garble the invocation sometimes with backticks

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.

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.

get_caster_from_target

Used to get the cast_on atom if a self cast spell is being cast.

Allows for some atoms to be used as casting sources if a spell caster is located within.

get_spell_title

Gets the title of the spell based on its level.

invocation

even INVOCATION_NONE should go through this because the signal might change that 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. For click_to_activate spells, the target being checked is the clicked atom.

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

try_invoke

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