MultiSpell - TheComputerGeek2/MagicSpells GitHub Wiki

Source Code

This spell extends its options from Instant Spell.

spell-class: ".MultiSpell"

Description:

MultiSpells can be used to combine spells to form new spells, to cast more than one spell at once, or to randomly cast one of several spells.

Configuration:

Since 4.0 Beta 13 some of these options support dynamic values through numeric or string expressions.

Option Description Type Default Supports expressions
cast-random-spell-instead If no enable-x option is used, this selects a random spell to cast. Boolean false true
enable-custom-spell-cast-chance Requires cast-random-spell-instead. If this is true, a random spell from the list is picked based on each spell's weights (spell:<weight>). For example, if two spells are listed, one with weight 3 and one with weight 1, the first will have 3 times as much chance to cast compared to the second spell. Boolean false true
enable-individual-chances Requires cast-random-spell-instead. If this is true, each spell's chance to cast is defined by the chance listed after the spell name (spell:<chance>). NOTE: This can already be achieved with the chance subspell cast argument. Boolean false true
spells A list of actions: either a sub-spell, DELAY <delay>, or a ranged variant DELAY <minDelay> <maxDelay>. If cast-random-spell-instead is set to true, spells must only contain spells, and if one of the enable-x options is set to true, a spell's chance/weight can be specified with spell:<chance/weight>. String List false

Examples:

Example 1:

With DELAY:

froghop:
    spell-class: ".MultiSpell"
    spells:
        - froghop_leap1
        - DELAY 12 #(wait 0.6 seconds)
        - froghop_leap2
        - DELAY 16 #(wait 0.8 seconds)
        - froghop_leap3

froghop_leap1:
    spell-class: ".instant.LeapSpell"
    forward-velocity: 2
    upward-velocity: 2

froghop_leap2:
    spell-class: ".instant.LeapSpell"
    forward-velocity: 4
    upward-velocity: 4

froghop_leap3:
    spell-class: ".instant.LeapSpell"
    forward-velocity: 6
    upward-velocity: 6

Example 2:

With cast-random-spell-instead:

coinflip:
    spell-class: ".MultiSpell"
    cast-random-spell-instead: true
    spells:
        - coinflip_heads(mode=full)
        - coinflip_tails(mode=full)

coinflip_heads:
    spell-class: ".instant.DummySpell"
    str-cast-self: "The coin came up heads!"

coinflip_tails:
    spell-class: ".instant.DummySpell"
    str-cast-self: "The coin came up tails!"

Example 3:

With enable-custom-spell-cast-chance:

rigged_coinflip:
    spell-class: ".MultiSpell"
    cast-random-spell-instead: true
    enable-custom-spell-cast-chance: true
    spells:
        - rigged_coinflip_heads(mode=full):1
        - rigged_coinflip_tails(mode=full):5 # 5 times as likely

rigged_coinflip_heads:
    spell-class: ".instant.DummySpell"
    str-cast-self: "The coin came up heads!"

rigged_coinflip_tails:
    spell-class: ".instant.DummySpell"
    str-cast-self: "The coin came up tails!"

Example 4:

With enable-individual-chances:

flowergarden:
    spell-class: ".MultiSpell"
    cast-random-spell-instead: true
    enable-individual-chances: true
    spells:
        # First spell will always cast.
        - flower1(mode=full):100
        # Second spell has a 75% chance to cast.
        - flower2(mode=full):75
        # Second spell has a 50% chance to cast.
        - flower3(mode=full):50

flower1:
    spell-class: ".instant.DummySpell"
    str-cast-self: "The rose bloomed!"

flower2:
    spell-class: ".instant.DummySpell"
    str-cast-self: "The violet bloomed!"

flower3:
    spell-class: ".instant.DummySpell"
    str-cast-self: "The morning glory bloomed!"
⚠️ **GitHub.com Fallback** ⚠️