Date: 2014/07/07 23:51:01 UTC-07:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
"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"
}
}