Cast arguments - TheComputerGeek2/MagicSpells GitHub Wiki
Basics:
When a spell is cast by another spell, then it's called a subspell.
spells:
- subSpell
spell: subSpell
Subspells have cast arguments which control how they are cast.
subSpell(key1=value1; key2=value2)
Example:
Every sub-spell cast without specified cast arguments is cast with these default cast arguments.
subSpell(mode=partial; power=1; delay=-1; chance=-1)
Cast arguments:
mode:
fullorf- Casts like a main spell, like the first spell in a cast chain.hardorh- Same asfull, but even if the main spell casting the sub-spell had targets, the sub-spell cast inhardmode is cast without targets, looking for targets on the line of sight instead.partialorp- Default subspell cast mode. Cast without:- checking if the caster has the spell in their spellbook
- the spell's
restrict-to-worldsoption - No Magic Zones
- setting cooldown
- removing reagents
- awarding spell
experience - displaying spell
cast-time - sending the following spell messages:
str-cast-self,str-cast-target, orstr-cast-others
directord- No plugin, spell, or such is notified that the sub-spell was cast to trigger their logic otherwise. No general spell processing is done. The sub-spell'sspell-classeffect is executed directly.
targeting:
[!NOTE] Added in 4.0 Beta 13.
- The option changes how a sub-spell is cast regarding targeting an entity and/or location.
- The possible values are:
normal,entity_from_location,entity,location, andnone(without target). normalis the default value where targeting is determined automatically, with priority:entity_from_location->entity->location->none, depending on whether the targeting option applies to the spell used in the sub-spell.
invert:
[!NOTE] Added in 4.0 Beta 13. Since 4.0 Beta 17, it can be a string expression.
It can be true or false (default). When enabled, the following takes place:
- If a caster is present, it becomes an entity target.
- If an entity target is present, it becomes the caster.
- If both a caster and an entity target exist,
invert: trueswap them.
pass-args:
[!NOTE] Added in 4.0 Beta 17.
Can be true or false (default), or a string expression. When true, args from the parent spell cast are used for the sub-spell cast, instead of the value of the args sub-spell cast argument.
pass-power:
[!NOTE] Added in 4.0 Beta 13.
It can be true (default) or false. Since 4.0 Beta 17, it can be a string expression.
pass-targeting:
[!NOTE] Added in 4.0 Beta 13.
Can be true or false, or a string expression. When false, sub-spells recheck their individual can-target lists if the sub-spell cast mode is not hard (default mode is partial). This is false by default. Some spells have a pass-targeting option which when set to true override this default for their sub-spells. LoopSpell's option defaults to true. Other spells with this option are the TargetedMultiSpell and AreaEffectSpell.
args:
[!NOTE] Added in 4.0 Beta 13.
Create spell arguments passed to the sub-spell. Arguments can be fetched with the %arg placeholder. The value should be a JSON array of strings (e.g. args=[1, 2.5, "text"]). Each element may be a string expression.
power:
- Default: 1. Define with how much spell power the spell should be cast.
- Since 4.0 Beta 13 the value may be a function expression.
delay:
- Delay in server ticks after which to cast the spell.
- Since 4.0 Beta 13 the value may be a function expression.
chance:
- Chance for the spell to cast, in interval
<0, 100], where0is equivalent to100%. - Since 4.0 Beta 13 the value may be a function expression.