Paste #6547: Untitled Paste

Date: 2014/07/07 23:51:01 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


"Emperium Boss":
  type: assignment
  default constants:
    anchor_name: Emperium Boss Anchor
    anchor_spawn_range: 5
    anchor_range: 30
    anchor_check_interval: 20
    health: 5000
    armor: 20
    attack_range: 20
    target_cooldown: 20
    equip_head: Emperium Helmet
    equip_chest: Emperium Chestplate
    equip_legs: Emperium Leggings
    equip_boots: Emperium Boots
    equip_hand: Emperium Axe
  actions:
    on assignment:
    - trigger name:proximity toggle:true cooldown:5 radius:20
    - trigger name:damage toggle:true cooldown:5 radius:20
    - vulnerable state:true
    - if !<server.flag[emperium_bosses].as_list> contains <npc.id> {
      - flag global emperium_bosses:->:<npc.id>
      }
    on spawn:
    - flag npc anchor_check_running:!
    - health <npc.constant[health]>
    - cast regeneration duration:86400 power:3
    - equip head:i@<npc.constant[equip_chest]>
    - equip chest:i@<npc.constant[equip_chest]>
    - equip legs:i@<npc.constant[equip_legs]>
    - equip boots:i@<npc.constant[equip_boots]>
    - equip hand:i@<npc.constant[equip_hand]>
    - define anchor <npc.anchor[<npc.constant[anchor_name]>]>
    - if <npc.location.distance[%anchor%]> > <npc.constant[anchor_spawn_range]> {
      - anchor "id:<npc.constant[anchor_name]>" assume
      }
    on enter proximity:
    - run "script:Emperium Boss Attack" "def:<player>"
    on damage:
    - run "script:Emperium Boss Attack" "def:<player>"
    on attack:
    - if !<npc.flag[anchor_check_running]> {
      - flag npc anchor_check_running:true
      - run "script:Emperium Boss Anchor Check"
      }
"Emperium Boss Attack":
  type: task
  script:
  - if <npc.flag[attack_target_time]> != null {
    - define time_passed "<math.as_int:<server.current_time_millis> - <npc.flag[attack_target_time]>>"
    - define target_cooldown "<math.as_int:<npc.constant[target_cooldown]> * 1000>"
    - if %time_passed% < %target_cooldown% queue clear
    }
  - if <%1%.is_player> {
    - if <%1%.is_op> {
      - define attack_range <npc.constant[attack_range]>
      - foreach <npc.location.find.players.within[%attack_range%].exclude[%1%]> {
        - if !<%value%.is_op> {
          - define target %value%
          - foreach stop
          }
        }
      }
      else define target %1%
    - if %target% != null {
      - flag npc attack_target:%target%
      - flag npc attack_target_time:<server.current_time_millis>
      - attack target:%target%
      }
    }
"Emperium Boss Anchor Check":
  type: task
  script:
  - if !<npc.is_spawned> {
    - flag npc anchor_check_running:!
    }
    else {
    - define anchor <npc.anchor[<npc.constant[anchor_name]>]>
    - if <npc.location.distance[%anchor%]> > <npc.constant[anchor_range]> {
      - anchor "id:<npc.constant[anchor_name]>" assume
      - flag npc anchor_check_running:!
      }
      else {
      - wait <npc.constant[anchor_check_interval]>
      - inject "script:Emperium Boss Anchor Check"
      }
    }
"Emperium Boss World":
  type: world
  events:
    on entity damaged by player:
    - if <server.flag[emperium_bosses].as_list> contains <context.entity.id> {
      - if <context.damage> < <npc.constant[armor]> playsound <context.damager> sound:anvil_land
        else {
        - hurt <context.entity> <context.damage>
        - determine "cancelled"
        }
      }