Modding:Spells
Spells
In Isleward, spells are configured in a few different places using various events: the spell info, spell config, and spell template.
As of the last edit, spells are built in server/components/spellbook.js
with addSpellFromRune(runeSpell, spellId)
which uses playerSpell
(spell template), playerSpellConfig
(spell config), and runeSpell
(from the rune item's spell
property).
The spell is built using extend which means that properties in the spell config will override the spell template and properties in the rune's spell property will override both.
Runes can also randomly roll stats which are rolled randomly and added to the built spell's values
property.
This will be added to this page eventually, but it is clear in the code.
runeSpell.properties
is also copied to the built spell.
runeSpell.cdMult
is multiplied on the built spell's cdMax
.
After that, addSpell(options, spellId)
is called, which builds a new spell using the generic spell template, the type template, and the options built in addSpellFromRune
.
It also sets the properties obj
, baseDamage
, and cd
.
Additionally, it sets up the animation, calls calcDps
on the built spell, initializes it if necessary, and updates the player's spellbook using the syncer.
Since the properties are inherited through many levels, some of the properties listed below can be defined in different places out of preference or as fallbacks when a higher level configuration doesn't set that value. As a result, the lists may be incomplete and are just a suggestion of where to put certain properties. However, some properties should be in a specific location for clarity and convention. It's best to check existing spell infos and configs and templates to get an idea of where things should be.
Spell Info
Spell info configures graphical, client-side appearance for the spell. Configurable in onBeforeGetSpellsInfo
.
Examples don't include every possible value.
Property | Type | Notes | Examples |
---|---|---|---|
name |
String | The name displayed in the ability list in the HUD. | |
description |
String | The description displayed in the ability list in the HUD. | |
type |
String | The spell template used for casting the spell. | |
spritesheet |
String | The spritesheet for the ability icon. | |
icon |
[ Integer, Integer ] | The 0-indexed position of the icon in the spritesheet. | |
animation |
String | The casting animation to use. Sometimes weird because different animations are available for the current equipped skin. | hitStaff , raiseStaff , hitSword , raiseShield , raiseHands
|
spellType |
String | buff , aura , warnBlast
| |
particles |
Object | The particles used by this spell. Check existing spells for reference. |
Spell Config
Spell config configures stats of the spell, usually for the rune. Configurable in onBeforeGetSpellsConfig
.
Property | Type | Notes | Examples |
---|---|---|---|
auto |
Boolean | Controls whether the spell can auto-attack. | |
statType |
String, Array | The stat or array of stats that influence this spell. | int , str , dex
|
statMult |
Number | Something to do with damage calculation? | |
threatMult |
Number | Affects how much threat is assigned when this spell deals damage. | Used in charge so when a tank charges in they attract more aggro |
element |
String | The element associated with this spell. Might be used with resistances? | arcane , fire , holy
|
cdMax |
Number | The cooldown between casts. | |
castTimeMax |
Number | The time it takes to cast the spell. | |
useWeaponRange |
Boolean | Whether the spell should use the range of a weapon instead. | Melee and slash both use this property |
range |
Number | ||
radius |
Number | ||
needLos |
Boolean | Whether the spell needs line of sight to the target position or object. | |
auraRange |
Number | The range to spread the aura. | |
effect |
String | The effect given by an aura. | |
manaReserve |
Object with percentage : Number |
The percentage (0 to 1) of the caster's mana to reserve for the aura. | |
random |
Object | An object with ranges that will be randomly rolled to assign stats to the rune item. i_ properties are passed to the spell object and can be used to control effects. The key of the property is the rolled stat and the value should be an array with the minimum amount and maximum amount. |
damage , change , regenPercentage , i_radius , i_duration , i_pushback .
|
negativeStats |
Object | Marks randomly rolled values as positive or negative so that a lower value is favored. | Used in crystal spikes to make lower delay considered better |
Spell Template
Spell template defines the actual effects of the spell when cast. Configurable in onBeforeGetSpellTemplate
.
The spell's init
method is called when the spell is set up.
cast
method is called when the spell finishes casting.
The source code has good examples that can be copied and edited on how to fire a projectile and process an effect when hit (look for the explode
method in magic missile or ice spear).
Property | Type | Notes | Examples |
---|---|---|---|
needLos |
Boolean | Controls whether the spell needs line of sight to the target. | |
targetFriendly |
Boolean | Controls whether the spell can target friendlies. | |
targetGround |
Boolean | Controls whether the spell targets the cursor position. | |
targetPlayerPos |
Boolean | Controls whether the spell can be cast on yourself. | Used by fireblast (which also uses target ground so wherever you cast it does the effect on you) |
isAttack |
Boolean | Controls whether the spell is a physical attack. |