Skip to content

LoopSpell

MomoPewpew edited this page Feb 16, 2024 · 15 revisions

Source Code

spell-class: ".targeted.LoopSpell"

Description:

Targeted spell. The LoopSpell allows for the caster to repeatedly cast spells at either a target, the target's location or their own location for some duration of time and a certain amount of iterations. The LoopSpell can also be used without a target or location if the targeted option is set to false.

Configuration Options:

Option Description Type Default Value
delay Defines how long, in ticks, before the loop starts. Long 0
duration Defines how long, in ticks, the loop will last. If less than or equal to 0, the loop will last indefinitely unless iterations is specified. Long 0
interval Defines how long, in ticks, the interval between casting the spells. Long 20
iterations Defines how many total iterations the loop will do. If less than or equal to 0, the loop will last indefinitely unless duration is specified. Integer 0
y-offset Vertical offset when casting at a location Double 0
targeted If true, depending on require-entity-target and point-blank, the loop will target an entity or location. If false, spells will be cast without an entity or location target. Boolean true
point-blank If true and require-entity-target, the loop will target the initial location of the caster. Boolean false
stop-on-fail If true, if a spell fails to cast, the loop will stop. Boolean false
stop-on-success If true, if all spells succeed to cast, the loop will stop. Boolean false
pass-targeting If true, the spell's can-target list will be passed down to targeted entity spells in spells when casting. Boolean true
cancel-on-death If true, dying will cancel the loop. Will always cancel if targeting a non-player entity. Boolean false
require-entity-target If true, targets an entity for the loop. Boolean false
cast-random-spell-instead If true, the loop will instead randomly cast one spell in spells each iteration. Boolean false
skip-first If true, skips loop-modifiers, variable-mods-loop, loop-target-modifiers, loop-location-modifiers and variable-mods-target-loop on the first iteration of the loop. Boolean false
skip-first-loop-modifiers If true, skip loop-modifiers on the first iteration of the loop. Uses the value of skip-first as its default. Boolean skipFirst
skip-first-variable-mods-loop If true, skip variable-mods-loop on the first iteration of the loop. Uses the value of skip-first as its default. Boolean skipFirst
skip-first-loop-target-modifiers If true, skip loop-target-modifiers on the first iteration of the loop. Uses the value of skip-first as its default. Boolean skipFirst
skip-first-loop-location-modifiers If true, skip loop-location-modifiers on the first iteration of the loop. Uses the value of skip-first as its default. Boolean skipFirst
skip-first-variable-mods-target-loop If true, skip variable-mods-target-loop on the first iteration of the loop. Uses the value of skip-first as its default. Boolean skipFirst
str-fade-self Message sent to the caster when the loop ends. String ""
str-fade-target Message sent to the target when the loop ends. String ""
spell-on-end Sub-spell casted when the loop ends. String null
spells List of sub-spells casted on each iteration of the loop. String List null
variable-mods-loop List of variable modifications performed on the caster on each iteration of the loop. Performed before loop-modifiers and loop-target-modifiers are checked. String List null
variable-mods-target-loop List of variable modifications performed on the target on each iteration of the loop. Performed before loop-modifiers and loop-target-modifiers are checked. String List null
loop-modifiers List of modifiers checked at the beginning of each iteration of the loop. Checked after variable-mods-loop and variable-mods-target-loop are performed. String List null
loop-target-modifiers List of target modifiers checked at the beginning of each iteration of the loop. Checked after variable-mods-loop and variable-mods-target-loop are performed. String List null
loop-location-modifiers List of location modifiers checked at the beginning of each iteration of the loop. Checked after variable-mods-loop and variable-mods-target-loop are performed. String List null

Example:

#Strikes targeted entity with lightning for up to 200 ticks (10 seconds)
#If the entity dies before the duration of the LoopSpell ends, the loop will cancel.
PerpetualLightning:
    spell-class: ".targeted.LoopSpell"
    delay: 10
    duration: 200
    require-entity-target: true
    cancel-on-death: true
    str-fade-self: "The foe has been slain, thus the lightning strikes cease."
    spells: 
        - lightning

Variable Example:

#Increments a variable by 1 each time a loop occurs.
#When the variable reaches its maximum value, the loop ends.
variables:
    increasingvar:
          type: player
          permanent: false
          default: 0
          min: 0
          max: 10

IncreasingVariableLoop:
    spell-class: ".targeted.LoopSpell"
    require-entity-target: false
    variable-mods-loop: 
        - increasingvar +1
    str-fade-self: "The variable has reached its maximum value of %var:increasingvar%"
    spells:
        - IncreasingVarDummy(mode=full)
    loop-modifiers:
        - variable increasingvar=10 denied

IncreasingVarDummy:
    spell-class: ".targeted.DummySpell"
    target-self: true
    str-cast-self: "The current value of the variable is %var:increasingvar%"
    helper-spell: true
Clone this wiki locally