Paste #68463: Untitled Paste

Date: 2020/05/02 17:54:12 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


fireblast_spell:
    type: world
    events:
        on player right clicks with chaotic_staff:
        - if !<player.has_flag[fireblast]>:
            - stop
        - if <context.item.nbt[charge]> == 0:
            - narrate "<&c>Your Chaotic Staff is out of charges!"
            - playsound ENTITY_LLAMA_SPIT <player.location> pitch:-1
            - stop
        - if <player.has_flag[magic_cooldown]>:
            - playsound ENTITY_LLAMA_SPIT <player.location> pitch:-1
            - stop
        - define particleamount <player.flag[magiclvl].mul[5]>
        - define target <player.cursor_on[<player.flag[magiclvl].add[5]>].simple.as_location>
        - define charge:<context.item.nbt[charge].sub[1]>
        - define staff:<context.item.nbt[magic]>
        - inventory adjust slot:<player.held_item_slot> nbt:charge/<[charge]>
        - inventory adjust slot:<player.held_item_slot> "display_name:<&4><italic>Chaotic Staff <&5>Charges <&e><&l>[<[charge]>]"
        - flag player magic_cooldown duration:2s
        - define burntime 4s
        - define area <[target].find.surface_blocks.within[3]>
        - define path <[target].points_between[<player.location.forward[2]>].distance[1]>
        - playeffect flame <player.location> visibility:100 quantity:<[particleamount]>
        - playeffect redstone <player.location> special_data:1|blue visibility:1000 quantity:<[particleamount]>
        - foreach <[path].reverse>:
            - wait 1t
            - define projectile <[value].find.entities.within[1]>
            - playsound ENTITY_ILLUSIONER_CAST_SPELL <player.location> pitch:-3
            - playeffect redstone <[value].simple.as_location> special_data:1|orange visibility:1000 quantity:<[particleamount]>
            - playeffect redstone <[value].simple.as_location> special_data:1|red visibility:250 quantity:<[particleamount]>
        #if direct hit +4 xp and +20% damage
            - if !<[projectile].is_empty>:
                - narrate "<&a>Direct hit!"
                - define entities <[value].find.entities.within[3]>
                - playeffect flame <[value]> visibility:100 quantity:<[particleamount]> offset:1
                - define xp 2
                - foreach <[entities]>:
                    - if <[value].is_monster>:
                        - define xp:+:9
                    - if <[value].is_player> && <[value]> != <player>:
                        - define xp:+:14
                - flag player magicxp:+:<[xp]>
                - actionbar "<&a><&l>+<[xp]> Magic XP"
                - if <player.flag[magicxp]> >= <server.flag[magiclevels].get_sub_items[1].get[<player.flag[magiclvl]>]>:
                    - flag player magiclvl:+:1
                    - playsound <player.location> ENTITY_PLAYER_LEVELUP
                    - toast "Congratulations! Your Magic level is now <player.flag[magiclvl]>."
                #damage modifier
                - define percentage:<[staff].mul[<player.flag[magiclvl]>]>
                - define maxdamage:<player.flag[magiclvl].div[2].add[<[percentage]>]>
                - define damage:<util.random.decimal[0.0].to[<[maxdamage]>]>
                - define bonuspercentage:<[damage].mul[0.2]>
                - narrate "original: <[damage]> new: <[damage].add[<[bonuspercentage]>]>"
                - foreach <[entities]>:
                    - burn <[value]> duration:<[burntime]>
                    - hurt <[damage].add[<[bonuspercentage]>]> <[value]> source:<player>
                    - narrate "<&6><&l>You are set ablaze!" targets:<[value]>
                - stop
        #if not direct hit
        - define entities <[target].find.entities.within[3]>
        - playeffect flame <[target]> visibility:100 quantity:<[particleamount]> offset:1
        - define xp 2
        - foreach <[entities]>:
            - if <[value].is_monster>:
                - define xp:+:5
            - if <[value].is_player> && <[value]> != <player>:
                - define xp:+:10
        - flag player magicxp:+:<[xp]>
        - actionbar "<&a><&l>+<[xp]> Magic XP"
        - if <player.flag[magicxp]> >= <server.flag[magiclevels].get_sub_items[1].get[<player.flag[magiclvl]>]>:
            - flag player magiclvl:+:1
            - playsound <player.location> ENTITY_PLAYER_LEVELUP
            - toast "Congratulations! Your Magic level is now <player.flag[magiclvl]>."
        #damage modifier
        - define percentage:<[staff].mul[<player.flag[magiclvl]>]>
        - define maxdamage:<player.flag[magiclvl].div[2].add[<[percentage]>]>
        - define damage:<util.random.decimal[0.0].to[<[maxdamage]>]>
        - narrate "original: <[damage]>"
        - foreach <[entities]>:
            - burn <[value]> duration:<[burntime]>
            - hurt <[damage]> <[value]> source:<player>
            - narrate "<&6><&l>You are set ablaze!" targets:<[value]>