Paste #76788: Click and attack skill sample

Date: 2020/10/22 13:55:49 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


storm_breaker:
  type: item
  material: iron_axe
  display name: Storm Breaker
  enchantments:
  - KNOCKBACK:1
  lore:
  - A replica of Thor's Storm Breaker made by a master craftsman
  skills:
    click: storm_breaker_click
    attack: storm_breaker_attack

storm_breaker_click:
  type: task
  definitions: player
  script:
  - determine cancelled passively
  - wait 1t
  - ratelimit <[player]> 1s
  - define world <[player].world>
  - define offset 4
  - inject cooldown locally
  - inject lightning locally
  - inject weather locally
  weather:
  - narrate "You called out a storm, Storm Breaker will now have amplified damage"
  - weather global storm <[world]>
  - wait 1m
  - weather sunny storm <[world]>
  lightning:
  - repeat 30:
    - define strikeLoc <[player].location.add[<location[<[offset].add[<[value]>]>,0,0].rotate_around_y[<[value]>]>].highest>
    - strike <[strikeLoc]>
    - playeffect effect:cloud at:<[strikeLoc].above[2]> quantity:30 offset:1,0,1
    - playeffect effect:end_rod at:<[strikeLoc].above[2]> quantity:30 offset:1,0,1 data:0.5
    - wait 1t
  cooldown:
  - if <[player].has_flag[cooldown.storm_breaker_click_skill]>:
    - narrate "Call of the storm is on cooldown for <[player].flag[cooldown.storm_breaker_click_skill].expiration.formatted>"
    - stop
  - flag <[player]> cooldown.storm_breaker_click_skill duration:5m

storm_breaker_attack:
  type: task
  definitions: player|entity
  script:
  - if <[player].world.has_storm> && <[player].attack_cooldown_percent> > 95:
    - playsound <[player].location> sound:ENTITY_LIGHTNING_BOLT_IMPACT pitch:3
    - adjust <[entity]> velocity:<[player].location.direction.vector.mul[5]>
    - wait 1t
    - if !<[entity].is_spawned>:
      - stop
    - repeat 10:
      - playeffect effect:cloud q:5 offset:0.5 at:<[entity].location>
      - wait 1t
    - playeffect effect:cloud q:50 offset:1 at:<[entity].location>
    - playeffect effect:end_rod q:10 offset:1 data:0.5 at:<[entity].location.below>
    - wait 5t
    - strike <[entity].location>