Paste #68833: Untitled Paste

Date: 2020/05/10 18:26:45 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


ghost_overlay:
    type: item
    mechanisms:
        custom_model_data: 700001
        nbt:
            - attacklvl/1
            - strengthlvl/1
            - defenselvl/10
            - magiclvl/13
            - hitpointslvl/8
            - rangelvl/1
    material: wooden_sword

ghost:
    type: entity
    entity_type: zombie
    age: adult
    age_lock: true
    health: <item[ghost_overlay].nbt[hitpointslvl]>

ghost_attack:
    type: world
    events:
        on ghost targets player:
        - define entityA:<player>
        - define entityB:<context.entity>

        - if !<[entityA].has_flag[<[entityB].uuid>]>:

            - flag <[entityA]> <[entityB].uuid>
            - flag <[entityB]> <[entityB].uuid>

            - while <[entityA].has_flag[<[entityB].uuid>]>:

                - if !<[entityB].has_flag[<[entityB].uuid>]>:
                    - stop

                - choose <[entityB].formatted_health>:
                    - case dying:
                        - attack <[entityB]> target:<[entityA]>
                    - default:
                        - inject locally path:ghost_magic_attack

                - wait 4s
        on player kills ghost:
        - if <player.has_flag[<context.entity.uuid>]>:
            - flag player <context.entity.uuid>:!
            - flag server <context.entity.uuid>:!
        on player dies by ghost:
        - if <player.has_flag[<context.entity.uuid>]>:
            - flag player <context.entity.uuid>:!
        on ghost dies:
        - if <context.entity.has_flag[<context.entity.uuid>]>:
            - flag <context.entity> <context.entity.uuid>:!

    ghost_magic_attack:
        - define damage:<proc[magic_damage_process].context[<[entityB]>|<[entityA]>]>
        - define target:<[entityB].location.above[6]>
        - define path1:<[entityB].location.points_between[<[target]>].distance[1]>
        - define path2:<[target].points_between[<[entityA].location>].distance[1]>
        - foreach <[path1]>:
            - wait 1t
            - playsound ENTITY_PLAYER_ATTACK_CRIT <player.location> pitch:3
            - playeffect redstone <[value]> special_data:1|gray visibility:1000 quantity:15
            - playeffect redstone <[value]> special_data:1|green visibility:1000 quantity:200
        - playsound ENTITY_GENERIC_BURN <player.location> pitch:3
        - foreach <[path2]>:
            - define projectile <[value].find.living_entities.within[1.3]>
            - playsound ENTITY_PARROT_IMITATE_GHAST <player.location> pitch:-3
            - playeffect redstone <[value]> special_data:1|black visibility:1000 quantity:100
            - playeffect redstone <[value]> special_data:1|gray visibility:250 quantity:20
            - if !<[projectile].is_empty>:
                - foreach <[projectile]>:
                    - if <[value]> == <player>:
                        - hurt <[damage]> <[entityA]>