 #####################
 # RUNE DRAWING v1.0 #
 #####################
 # Variables
variables:
    RuneCastingOrder:
        type: player
        default: 1
        min: 1
        max: 9
        permanent: false
    Rune1:
        type: playerstring
        permanent: false
    Rune2:
        type: playerstring
        permanent: false
    Rune3:
        type: playerstring
        permanent: false
    Rune4:
        type: playerstring
        permanent: false
    Rune5:
        type: playerstring
        permanent: false
    Rune6:
        type: playerstring
        permanent: false
    Rune7:
        type: playerstring
        permanent: false
    Rune8:
        type: playerstring
        permanent: false
    Rune9:
        type: playerstring
        permanent: false
 
 # Stylus
RuneCastingStart:
    spell-class: ".MultiSpell"
    right-click-cast-item: netherite_sword
    spells:
        - RuneCastingTargeterBuff(mode=hard)
        - DELAY 1
        - RuneCastingTargeterMultiLoop(mode=hard)
    modifiers:
        - buffactive RuneCastingTargeterBuff castinstead RuneCastingResolution(mode=hard)
RuneCastingTargeterBuff:
    spell-class: ".buff.DummySpell"
    duration: 0
    toggle: false
RuneCastingTargeterMultiLoop:
    spell-class: ".MultiSpell"
    modifiers:
        - buffactive RuneCastingTargeterBuff required
    spells:
        - RedRuneEffect(mode=hard)    
        - RuneCastingTargeter(mode=hard)    
        - DELAY 1
        - RuneCastingTargeterMultiLoop(mode=hard)     
RedRuneEffect:
    spell-class: ".instant.ParticleProjectileSpell"
    relative-offset: 3,1.6,0
    projectile-velocity: 0.001
    hit-radius: 0.2
    max-duration: 11
    change-pitch: true
    tick-interval: 1
    stop-on-hit-entity: false
    stop-on-hit-ground: false
    hit-air-after-duration: true
    spell: nonetargeted
    effects:
           1:
            position: special
            effect: particles
            particle-name: redstone
            color: ff0000
            horiz-spread: 0
            vert-spread: 0
            size: 1
            speed: 0
            count: 1
RuneCastingTargeter:
    spell-class: ".instant.ParticleProjectileSpell"
    relative-offset: 3,1.6,0
    projectile-velocity: 0.001
    hit-radius: 0.2
    max-duration: 11
    change-pitch: true
    tick-interval: 1
    stop-on-hit-entity: false
    stop-on-hit-ground: false
    hit-air-after-duration: true
    spell: nonetargeted
    modifiers:
        - buffactive RuneCastingTargeter_TempOff denied

 # Grid     
RuneCastingPulserPartProj:
    spell-class: ".instant.ParticleProjectileSpell"
    cast-item: netherite_sword
    relative-offset: 0,1,0
    projectile-velocity: 0.001
    hit-radius: 0.5
    max-duration: 0.1
    change-pitch: true
    tick-interval: 1
    stop-on-hit-entity: false
    stop-on-hit-ground: false
    hit-air-after-duration: true
    spell: nonetargeted
    spell-on-duration-end: RuneCastingPulser
    effects:
           1:
            position: special
            effect: particles
            particle-name: redstone
            color: ff0000
            horiz-spread: 0
            vert-spread: 0
            size: 1
            speed: 0
            count: 1    
RuneCastingPulser:
    spell-class: ".targeted.PulserSpell"
    range: 1
    total-pulses: 40
    interval: 5
    max-distance: 20
    block-type: air
    str-at-cap: "DEBUG: Too many Rune Casting Pulsers"
    cap-per-player: 2
    spells: 
        - RunePath1
        - RunePath2
        - RunePath3
        - RunePath4
        - RunePath5
        - RunePath6
        - RunePath7
        - RunePath8
        - RunePath9
RunePath1: &RunePathAnchor
    spell-class: ".instant.ParticleProjectileSpell"
    relative-offset: "2.5,1,-1"
    str-on-cooldown: ""
    projectile-velocity: 0.01
    projectile-gravity: 0
    projectile-spread: 0
    particle-speed: 0.01
    tick-interval: 1
    hug-surface: false
    special-effect-interval: 1
    spell-interval: 1
    max-duration: 0.3
    hit-radius: 0.2
    hit-players: false
    hit-ground: false
    stop-on-hit-entity: false
    stop-on-hit-ground: false
    change-pitch: false
    spell:
        - nonetargeted
    interactions:
        - RuneCastingTargeter FireRune1SOC(mode=hard)
    effects:
           1:
            position: special
            effect: particles
            particle-name: end_rod
            horiz-spread: 0
            vert-spread: 0
            size: 1
            speed: 0
            count: 1
RunePath2:
    <<: *RunePathAnchor
    relative-offset: "2.7,1,0"
    interactions:
        - RuneCastingTargeter FireRune2SOC(mode=hard)
RunePath3:
    <<: *RunePathAnchor
    relative-offset: "2.5,1,1"
    interactions:
        - RuneCastingTargeter FireRune3SOC(mode=hard)
RunePath4:
    <<: *RunePathAnchor
    relative-offset: "2.7,0,-1"
    interactions:
        - RuneCastingTargeter FireRune4SOC(mode=hard)
RunePath5:
    <<: *RunePathAnchor
    relative-offset: "2.9,0,0"
    interactions:
        - RuneCastingTargeter FireRune5SOC(mode=hard)
RunePath6:
    <<: *RunePathAnchor
    relative-offset: "2.7,0,1"
    interactions:
        - RuneCastingTargeter FireRune6SOC(mode=hard)
RunePath7:
    <<: *RunePathAnchor
    relative-offset: "2.5,-1,-1"
    interactions:
        - RuneCastingTargeter FireRune7SOC(mode=hard)
RunePath8:
    <<: *RunePathAnchor
    relative-offset: "2.7,-1,0"
    interactions:
        - RuneCastingTargeter FireRune8SOC(mode=hard)
RunePath9:
    <<: *RunePathAnchor
    relative-offset: "2.5,-1,1"
    interactions:
        - RuneCastingTargeter FireRune9SOC(mode=hard)
        
 # spellsOnCollision 
FireRune1SOC: &FireRuneSOCAnchor
    spell-class: ".targeted.AreaEffectSpell"
    always-granted: true
    helper-spell: true
    fail-if-no-targets: false
    horizontal-radius: 1
    vertical-radius: 1
    # str-cast-self: "Interaction Cast Success!"
    spells:
        - nonetargeted
FireRune2SOC:
    <<: *FireRuneSOCAnchor
FireRune3SOC:
    <<: *FireRuneSOCAnchor
FireRune4SOC:
    <<: *FireRuneSOCAnchor
FireRune5SOC:
    <<: *FireRuneSOCAnchor
FireRune6SOC:
    <<: *FireRuneSOCAnchor
FireRune7SOC:
    <<: *FireRuneSOCAnchor
FireRune8SOC:
    <<: *FireRuneSOCAnchor
FireRune9SOC:
    <<: *FireRuneSOCAnchor
 
 # SOC Spellcasted Passives
FireRune1Passive:
    spell-class: ".PassiveSpell"
    triggers:
        - spellcasted FireRune1SOC
    spells:
        - FireRune1(mode=hard)
FireRune2Passive:
    spell-class: ".PassiveSpell"
    triggers:
        - spellcasted FireRune2SOC
    spells:
        - FireRune2(mode=hard)
FireRune3Passive:
    spell-class: ".PassiveSpell"
    triggers:
        - spellcasted FireRune3SOC
    spells:
        - FireRune3(mode=hard)
FireRune4Passive:
    spell-class: ".PassiveSpell"
    triggers:
        - spellcasted FireRune4SOC
    spells:
        - FireRune4(mode=hard)
FireRune5Passive:
    spell-class: ".PassiveSpell"
    triggers:
        - spellcasted FireRune5SOC
    spells:
        - FireRune5(mode=hard)
FireRune6Passive:
    spell-class: ".PassiveSpell"
    triggers:
        - spellcasted FireRune6SOC
    spells:
        - FireRune6(mode=hard)
FireRune7Passive:
    spell-class: ".PassiveSpell"
    triggers:
        - spellcasted FireRune7SOC
    spells:
        - FireRune7(mode=hard)
FireRune8Passive:
    spell-class: ".PassiveSpell"
    triggers:
        - spellcasted FireRune8SOC
    spells:
        - FireRune8(mode=hard)
FireRune9Passive:
    spell-class: ".PassiveSpell"
    triggers:
        - spellcasted FireRune9SOC
    spells:
        - FireRune9(mode=hard)
        
 # Variable Modifiers
FireRune1:
    spell-class: ".instant.DummySpell"
    str-cast-self: "&bDEBUG: Position 1"
    modifiers:
        - variable RuneCastingOrder=1 string Rune1 FireRune1
        - variable RuneCastingOrder=2 string Rune2 FireRune1
        - variable RuneCastingOrder=3 string Rune3 FireRune1
        - variable RuneCastingOrder=4 string Rune4 FireRune1
        - variable RuneCastingOrder=5 string Rune5 FireRune1
        - variable RuneCastingOrder=6 string Rune6 FireRune1
        - variable RuneCastingOrder=7 string Rune7 FireRune1
        - variable RuneCastingOrder=8 string Rune8 FireRune1
        - variable RuneCastingOrder=9 string Rune9 FireRune1
FireRune2:
    spell-class: ".instant.DummySpell"
    str-cast-self: "&bDEBUG: Position 2"
    modifiers:
        - variable RuneCastingOrder=1 string Rune1 FireRune2
        - variable RuneCastingOrder=2 string Rune2 FireRune2
        - variable RuneCastingOrder=3 string Rune3 FireRune2
        - variable RuneCastingOrder=4 string Rune4 FireRune2
        - variable RuneCastingOrder=5 string Rune5 FireRune2
        - variable RuneCastingOrder=6 string Rune6 FireRune2
        - variable RuneCastingOrder=7 string Rune7 FireRune2
        - variable RuneCastingOrder=8 string Rune8 FireRune2
        - variable RuneCastingOrder=9 string Rune9 FireRune2
FireRune3:
    spell-class: ".instant.DummySpell"
    str-cast-self: "&bDEBUG: Position 3"
    modifiers:
        - variable RuneCastingOrder=1 string Rune1 FireRune3
        - variable RuneCastingOrder=2 string Rune2 FireRune3
        - variable RuneCastingOrder=3 string Rune3 FireRune3
        - variable RuneCastingOrder=4 string Rune4 FireRune3
        - variable RuneCastingOrder=5 string Rune5 FireRune3
        - variable RuneCastingOrder=6 string Rune6 FireRune3
        - variable RuneCastingOrder=7 string Rune7 FireRune3
        - variable RuneCastingOrder=8 string Rune8 FireRune3
        - variable RuneCastingOrder=9 string Rune9 FireRune3
FireRune4:
    spell-class: ".instant.DummySpell"
    str-cast-self: "&bDEBUG: Position 4"
    modifiers:
        - variable RuneCastingOrder=1 string Rune1 FireRune4
        - variable RuneCastingOrder=2 string Rune2 FireRune4
        - variable RuneCastingOrder=3 string Rune3 FireRune4
        - variable RuneCastingOrder=4 string Rune4 FireRune4
        - variable RuneCastingOrder=5 string Rune5 FireRune4
        - variable RuneCastingOrder=6 string Rune6 FireRune4
        - variable RuneCastingOrder=7 string Rune7 FireRune4
        - variable RuneCastingOrder=8 string Rune8 FireRune4
        - variable RuneCastingOrder=9 string Rune9 FireRune4
FireRune5:
    spell-class: ".instant.DummySpell"
    str-cast-self: "&bDEBUG: Position 5"
    modifiers:
        - variable RuneCastingOrder=1 string Rune1 FireRune5
        - variable RuneCastingOrder=2 string Rune2 FireRune5
        - variable RuneCastingOrder=3 string Rune3 FireRune5
        - variable RuneCastingOrder=4 string Rune4 FireRune5
        - variable RuneCastingOrder=5 string Rune5 FireRune5
        - variable RuneCastingOrder=6 string Rune6 FireRune5
        - variable RuneCastingOrder=7 string Rune7 FireRune5  
        - variable RuneCastingOrder=8 string Rune8 FireRune5
        - variable RuneCastingOrder=9 string Rune9 FireRune5  
FireRune6:
    spell-class: ".instant.DummySpell"
    str-cast-self: "&bDEBUG: Position 6"
    modifiers:
        - variable RuneCastingOrder=1 string Rune1 FireRune6
        - variable RuneCastingOrder=2 string Rune2 FireRune6
        - variable RuneCastingOrder=3 string Rune3 FireRune6
        - variable RuneCastingOrder=4 string Rune4 FireRune6
        - variable RuneCastingOrder=5 string Rune5 FireRune6
        - variable RuneCastingOrder=6 string Rune6 FireRune6
        - variable RuneCastingOrder=7 string Rune7 FireRune6  
        - variable RuneCastingOrder=8 string Rune8 FireRune6
        - variable RuneCastingOrder=9 string Rune9 FireRune6  
FireRune7:
    spell-class: ".instant.DummySpell"
    str-cast-self: "&bDEBUG: Position 7"
    modifiers:
        - variable RuneCastingOrder=1 string Rune1 FireRune7
        - variable RuneCastingOrder=2 string Rune2 FireRune7
        - variable RuneCastingOrder=3 string Rune3 FireRune7
        - variable RuneCastingOrder=4 string Rune4 FireRune7
        - variable RuneCastingOrder=5 string Rune5 FireRune7
        - variable RuneCastingOrder=6 string Rune6 FireRune7
        - variable RuneCastingOrder=7 string Rune7 FireRune7 
        - variable RuneCastingOrder=8 string Rune8 FireRune7
        - variable RuneCastingOrder=9 string Rune9 FireRune7 
FireRune8:
    spell-class: ".instant.DummySpell"
    str-cast-self: "&bDEBUG: Position 8"
    modifiers:
        - variable RuneCastingOrder=1 string Rune1 FireRune8
        - variable RuneCastingOrder=2 string Rune2 FireRune8
        - variable RuneCastingOrder=3 string Rune3 FireRune8
        - variable RuneCastingOrder=4 string Rune4 FireRune8
        - variable RuneCastingOrder=5 string Rune5 FireRune8
        - variable RuneCastingOrder=6 string Rune6 FireRune8
        - variable RuneCastingOrder=7 string Rune7 FireRune8   
        - variable RuneCastingOrder=8 string Rune8 FireRune8
        - variable RuneCastingOrder=9 string Rune9 FireRune8         
FireRune9:
    spell-class: ".instant.DummySpell"
    str-cast-self: "&bDEBUG: Position 9"
    modifiers:
        - variable RuneCastingOrder=1 string Rune1 FireRune9
        - variable RuneCastingOrder=2 string Rune2 FireRune9
        - variable RuneCastingOrder=3 string Rune3 FireRune9
        - variable RuneCastingOrder=4 string Rune4 FireRune9
        - variable RuneCastingOrder=5 string Rune5 FireRune9
        - variable RuneCastingOrder=6 string Rune6 FireRune9
        - variable RuneCastingOrder=7 string Rune7 FireRune9        
        - variable RuneCastingOrder=8 string Rune8 FireRune9
        - variable RuneCastingOrder=9 string Rune9 FireRune9          
       
 # Variable Advance
RuneVariableAdvancePassive:
    spell-class: ".PassiveSpell"
    triggers:
        - spellcasted FireRune1
        - spellcasted FireRune2
        - spellcasted FireRune3
        - spellcasted FireRune4
        - spellcasted FireRune5
        - spellcasted FireRune6
        - spellcasted FireRune7
        - spellcasted FireRune8
        - spellcasted FireRune9
    spells:
        - RuneVariableAdvanceMulti(mode=hard)
RuneVariableAdvanceMulti:
    spell-class: ".MultiSpell"
    spells:
        - RemoveRuneCastingTargeter
        - RuneCastingTargeter_TempOff
        - DELAY 1
        - RuneVariableAdvanceDummy
RuneVariableAdvanceDummy:
    spell-class: ".instant.DummySpell"
    variable-mods-cast:
        - RuneCastingOrder +1
        
 # Remove Extra Part Projs
RemoveRuneCastingTargeter:
    spell-class: ".targeted.ProjectileModifySpell"
    horizontal-radius: 10
    vertical-radius: 10
    claim-projectiles: true
    spells:
        - RuneCastingTargeter
    max-duration: 0.1

 # Turn Off Rune Casting Temporarily
RuneCastingTargeter_TempOff:
    spell-class: ".buff.DummySpell"
    duration: 0.5
    toggle: false
    
 # Spell Resolution
RuneCastingResolution:
    spell-class: ".MultiSpell"
    spells:
        - RuneCastingResolution_Cleanse(mode=hard)
        - RuneCastingResolution_Dummy(mode=hard)
        - DELAY 1
        - RuneCastingResolution_RESET(mode=hard)
        - RuneCastingResolution_Modify(mode=hard)
RuneCastingResolution_Cleanse:
    spell-class: ".targeted.CleanseSpell"
    target-self: true
    remove:
        - buff:RuneCastingTargeterBuff
RuneCastingResolution_Dummy:
    spell-class: ".instant.DummySpell"
    str-cast-self: "&bDEBUG: Invalid Rune"
    modifiers:
        - collection RuneCastingFlamebolt castinstead FlameBolt(mode=hard)
RuneCastingResolution_RESET:
    spell-class: ".instant.DummySpell"
    variable-mods-cast:
        - RuneCastingOrder =0
    modifiers:
        - chance 100 string Rune1 none
        - chance 100 string Rune2 none
        - chance 100 string Rune3 none
        - chance 100 string Rune4 none
        - chance 100 string Rune5 none
        - chance 100 string Rune6 none
        - chance 100 string Rune7 none
        - chance 100 string Rune8 none
        - chance 100 string Rune9 none
RuneCastingResolution_Modify:
    spell-class: ".targeted.ProjectileModifySpell"
    horizontal-radius: 10
    vertical-radius: 10
    claim-projectiles: true
    spells:
        - RuneCastingTargeter
        - RedRuneEffect
    max-duration: 0.1
        
 # Modifier Collections
modifiers:
    RuneCastingFlamebolt:
        checks:
            - variablestringequals Rune1:FireRune7 continue
            - variablestringequals Rune2:FireRune5 continue
            - variablestringequals Rune3:FireRune3 continue
            - variablestringequals Rune4:FireRune6 continue
            - variablestringequals Rune5:FireRune9 continue
            - variablestringequals Rune6:FireRune5 continue
            - variablestringequals Rune7:FireRune1 continue
        pass-condition: ALL

 # Final Spells        
Flamebolt:
    spell-class: ".MultiSpell"
    spells:
        - DELAY 10
        - FlameBoltBeam(mode=hard)
FlameBoltBeam:
    spell-class: ".instant.BeamSpell"
    max-distance: 18
    relative-offset: "0,1.6,0"
    hit-radius: 1
    beneficial: false
    spell: nonetargeted
    stop-on-hit-ground: true
    str-cast-self: "&bDEBUG: &cFIRE&b, &bFISH Rune"
    spell: pain5
    effects:
         1:
          position: special
          effect: particles
          particle-name: flame
          count: 5
          speed: 0.03
          horiz-spread: 0.15      
          vert-spread: 0.15
         2:
          position: special
          effect: effectlib
          effectlib:
              class: SphereEffect
              particle: REDSTONE
              iterations: 1
              radius: 0.1
              particles: 6
              period: 1
              visibleRange: 625
              color: ffb55a
         3:
          position: caster
          effect: sound
          sound: item.firecharge.use
          volume: 2
          pitch: 0.5
         4:
          position: caster
          effect: sound
          sound: item.firecharge.use
          volume: 2
          pitch: 0.8