Paste #41407: Untitled Paste

Date: 2017/04/17 19:54:46 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675


BossScript: 
    Type: Assignment
    default constants:
    Actions:
        on assignment:
        - flag npc spawn:<npc.location>
        - trait state:true health
        - execute as_server "npc select <npc.id>"
        - execute as_server "trait sentinel"
        - execute as_server "sentinel respawn time 60"
        - execute as_server "sentinel attackrate 20"
        - execute as_server "sentinel speed 1"
        - execute as_server "sentinel warning <npc.name><&f>: Don't come any closer!"
        - execute as_server "sentinel greetingrange 20"
        - execute as_server "sentinel damage 5"
        - execute as_server "sentinel health 500"
        - execute as_Server "npc type spider"
        - execute as_Server "npc name"
        on death: 
        - drop i@<proc:Determineloot>|i@spider_eye[quantity=1]|i@web[quantity=util.random.int[1].to[3]>] <npc.location>
        on spawn:
        - teleport <npc> spawn:<npc.flag[spawn]>
        - announce "<&4><npc.name><&f> has respawned."
        on hit on player:
        - random 3
        - chat "<npc.name><&f>: Rawr I am a spider!"
        - chat "<npc.name><&f>: I am going to get you!"
        - chat "<npc.name><&f>: Bring it!"
Determineloot:
    type: procedure
    script:
    - random 25
    - determine "Trusty Diamond Axe"
    - determine "Trusty Diamond Sword"
    - determine "Trusty Diamond Hoe"
    - determine "Trusty Diamond Spade"
    - determine "Durable Diamond Helmet"
    - determine "Thorny Diamond Chestplate"
    - determine "Diamond Sword of Looting"
    - determine "Efficient Diamond Pickaxe"
    - determine "Herder"
    - determine "MerryGoRound"
    - determine "FoolsGold"
    - determine "Doppelganger"
    - determine "PTD"
    - determine "Aquamarine"
    - determine "Karthlan Warrior Axe"
    - determine "Flamebane"
    - determine "PhaseShifter"
    - determine "Meteorite"
    - determine "Sunflare"
    - determine "Heartburn"
    - determine "Bow of Decay"
    - determine "Hammer of the Gods"
    - determine "Lifestealer"
    - determine "Bloodsucker"
    - determine "Mobcorn" 

"Trusty Diamond Axe":
   type: item
   material: diamond_axe
   display name: "Trusty Diamond Axe"
   lore:
   - A trusty diamond axe.
   - Common Item
   enchantments:
   - durability:1
   - damage_all:1

"Trusty Diamond Sword":
   type: item
   material: diamond_sword
   display name: "Trusty Diamond Sword"
   lore:
   - A trusty diamond sword.
   - Common Item
   enchantments:
   - durability:1
   - damage_all:1

"Trusty Diamond Hoe":
   type: item
   material: diamond_hoe
   display name: "Trusty Diamond Hoe"
   lore:
   - A trusty diamond hoe.
   - Common Item
   enchantments:
   - durability:1

"Trusty Diamond Spade":
   type: item
   material: diamond_spade
   display name: "Trusty Diamond Spade"
   lore:
   - A trusty diamond spade.
   - Common Item
   enchantments:
   - durability:1

"Durable Diamond Helmet":
   type: item
   material: diamond_helmet
   display name: "Durable Diamond Helmet"
   lore:
   - A durable diamond helmet.
   - Common Item
   enchantments:
   - durability:1

"Thorny Diamond Chestplate":
   type: item
   material: diamond_chestplate
   display name: "Thorny Diamond Chestplate"
   lore:
   - A thorny diamond chestplate.
   - Common Item
   enchantments:
   - durability:2
   - thorns:1

"Diamond Sword of Looting":
   type: item
   material: diamond_sword
   display name: "Diamond Sword of Looting"
   lore:
   - Increased loot drops with this diamond
   - sword.
   - Common Item
   enchantments:
   - loot_bonus_mobs:1
   - durability:2

"Efficient Diamond Pickaxe":
   type: item
   material: diamond_pickaxe
   display name: "Efficient Diamond Pickaxe"
   lore:
   - A fast and durable pickaxe.
   enchantments:
   - durability:2
   - dig_speed:5

#-------------------------------- Uncommon Items -------------------------------#

"MerryGoRound":
   type: item
   material: bow
   display name: "MerryGoRound"
   lore:
   - A twisted circus owner forged this to
   - use on his 'less willing' performers.
   - Uncommon Item
   enchantments:
   - durability:3

"PhaseShifter":
   type: item
   material: diamond_sword
   display name: "PhaseShifter"
   lore:
   - Now you see me.. now you don't.
   - Uncommon Item
   enchantments:
   - durability:3

"Herder":
   type: item
   material: diamond_hoe
   display name: "Herder"
   lore:
   - Capture up to 3 friendly mobs inside
   - this magical hoe.
   - Uncommon Item
   enchantments:
   - durability:3

"FoolsGold":
   type: item
   material: gold_nugget
   display name: "Fool's Gold"
   lore:
   - Lure your victims with Fool's Gold
   - and strike them from behind!
   - Uncommon Item

"Doppelganger":
   type: item
   material: feather
   display name: "Doppelganger"
   lore:
   - Doppelganger is a paranormal double
   - of a living enity.
   - Uncommon Item

"PTD":
   type: item
   material: diamond_sword
   display name: "PTD"
   lore:
   - Personal Teleportation Device v0.3
   - Uncommon Item

#--------------------------------- Rare Items --------------------------------#

"Flamebane":
   type: item
   material: diamond_chestplate
   display name: "Flamebane"
   lore:
   - Forged in the fires of Mount Regaros
   - for workers to survive extreme mining
   - conditions.
   - Rare Item
   enchantments:
   - protection_explosions:4
   - protection_fire:4
   - protection_environmental:4

"Aquamarine":
   type: item
   material: diamond_helmet
   display name: "Aquamarine"
   lore:
   - Created by the Great Engineers of Karthlan
   - to allow working and mining underwater.
   - Rare Item
   enchantments:
   - water_worker:1
   - oxygen:3
   - durability:3

"Karthlan Warrior Axe":
   type: item
   material: diamond_axe
   display name: "Karthlan Warrior Axe"
   lore:
   - A super durable 2000 year old axe from the
   - destroyed Karthlan dynasty.
   - Rare Item
   enchantments:
   - knockback:2
   - damage_all:5
   - durability:3

#--------------------------------- Epic Items --------------------------------#

"Meteorite":
   type: item
   material: stick
   display name: "Meteorite"
   lore:
   - Same as dodgeball, but with flaming
   - hot, explosive magma.
   - Epic Item
   enchantments:
   - durability:3

"Sunflare":
   type: item
   material: diamond_sword
   display name: "Sunflare"
   lore:
   - A forgotten elementalist imbued this sword with
   - the power of the sun to set its victims on fire.
   - Epic Item
   enchantments:
   - fire_espect:2
   - damage_all:5
   - durability:3

"Heartburn":
   type: item
   material: bow
   display name: "Heartburn"
   lore:
   - Coated arrow tips set alight even
   - with the slightest wind friction.
   - Epic Item
   enchantments:
   - arrow_fire:2
   - damage_all:5
   - durability:3

#----------------------------- Legendary Items -----------------------------#

"Bow of Decay":
   type: item
   material: bow
   display name: "Bow of Decay"
   lore:
   - A legion of tormented souls imprisoned in this bow fills 
   - each arrow with a millenia of despair and insanity.
   - Legendary Item
   enchantments:
   - durability:3

"Hammer of the Gods":
   type: item
   material: diamond_axe
   display name: "Hammer of the Gods"
   lore:
   - Long lost where even the gods couldn't find it, yet this
   - hammer mysteriously ended up in your hands.
   - Legendary Item
   enchantments:
   - durability:3
   - damage_all:5

"Lifestealer":
   type: item
   material: diamond_sword
   display name: "Lifestealer"
   lore:
   - A sacrifice gone wrong, the sword was removed from 
   - the hands of a baby, dressed in necromancer robes.
   - Legendary Item
   enchantments:
   - durability:3
   - damage_all:5

"Mobcorn":
   type: item
   material: stick
   display name: "Mobcorn"
   lore:
   - What happens when you put a magnetron inside
   - a cow? Only one way to find out.
   - Legendary Item

"Mobcorn Time":
    type: task

    script:
    - narrate "<white><<%1%>.entity_type><red> is going to explode in..." targets:<player.location.find.players.within[10]>
    - if <%1%.is_spawned> { 
      - narrate "<red>3...." targets:<player.location.find.players.within[10]>
      - playsound location:<%1%.location> sound:fuse
      - playeffect location:<%1%.location> effect:fireworks_spark qty:10 }
      else {
        - queue clear 
        - flag player "Mobcorn Cooldown:!" }
    - wait 1
    - if <%1%.is_spawned> { 
      - narrate "<red>2...." targets:<player.location.find.players.within[10]>
      - playeffect location:<%1%.location> effect:fireworks_spark qty:10 }
      else {
        - queue clear 
        - flag player "Mobcorn Cooldown:!" }
    - wait 1 
    - if <%1%.is_spawned> { 
      - narrate "<red>1...." targets:<player.location.find.players.within[10]>
      - playeffect location:<%1%.location> effect:fireworks_spark qty:10 }
      else {
        - queue clear 
        - flag player "Mobcorn Cooldown:!" }
    - wait 1
    - if <%1%.is_spawned> {
      - explode power:2 location:<%1%.location> fire breakblocks
      - if <%1%.is_spawned> remove %1% }
      else {
        - queue clear
        - flag player "Mobcorn Cooldown:!" }


#------------------- Bloodsucker Legendary Item Section -------------------#
# This item requires its own section because it does a little more than
# the other items. Below is a script similar to the minion script above
# but a lot simpler.
#
# The primary points here are:
# 1) Create the bats
# 2) Add bats to player flag and remove them permanently on death
# 3) Remove bats if their owner or their target exits their proximity.
# 4) Remove the bat after 60 seconds regardless of what it's doing.
#
# Further down there are a couple of world events to remove the bats when
# the player dies or quits the server.
#------------------- Bloodsucker Legendary Item Section -------------------#


"Bloodsucker":
   type: item
   material: diamond_sword
   display name: "Bloodsucker"
   lore:
   - Those squeaky noises, glowing red eyes..
   - .... I hope my end is quick.
   - Legendary Item
   enchantments:
   - durability:3

"Spawn Bloodsucker Bat":
    type: task

    script:
    - playeffect location:%1% effect:LARGE_SMOKE
    - execute as_server "npc create Bloodsucker --at %1% --type bat --speed 1.3"
    - execute as_server "npc owner <player.name>"
    - execute as_server 'npc assign --set "Bloodsucker Bat"'

"Bloodsucker Bat":
  type: assignment

  actions:
    on assignment:
    - flag <npc.owner> "BloodsuckerBatList:->:<npc>"
    - trigger name:proximity toggle:true radius:15
    - trigger name:damage toggle:true
    - execute as_server "npc sel <npc.id>"
    - execute as_server "npc lookclose"
    - execute as_server "npc vulnerable"
    - execute as_server "npc health --set 1"
    - flag <npc> Exists
    - run "Bloodsucker Despawn Timer" delay:60s

    on death:
    - flag <npc.owner> "BloodsuckerBatList:<-:<npc>"
    - flag <npc> Exists:!
    - remove <npc>

  interact scripts:
  - 5 Bloodsucker Interaction

"Bloodsucker Interaction":
  type: interact

  steps:
    1:
      damage trigger:
        script:
        - playsound location:<npc.location> sound:bat_idle

      proximity trigger:
        exit:
          script:
          - ^if "<player[<npc.owner>].flag[Bloodsucker Target]>" == <player> || <player.name> == <npc.owner> {
            - flag <npc.owner> "BloodsuckerBatList:<-:<npc>"
            - remove <npc> }

"Bloodsucker Despawn Timer":
    type: task

    script:
    - if <npc.flag[Exists]> remove <npc>

#-------------------------------------------------------------------------------#
# The section below handles the world events to make all the "cool stuff"
# possible. It means that every time one of these events occur in the world, it
# will be evaluated against some criteria to see if the "cool stuff" should
# happen.
#
# For example, every time any entity (<context.entity>) in the world is damaged
# by an arrow, it checks to see if the person (<context.damager>) that fired the
# arrow is holding an item with the following two lore descriptions:
#
#   * A legion of tormented souls imprisoned in this bow fills
#   * A twisted circus owner forged this to
#
# If they are and there are no cooldowns in effect, it'll run the relevant
# (cast or rotate) commands on the entity that got hit.
#-------------------------------------------------------------------------------#

"Legendary and Epic Item Effects":
  type: world
  events:

    on entity damaged by arrow:
    - if "<player[<context.damager>].item_in_Hand.lore.contains[A legion of tormented souls imprisoned in this bow fills]>" == true {
      - cast wither duration:10 power:1 <context.entity>
      - playsound location:<context.entity.location> sound:wither_death volume:2 pitch:0.01
      - if <context.entity.is_player> && "<player[<context.entity>].flag[Hit by Bow of Decay]>" == null {
        - flag <context.entity> "Hit by Bow of Decay" duration:120s
        - narrate "<red>You feel your flesh peeling away...strange voices in your head..so much hate.." targets:<context.entity>
        }
      }

      else if "<player[<context.damager>].item_in_Hand.lore.contains[A twisted circus owner forged this to]>" == true {
      - if <context.entity.is_player> && "<player[<context.entity>].flag[Hit by MerryGoRound]>" == null {
        - flag <context.entity> "Hit by MerryGoRound" duration:5s
        - narrate "<red>The eery twisted music of a deserted, foggy circus makes you turn...round and round..." targets:<context.entity> }
      - rotate <context.entity> duration:5s
      }

    # This handles the effect on an entity getting hit directly by a player. Since it knows
    # who the player is, you can just use <player...> rather than <context.damager>. Which
    # makes it a bit easier to flag the player etc.
    #
    # It compares 3 different weapons, using the "lore" as the method, in this case, to
    # identify which weapon was used.
    on entity damaged by player:
    - if "<player.item_in_Hand.lore.contains[Long lost where even the gods couldn't find it, yet this]>" {
      - if <context.entity.is_player> && "<player.flag[Hit by Hammer of the Gods]>" == null {
        - flag <player> "Hit by Hammer of the Gods" duration:120s
        - narrate "<red>The gods curse you... your end is near..." targets:<context.entity> }
      - strike destination:<context.entity.location> }

      else if "<player.item_in_Hand.lore.contains[A sacrifice gone wrong, the sword was removed from]>" {
        - playsound location:<context.entity.location> sound:enderdragon_growl volume:0.2 pitch:0.01
        - heal <context.damager> 1
        - hurt <context.entity> 1
      }

      else if "<player.item_in_Hand.lore.contains[Those squeaky noises, glowing red eyes..]>" {
        - if "<player.flag[Bloodsucker Cooldown]>" == null && "<player.flag[BloodsuckerBatList].size>" == 0 && <context.entity> !contains <player.flag[BloodsuckerBatList].aslist> {
          - flag <player> "Bloodsucker Cooldown" duration:10s
          - flag <player> "Bloodsucker Target:<context.entity>"
          - foreach <cu@<context.entity.location.add[-2,0,-2].simple>|<context.entity.location.add[2,1,2].simple>.get_spawnable_blocks.random[3]> {
            - run instantly "Spawn Bloodsucker Bat" context:%value% }
          - foreach <player.flag[BloodsuckerBatList].aslist> {
            - attack %value% target:<context.entity> }
          }

          else if <player.flag[BloodsuckerBatList].size> >= 1 && <context.entity> contains <player.flag[BloodsuckerBatList].aslist> {
            - flag <player> "Bloodsucker Target:<context.entity>"
            - foreach <player.flag[BloodsuckerBatList].aslist> {
              - playeffect location:<cu@<context.entity.location.add[-2,0,-2].simple>|<context.entity.location.add[2,2,2].simple>.get_spawnable_blocks.random> effect:large_smoke
              - teleport %value% location:<cu@<context.entity.location.add[-2,-1,-2].simple>|<context.entity.location.add[2,1,2].simple>.get_spawnable_blocks.random> }
            - foreach <player.flag[BloodsuckerBatList].aslist> {
              - attack %value% target:<context.entity> }
          }
      }

      else if "<player.item_in_Hand.lore.contains[Personal Teleportation Device v0.3]>" determine cancelled

    on player right clicks with i@PTD:
    - if "<player.flag[PTD Locations]>" != null {
      - playsound location:<player.location> sound:enderman_teleport
      - playeffect location:<player.location> effect:large_smoke
      - narrate "<red>Teleporting to Saved Location [<yellow><player.flag[PTD Locations].size><red>]<&co><white> <player.flag[PTD Locations].get[<player.flag[PTD Locations].size>]>"
      - teleport <player> "location:<player.flag[PTD Locations].get[<player.flag[PTD Locations].size>]>"
      - flag <player> "PTD Locations[<player.flag[PTD Locations].size>]:<-"
      - playsound location:<player.location> sound:enderman_teleport
      - playeffect location:<player.location> effect:large_smoke }

      else narrate "<red>You have no coordinates loaded in your PTD..."

    on player left clicks block with i@PTD:
    - if "<player.flag[PTD Locations]>" == null {
      - flag <player> "PTD Locations:<player.location.cursor_on.add[0,1,0].simple>"
      - narrate "<red>Saved Location [<yellow><player.flag[PTD Locations].size>/3<red>]<&co><white> <player.flag[PTD Locations].get[<player.flag[PTD Locations].size>]>" }

      else if "<player.flag[PTD locations].size>" = 1 {
        - flag <player> "PTD Locations:->:<player.location.cursor_on.add[0,1,0].simple>"
        - narrate "<red>Saved Location [<yellow><player.flag[PTD Locations].size>/3<red>]<&co><white> <player.flag[PTD Locations].get[<player.flag[PTD Locations].size>]>" }

      else if "<player.flag[PTD locations].size>" = 2 {
        - flag <player> "PTD Locations:->:<player.location.cursor_on.add[0,1,0].simple>"
        - narrate "<red>Saved Location [<yellow><player.flag[PTD Locations].size>/3<red>]<&co><white> <player.flag[PTD Locations].get[<player.flag[PTD Locations].size>]>" }

      else narrate "<red>Your PTD v0.3 is out of memory. You cannot store any more coordinates."

    # Here we specifically only fire this event if the player right clicks, an entity (mobs only), using the item "Herder".
    # It checks the entity type and store the value inside a player flag. It then "removes" the entity but
    # makes it seem like their soul was captured inside the Herder.
    on player right clicks entity with i@Herder:
    - if <player.flag[HerderList].size> >= 3 narrate "<red>The <white>Herder<red> is full and cannot capture any more souls..."
      else if <context.entity.is_mob> {
        - flag <player> HerderList:->:<context.entity.entity_type>
        - playeffect location:<context.entity.location> effect:witch_magic
        - remove <context.entity>
        - if <player.flag[HerderList].size> == 1 narrate "<red>You have trapped the soul of a <player.flag[HerderList].formatted>..."
          else if <player.flag[HerderList].size> >= 2 narrate "<red>You have trapped the souls of <player.flag[HerderList].formatted>.."
      }

    # In this event, it checks to see if there are any entity types in the "HerderList" player flag, if so it
    # spawns the mobs at the cursor location, using the "safe spawn" tag "get_spawnable_blocks".
    on player right clicks block with i@Herder:
    - if <player.flag[HerderList]> != null {
      - narrate "<red>Releasing <player.flag[HerderList].formatted>..."
      - foreach <player.flag[HerderList].aslist> {
        - spawn %value% location:<cu@<player.location.cursor_on.add[-1,0,-1].simple>|<player.location.cursor_on.add[1,2,1].simple>.get_spawnable_blocks.random> }
      - flag <player> "HerderList:!"
      }

    # This section also uses the "get_spawnable_blocks" tag to find an appropriate location to "showfake"
    # a few valuable blocks. They automatically despawn after 120s unless they are destroyed earlier.
    # WARNING: Will allow spawning fake blocks in protected areas.
    on player right clicks block with i@FoolsGold:
    - if "<player.flag[Fools Gold Cooldown]>" == null {
      - flag player "Fools Gold Cooldown" duration:120s
      - showfake diamond_block location:<cu@<player.location.cursor_on.add[-1,0,-1].simple>|<player.location.cursor_on.add[1,2,1].simple>.get_spawnable_blocks.random> duration:120s
      - showfake gold_block location:<cu@<player.location.cursor_on.add[-1,0,-1].simple>|<player.location.cursor_on.add[1,2,1].simple>.get_spawnable_blocks.random> duration:120s
      - showfake chest location:<cu@<player.location.cursor_on.add[-1,0,-1].simple>|<player.location.cursor_on.add[1,2,1].simple>.get_spawnable_blocks.random> duration:120s
      }
      else narrate "<white><player.flag[Fools Gold Cooldown].expiration.formatted><red> before you can use <white>Fool's Gold<red> again."

    # This item script checks to see if the entity clicked is a mob and if the cooldown expired,
    # then runs a script called "Mobcorn Time", which provides a count down timer before
    # the mob explodes!
    # WARNING: Can probably damage and set protected zones on fire!!
    on player right clicks entity with i@Mobcorn:
    - if "<player.flag[Mobcorn Cooldown]>" == null && <context.entity.is_mob> {
      - flag <player> "Mobcorn Cooldown" duration:10s
      - run "Mobcorn Time" def:<context.entity>
      }
       else if "<player.flag[Mobcorn Cooldown]>" != null narrate "<red>Please wait for Mobcorn to cooldown..."


    on player right clicks entity with i@Doppelganger:
    - if <context.entity.equipment.helmet.skin> == <player.name> narrate "<red>Entity is already your Doppelganger."
      else if <context.entity.is_mob> || <context.entity.is_player> {
        - if "<player.flag[Doppelganger Cooldown]>" == null {
          - if "<context.entity.equipment.helmet>" != null && <context.entity.is_player> {
            - give to:<context.entity.inventory> <context.entity.equipment.helmet> }
          - flag <player> "Doppelganger Cooldown" duration:30s
          - head <context.entity> skin:<player> }
      }

      else if "<player.flag[Doppelganger Cooldown]>" != null narrate "<white><player.flag[Doppelganger Cooldown].expiration.formatted><red> before you can use <white>Doppelganger<red> again."

    # Shoot fireballs in the direction of where the cursor is, they have "weight" so it gives
    # a "bullet drop" effect.
    # WARNING: Can probably damage and set protected zones on fire!!
    on player right clicks with i@Meteorite:
    - if "<player.flag[Meteorite Cooldown]>" == null {
      - flag <player> "Meteorite Cooldown" duration:3s
      - shoot e@fireball height:0.05 gravity:0.01 }

    # This script will teleport any player, where no cooldown is in effect, to a "safe" location within
    # a 20 block radius. Above or below ground.
    # WARNING: This will allow players to get into protected buildings!!
    on player right clicks with i@PhaseShifter:
    - if "<player.flag[PhaseShifter Cooldown]>" == null {
      - flag <player> "PhaseShifter Cooldown" duration:3s
      - if "<player.flag[PhaseShifter Narrate Cooldown]>" == null {
        - random {
          - narrate "<white><player.name><red> shimmer and disappears..." targets:<player.location.find.players.within[10]>
          - narrate "<white><player.name><red> teleports to a nearby location..." targets:<player.location.find.players.within[10]>
          - narrate "<white>With a puff of smoke, <white><player.name><red> teleports not too far away.." targets:<player.location.find.players.within[10]> }
        }
      - flag <player> "PhaseShifter Narrate Cooldown" duration:30s
      - playsound location:<player.location> sound:enderman_teleport
      - playeffect location:<player.location> effect:large_smoke
      - teleport <player> location:<cu@<player.location.add[-20,-10,-20].simple>|<player.location.add[20,20,20].simple>.get_spawnable_blocks.random>
      - playsound location:<player.location> sound:enderman_teleport
      - playeffect location:<player.location> effect:large_smoke }

    # This section is relevant if the boss drop uses the "playerchest" method. It controls who can
    # access the contents of the chest. If the player flag "LootChestLocation" does not match
    # the location of the chest it uses "determine cancelled" to prevent the inventory window from
    # showing up.
    on player opens chest:
    - if <global.flag[GlobalLootChestLocationList].aslist> contains <context.inventory.location> {
      - if <player.flag[LootChestLocation]> != <context.inventory.location> {
        - narrate "<red>You cannot access the contents of this chest."
        - determine cancelled }
      }

    # If the chest location is on the player flag and the global "GlobalLootChestLocation" list
    # it will despawn when it's closed.
    on player closes chest:
     - if <player.flag[LootChestLocation]> == <context.inventory.location> && <global.flag[GlobalLootChestLocationList].aslist> contains <context.inventory.location> && <context.inventory.location> != null {
       - narrate "<red>Chest has been despawned..."
       - flag <player> LootChestLocation:!
       - flag global GlobalLootChestLocationList:<-:<context.inventory.location>
       - modifyblock <context.inventory.location> air }

    # The following two events run when a player quits or dies. This is to clean up/remove
    # any bats that were spawned with the Bloodsucker item.
    on player quits:
    - if <player.flag[BloodsuckerBatList].size> >= 1 {
      - foreach <player.flag[BloodsuckerBatList].aslist> {
        - flag <player> BloodsuckerBatList:<-:%value%
        - remove %value% }
      - flag <player> BloodsuckerBatList:!
      }

    on player dies:
    - if <player.flag[BloodsuckerBatList].size> >= 1 {
      - foreach <player.flag[BloodsuckerBatList].aslist> {
        - flag <player> BloodsuckerBatList:<-:%value%
        - remove %value% }
      - flag <player> BloodsuckerBatList:!
      }