summaryrefslogblamecommitdiff
path: root/world/map/conf/magic-level2.sex
blob: 993f2a89ba2dcdf03f0e063d6236e8873e6de26c (plain) (tree)
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


















































































































































































































































































































































































































































































































































































































                                                                                                                  
                                   




                                       

                          

















































































                                                                                      
                                   




                                       

                          



















































































































































































































                                                                                                                        
                                         









































































































































































































                                                                                              

                          




























                                               

                          


























                                                 

                          


























                                              

                          





























































































































































































































































                                                                                         
"--------------------------------------------------------------------------------"
"Level 1 spells"
"--------------------------------------------------------------------------------"
(SPELL () make-arrows "#kularzufrill" ()
    (LET level 1)
    (LET school TRANSMUTE)
    (=>
        (GUARD
            (MANA 8)
            (CASTTIME 5000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (COMPONENTS "RawLog"))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL create_item "Arrow"
                (+
                    (+ 1
                        (/ spellpower 40))
                    (/
                        (random
                            (max 1
                                (- 800 spellpower)))
                        80))
                "WarpedLog"
                500)
            (CALL gain_xp 1 11))))

(SPELL () make-shirt "#patmuploo" ()
    (LET level 1)
    (LET school TRANSMUTE)
    (=>
        (GUARD
            (MANA 25)
            (CASTTIME 5000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (COMPONENTS
                (5 "CottonCloth")))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL create_item "CottonShirt" 1 "CottonCloth" 425)
            (CALL gain_xp 2 12))))

(SPELL () make-tanktop "#patloree" ()
    (LET level 1)
    (LET school TRANSMUTE)
    (=>
        (GUARD
            (MANA 25)
            (CASTTIME 5000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (COMPONENTS
                (4 "CottonCloth")))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL create_item "TankTop" 1 "CottonCloth" 350)
            (CALL gain_xp 2 13))))

(SPELL () make-short-tanktop "#patviloree" ()
    (LET level 1)
    (LET school TRANSMUTE)
    (=>
        (GUARD
            (MANA 25)
            (CASTTIME 5000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (COMPONENTS
                (3 "CottonCloth")))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL create_item "ShortTankTop" 1 "CottonCloth" 250)
            (CALL gain_xp 2 14))))

(SPELL () make-iron-powder "#zukminbirf" ()
    (LET level 1)
    (LET school TRANSMUTE)
    (=>
        (GUARD
            (MANA 8)
            (CASTTIME 5000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (COMPONENTS "IronOre"))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL create_item "IronPowder"
                (+
                    (+ 1
                        (/ spellpower 140))
                    (/
                        (random
                            (max 1
                                (- 900 spellpower)))
                        220))
                "IronOre"
                700)
            (CALL gain_xp 3 15))))

(SPELL () make-concentration-potion "#loshira" ()
    (LET level 1)
    (LET school TRANSMUTE)
    (=>
        (GUARD
            (MANA 8)
            (CASTTIME 5000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (COMPONENTS "BottleOfWater"
                (2 "CobaltHerb")
                (2 "PinkPetal")))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL create_item
                (if_then_else
                    (<
                        (random
                            (+ 2000 experience))
                        experience)
                    "ConcentrationPotion"
                    "DarkConcentrationPotion")
                1
                (if_then_else
                    (random 2)
                    "DilutedConcentrationPot"
                    "DarkConcentrationPotion")
                2000)
            (IF success
                (CALL set_var MAGIC_FLAGS 1 MFLAG_MADE_CONC_POTION_SHIFT 1))
            (CALL gain_xp 4 16))))

(SPELL () merge-concentration-potions "#skrimp" ()
    (LET level 1)
    (LET school TRANSMUTE)
    (=>
        (GUARD
            (MANA 8)
            (CASTTIME 5000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (COMPONENTS "DarkConcentrationPotion" "DilutedConcentrationPot"))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL create_item "ConcentrationPotion" 1 "DilutedConcentrationPot" 1000)
            (message caster
                (+ "success = " success))
            (IF success
                (CALL set_var MAGIC_FLAGS 1 MFLAG_MADE_CONC_POTION_SHIFT 1))
            (CALL gain_xp 4 17))))

(SPELL () lay-on-hands "#inma" (STRING target)
    (LET level 1)
    (LET school LIFE)
    (=>
        (GUARD
            (MANA 10)
            (CASTTIME 500)
            (REQUIRE
                (>
                    (hp caster)
                    (/
                        (max_hp caster)
                        20)))
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (REQUIRE
                (if_then_else
                    (failed
                        (pc target))
                    1
                    (&&
                        (&&
                            (&&
                                (!=
                                    (pc target)
                                    caster)
                                (<
                                    (rdistance
                                        (location caster)
                                        (location
                                            (pc target)))
                                    (+ 2
                                        (/
                                            (+
                                                (* 12
                                                    (sqrt spellpower))
                                                spellpower)
                                            100))))
                            (not
                                (running_status_update
                                    (pc target)
                                    SC_HALT_REGENERATE)))
                        (not
                            (is_equipped
                                (pc target)
                                "MagicGMTopHat"))))))
        (EFFECT
            (CALL adjust_spellpower school)
            (IF (not target)
                (ABORT))
            (IF (failed
                    (pc target))
                (BLOCK
                    (IF (&&
                            (||
                                (== target "mouboo")
                                (== target "Mouboo"))
                            (<
                                (rdistance
                                    (location caster)
                                    (location
                                        (npc "Mouboo")))
                                (+ 2
                                    (/ spellpower 100))))
                        (BLOCK
                            (SET needed 1000)
                            (SCRIPT "{
                                set @spell, 1;
                                callfunc \"QuestMoubooHeal\";
                            }"))
                        (ABORT)))
                (BLOCK
                    (SET target
                        (pc target))
                    (SET needed
                        (-
                            (max_hp target)
                            (hp target)))))
            (SET pay_fraction
                (max 80
                    (- 200
                        (+
                            (vit caster)
                            (/ spellpower 10))))) "Pay at least 40%"
            (SET payment
                (/
                    (* needed pay_fraction)
                    200))
            (SET available
                (-
                    (hp caster)
                    (/
                        (max_hp caster)
                        20)))
            (IF (< payment available)
                (SET power needed)
                (BLOCK
                    (SET payment available)
                    (SET power
                        (/
                            (* available 200)
                            pay_fraction))))
            (CALL gain_heal_xp power 1 1 3)
            (CALL quickheal target power)
            (SET t 5000) "with dark magic skill you pay 1/20 of max hp but the regenerate cooldown is cut in half"
            (SET school DARK)
            (SET h
                (*
                    (/
                        (max_hp caster)
                        20)
                    -1))
            (IF (>
                    (skill caster school)
                    level)
                (itemheal caster h 0))
            (IF (>
                    (skill caster school)
                    level)
                (SET t 10000))
            (status_change caster SC_HALT_REGENERATE 0 0 0 0 t)
            (CALL gain_xp
                (min 4
                    (/ payment 100))
                18))))

(SPELL () lightning-strike "#ingrav" ()
    (LET level 1)
    (LET school WAR)
    (=>
        (GUARD
            (MANA 20)
            (CASTTIME 1000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (GUARD
                (OR
                    (REQUIRE
                        (>
                            (skill caster school)
                            3))
                    (COMPONENTS "IronPowder"))))
        (EFFECT
            (CALL adjust_spellpower school)
            (SET damage spellpower)
            (SET damage_bonus
                (+ 1
                    (/ spellpower 2)))
            (CALL install_attack_spell
                (+ 1
                    (/ spellpower 90))
                3000
                8
                31)
            (CALL gain_xp 2 19)
            (ATTRIGGER
                (CALL attack_check target)
                (SET in_rain 0)
                (SET area
                    (location caster))
                (FOREACH SPELL s (rbox
                        (location caster)
                        (+ MAX_RAIN_SPELL_RADIUS 1)) (IF (==
                            (name_of s)
                            "rain")
                        (BLOCK
                            (IF (is_in
                                    (location caster)
                                    (. s area))
                                (BLOCK
                                    (SET in_rain
                                        (| in_rain 1))
                                    (SET area
                                        (+ area
                                            (. s area)))))
                            (IF (is_in
                                    (location target)
                                    (. s area))
                                (SET in_rain
                                    (| in_rain 2))))))
                (IF (& in_rain 1)
                    (BLOCK "caster standing in the rain?  This is going to be fun."
                        (SET used 0)
                        (FOREACH TARGET t area
                            (IF (>
                                    (+
                                        (random 200)
                                        (luk caster))
                                    175)
                                (BLOCK
                                    (SET used
                                        (+ used 1))
                                    (CALL elt_damage t
                                        (/ damage 6)
                                        (+ 1
                                            (/ damage_bonus 3))
                                        ELT_EARTH
                                        ELT_WIND
                                        (+ 17
                                            (random 3))))))
                        (IF (||
                                (not used)
                                (<
                                    (+
                                        (random 200)
                                        (luk caster))
                                    150))
                            (BLOCK
                                (sfx caster
                                    (+ 17
                                        (random 3))
                                    0)
                                (itemheal caster
                                    (-
                                        (- 0 damage)
                                        (random damage_bonus))
                                    0))))
                    (CALL elt_damage target damage damage_bonus ELT_EARTH ELT_WIND
                        (+ 17
                            (random 3))))))))

(SPELL (LOCAL) arrow-hail "#frillyar" ()
    (LET level 1)
    (LET school WAR)
    (=>
        (GUARD
            (MANA 25)
            (CASTTIME 5000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (REQUIRE
                (is_exterior
                    (location caster)))
            (GUARD
                (OR
                    (COMPONENTS
                        (20 "Arrow"))
                    (COMPONENTS
                        (20 "IronArrow"))))
            (GUARD
                (OR
                    (REQUIRE
                        (>
                            (skill caster school)
                            3))
                    (COMPONENTS "SulphurPowder"))))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL abort_on_area_shield
                (location caster))
            (SET range 7)
            (SET area
                (rbox
                    (awayfrom
                        (location caster)
                        (dir caster)
                        (+ 1 range))
                    range))
            (FOREACH SPELL s (rbox
                    (awayfrom
                        (location caster)
                        (dir caster)
                        (+ 1 range))
                    (* range 2)) (IF (&&
                        (!= s self_invocation)
                        (==
                            (name_of s)
                            "arrow-hail"))
                    (BLOCK
                        (message caster "A nearby arrow hail spell absorbs your magic!")
                        (ABORT))))
            (SET damage 125)
            (SET damage_bonus
                (/ spellpower 5))
            (CALL gain_xp 2 20)
            (FOR i 0
                (/ spellpower 8)
                (BLOCK
                    (FOR j 0 2
                        (BLOCK
                            (SET location
                                (random_location area))
                            (sfx location SFX_ARROW_HAIL 0)
                            (SET done 0)
                            (FOREACH TARGET target
                                (rbox location 0)
                                (BLOCK
                                    (injure caster target
                                        (+
                                            (+ damage
                                                (random damage_bonus))
                                            (random damage_bonus))
                                        0)
                                    (SET done 1)
                                    (BREAK)))
                            (IF (&&
                                    (==
                                        (location caster)
                                        location)
                                    (not done))
                                (BLOCK
                                    (itemheal caster
                                        (- 0
                                            (+
                                                (+ damage
                                                    (random damage_bonus))
                                                (random damage_bonus)))
                                        0)
                                    (sfx caster SFX_HIT 0)))))
                    (WAIT
                        (+
                            (+ 250
                                (random 50))
                            (random 50))))))))

(SPELL () magic-knuckles "#upmarmu" ()
    (LET level 1)
    (LET school WAR)
    (=>
        (GUARD
            (MANA 20)
            (CASTTIME 500)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (GUARD
                (OR
                    (REQUIRE
                        (>
                            (skill caster school)
                            3))
                    (COMPONENTS "Beer"))))
        (EFFECT
            (CALL adjust_spellpower WAR)
            (SET str
                (str caster))
            (CALL install_melee_spell
                (+ 10
                    (/ spellpower 10))
                1300
                34)
            (ATTRIGGER
                (CALL melee_damage target 30
                    (+ 5
                        (* str 2)))))))

(SPELL (LOCAL) summon-snakes "#halhiss" ()
    (LET level 1)
    (LET school DARK)
    (=>
        (GUARD
            (MANA 40)
            (CASTTIME 15000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (REQUIRE
                (>
                    (script_int caster "OrumQuest")
                    40))
            (COMPONENTS "DarkCrystal" "SnakeEgg"))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL gain_xp 3 31)
            (CALL summon_spell 1010
                (+ 1
                    (/ spellpower 300))
                (- 4000
                    (* spellpower 9))
                (* spellpower 80)
                2
                school))))

(SPELL () toxic-dart "#phlex" ()
    (LET level 1)
    (LET school DARK)
    (=>
        (GUARD
            (MANA 15)
            (CASTTIME 500)
            (REQUIRE
                (>
                    (script_int caster "OrumQuest")
                    37))
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (GUARD
                (OR
                    (REQUIRE
                        (>
                            (skill caster school)
                            2))
                    (COMPONENTS
                        (2 "Root")))))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (SET damage
                (* 5
                    (sqrt spellpower)))
            (SET damage_bonus
                (+ 5
                    (/
                        (level caster)
                        3)))
            (CALL install_attack_spell
                (+ 3
                    (/ spellpower 75))
                1200
                4
                31)
            (CALL gain_xp 3 35)
            (ATTRIGGER
                (CALL attack_check target)
                (CALL elt_damage target damage damage_bonus ELT_NEUTRAL ELT_POISON 15)
                (IF (&&
                        (is_pc target)
                        (!= caster target))
                    (status_change target SC_POISON
                        (+ 5
                            (max 15
                                (/ spellpower 15)))
                        0
                        0
                        0
                        (+ 5000
                            (* spellpower 1200))))))))

(SPELL (LOCAL) summon-wickedmushroom "#helorp" ()
    (LET level 1)
    (LET school DARK)
    (=>
        (GUARD
            (MANA 35)
            (CASTTIME 15000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (script_int caster "OrumQuest")
                    36))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (COMPONENTS "SmallMushroom" "DarkCrystal"))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL gain_xp 3 36)
            (CALL summon_spell 1106
                (+ 1
                    (/ spellpower 250))
                (- 4000
                    (* spellpower 9))
                (* spellpower 80)
                2
                school))))

(SPELL () flying-backpack "#plugh" (PC target)
    (LET level 1)
    (LET school NATURE)
    (=>
        (GUARD
            (MANA 12)
            (CASTTIME 1000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (GUARD
                (OR
                    (REQUIRE
                        (>
                            (skill caster school)
                            3))
                    (COMPONENTS "SilkCocoon")))
            (REQUIRE
                (<
                    (rdistance
                        (location target)
                        (location caster))
                    (+ 2
                        (/ spellpower 30)))))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (IF (!= caster target)
                (sfx caster 2 0))
            (status_change target SC_FLYING_BACKPACK 0 0 0 0
                (+ 5000
                    (* spellpower 500)))
            (message target "Your backpack is lifted by a mystical force; you no longer feel it pressing on your back.")
            (CALL gain_xp 1 21)
            (ATEND
                (message target "Your backpack is no longer levitating.")
                (sfx target 2 0)))))

(SPELL () protect "#betsanc" (PC target)
    (LET level 1)
    (LET school NATURE)
    (=>
        (GUARD
            (MANA 14)
            (CASTTIME 1500)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (REQUIRE
                (not
                    (is_equipped
                        (pc target)
                        "MagicGMTopHat")))
            (GUARD
                (OR
                    (REQUIRE
                        (>
                            (skill caster school)
                            3))
                    (COMPONENTS "HardSpike")))
            (REQUIRE
                (<
                    (rdistance
                        (location target)
                        (location caster))
                    (+ 2
                        (/ spellpower 30)))))
        (EFFECT
            (CALL adjust_spellpower school)
            (sfx target 11 0)
            (IF (!= caster target)
                (CALL default_effect))
            (status_change target SC_PHYS_SHIELD
                (+ 5
                    (max 15
                        (/ spellpower 20)))
                0
                0
                0
                (+ 5000
                    (* spellpower 1000)))
            (message target "You feel more protected.")
            (CALL gain_xp 2 22)
            (ATEND
                (message target "You feel less protected.")
                (sfx target 111 0)))))

(SPELL () happy-curse "#joyplim" (PC target)
    (LET level 1)
    (LET school NATURE)
    (=>
        (GUARD
            (MANA 13)
            (CASTTIME 1000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (GUARD
                (OR
                    (REQUIRE
                        (>
                            (skill caster school)
                            3))
                    (COMPONENTS "GingerBreadMan")))
            (REQUIRE
                (<
                    (rdistance
                        (location target)
                        (location caster))
                    (+ 1
                        (/ spellpower 100)))))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (IF (>
                    (skill caster DARK)
                    1)
                (FOR i 0
                    (/ spellpower 10)
                    (BLOCK
                        (emote target 5)
                        (WAIT 500)))
                (FOR i 0
                    (/ spellpower 10)
                    (BLOCK
                        (emote target 3)
                        (WAIT 500))))
            (CALL gain_xp 1 23))))

(SPELL (LOCAL) rain "#kaflosh" ()
    (LET level 1)
    (LET school NATURE)
    (=>
        (GUARD
            (MANA 17)
            (CASTTIME 3000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (REQUIRE
                (is_exterior
                    (location caster)))
            (GUARD
                (OR
                    (REQUIRE
                        (>
                            (skill caster school)
                            3))
                    (COMPONENTS "BottleOfWater"))))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL abort_on_area_shield
                (location caster))
            (FOREACH SPELL s (rbox
                    (location caster)
                    (+ MAX_RAIN_SPELL_RADIUS 1)) (IF (&&
                        (!= s self_invocation)
                        (==
                            (name_of s)
                            "rain"))
                    (BLOCK
                        (message caster "A nearby raincloud absorbs your magic.")
                        (ABORT))))
            (CALL gain_xp 1 24)
            (SET range
                (min MAX_RAIN_SPELL_RADIUS
                    (+ 3
                        (/
                            (min spellpower 200)
                            30))))
            (SET area
                (rbox
                    (location caster)
                    range))
            (IF (||
                    (is_in
                        (location
                            (npc "#DruidTree0#_M"))
                        area)
                    (is_in
                        (location
                            (npc "#DruidTree1#_M"))
                        area))
                (SCRIPT "{
                    set @flag, 1;
                    callfunc \"QuestTreeTrigger\";
                }"))
            (IF (is_in
                    (location caster)
                    (@+
                        (@ "011-1" 94 38)
                        9
                        7))
                (SCRIPT "{
                    callfunc \"HalloweenQuestWaterPumpkins\";
                }")) "Halloween quest"
            (FOR i 0
                (/ spellpower 3)
                (BLOCK
                    (FOR j 0
                        (/
                            (min
                                (/ spellpower 2)
                                200)
                            100)
                        (BLOCK
                            (SET location
                                (random_location area))
                            (sfx location SFX_RAIN 0)
                            (FOREACH TARGET target
                                (rbox location 1)
                                (IF (==
                                        (element target)
                                        ELT_FIRE)
                                    (injure caster target
                                        (+ 2
                                            (random
                                                (+ 5
                                                    (/ spellpower 15))))
                                        0)))))
                    (WAIT
                        (+ 400
                            (random 100))))))))

(PROCEDURE shear-drop (target target2 item prob)
    (IF (||
            (== target name)
            (== target2 name))
        (BLOCK
            (IF (< score prob)
                (drop_item_for place item 1 60000 caster 5000)))))

(PROCEDURE shear-drop2 (target target2 item prob item2 prob2)
    (IF (||
            (== target name)
            (== target2 name))
        (BLOCK
            (IF (< score prob)
                (drop_item_for place item 1 60000 caster 5000)
                (CALL shear-drop target target2 item2
                    (+ prob2 prob))))))

(PROCEDURE shear-drop3 (target target2 item prob item2 prob2 item3 prob3)
    (IF (||
            (== target name)
            (== target2 name))
        (BLOCK
            (IF (< score prob)
                (drop_item_for place item 1 60000 caster 5000)
                (CALL shear-drop2 target target2 item2
                    (+ prob2 prob)
                    item3
                    (+ prob3 prob))))))

(SPELL () shear "#chipchip" ()
    (LET level 1)
    (LET school NATURE)
    (=>
        (GUARD
            (MANA 23)
            (CASTTIME 1000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level)))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (override_attack caster 1 2000 1 ATTACK_ICON_SHEARING 30 0)
            (ATTRIGGER
                (IF (not
                        (is_pc target))
                    (BLOCK
                        (SET score
                            (random
                                (- 1000
                                    (random spellpower)))) "lower score -> more valuable item"
                        (SET name
                            (name_of target))
                        (SET place
                            (random_location
                                (rbox
                                    (location target)
                                    1)))
                        (IF (running_status_update target SC_SHEARED)
                            (ABORT))
                        (status_change target SC_SHEARED 0 0 0 0 600000) "10 minutes"
                        (CALL shear-drop "Fluffy" "Fluffy" "WhiteFur" 300)
                        (CALL shear-drop "EasterFluffy" "Easter Fluffy" "WhiteFur" 300)
                        (CALL shear-drop "SpikyMushroom" "Spiky Mushroom" "HardSpike" 250)
                        (CALL shear-drop "Mouboo" "Mouboo" "CottonCloth" 175)
                        (CALL shear-drop "Cobalt" "CobaltPlant" "CobaltHerb" 700)
                        (CALL shear-drop "Alizarin" "AlizarinPlant" "AlizarinHerb" 700)
                        (CALL shear-drop "Gamboge" "GambogePlant" "GambogeHerb" 700)
                        (CALL shear-drop "Mauve" "MauvePlant" "MauveHerb" 700)
                        (CALL shear-drop "SilkWorm" "Silkworm" "SilkCocoon" 300)
                        (CALL shear-drop "Pinkie" "Pinkie" "PinkAntenna" 180)
                        (IF (&&
                                (||
                                    (||
                                        (== name "Fluffy")
                                        (== name "Mouboo"))
                                    (== name "Pinkie"))
                                (random 2))
                            (SCRIPT "{
                                set @value, 1;
                                callfunc \"QuestSagathaHappy\";
                            }"))))))))

(SPELL () barrier "#asorm" (PC target)
    (LET level 1)
    (LET school ASTRAL)
    (=>
        (GUARD
            (MANA 16)
            (CASTTIME 1000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (REQUIRE
                (not
                    (is_equipped
                        (pc target)
                        "MagicGMTopHat")))
            (GUARD
                (OR
                    (REQUIRE
                        (>
                            (skill caster school)
                            3))
                    (COMPONENTS "SmallMushroom")))
            (REQUIRE
                (<
                    (rdistance
                        (location target)
                        (location caster))
                    (+ 2
                        (/ spellpower 30)))))
        (EFFECT
            (CALL adjust_spellpower school)
            (sfx target SFX_BARRIER 0)
            (IF (!= caster target)
                (CALL default_effect))
            (status_change target SC_MBARRIER
                (+ 20
                    (max 30
                        (/ spellpower 8)))
                0
                0
                0
                (+ 2000
                    (* spellpower 200)))
            (message target "You are surrounded by a magical barrier.")
            (CALL gain_xp 3 25)
            (ATEND
                (message target "Your magical barrier dissipates.")
                (sfx target SFX_UNBARRIER 0)))))

(SPELL (LOCAL) summon-spiky-mushrooms "#kalrenk" ()
    (LET level 1)
    (LET school ASTRAL)
    (=>
        (GUARD
            (MANA 33)
            (CASTTIME 20000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (COMPONENTS "HardSpike" "Root"))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL gain_xp 1 26)
            (CALL summon_spell 1019
                (+ 1
                    (/ spellpower 120))
                (- 5000
                    (* spellpower 9))
                (* spellpower 400)
                2
                school))))

(SPELL (LOCAL) summon-fluffies "#kalakarenk" ()
    (LET level 1)
    (LET school ASTRAL)
    (=>
        (GUARD
            (MANA 39)
            (CASTTIME 20000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (COMPONENTS "WhiteFur" "Root"))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL gain_xp 1 27)
            (CALL summon_spell 1020
                (+
                    (+ 1
                        (/ spellpower 170))
                    (/ spellpower 430))
                (- 5000
                    (* spellpower 8))
                (* spellpower 350)
                2
                school))))

(SPELL (LOCAL) summon-mouboo "#kalboo" ()
    (LET level 1)
    (LET school ASTRAL)
    (=>
        (GUARD
            (MANA 35)
            (CASTTIME 20000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (COMPONENTS "MoubooFigurine" "Root"))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL gain_xp 2 37)
            (CALL summon_spell 1028
                (+ 1
                    (/ spellpower 270))
                (- 4000
                    (* spellpower 9))
                (* spellpower 100)
                2
                school))))

(SPELL (LOCAL) summon-pinkie "#kalgina" ()
    (LET level 1)
    (LET school ASTRAL)
    (=>
        (GUARD
            (MANA 35)
            (CASTTIME 20000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (COMPONENTS "PinkAntenna" "Root"))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (CALL gain_xp 2 38)
            (CALL summon_spell 1018
                (+ 1
                    (/ spellpower 120))
                (- 5000
                    (* spellpower 9))
                (* spellpower 150)
                2
                school))))

(SPELL () detect-players "#inwilt" ()
    (LET level 1)
    (LET school MAGIC)
    (=>
        (GUARD
            (MANA 7)
            (CASTTIME 300)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level)))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (SET message "")
            (FOREACH PC target
                (rbox
                    (location caster)
                    (/ spellpower 2))
                (IF (&&
                        (&&
                            (!= target caster)
                            (not
                                (running_status_update
                                    (pc target)
                                    SC_HIDE)))
                        (not
                            (status_option target SO_GMINVISIBLE)))
                    (BLOCK
                        (IF (!= message "")
                            (SET message
                                (+ message ", ")))
                        (SET message
                            (+ message
                                (name_of target)))
                        (IF (> spellpower 99)
                            (SET message
                                (+
                                    (+
                                        (+ message "(")
                                        (level target))
                                    ")"))))))
            (IF (== message "")
                (message caster "You sense no-one else nearby.")
                (message caster
                    (+ "You sense the following: " message))))))

(SPELL () enchant-lifestone "#manpahil" ()
    (LET level 1)
    (LET school MAGIC)
    (=>
        (GUARD
            (MANA 15)
            (CASTTIME 4000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (GUARD
                (OR
                    (OR
                        (COMPONENTS "BugLeg")
                        (COMPONENTS "MaggotSlime"))
                    (COMPONENTS "MauveHerb" "AlizarinHerb" "CobaltHerb" "GambogeHerb"))))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (create_item caster "Lifestone" 1)
            (CALL gain_xp 1 28))))

(SPELL () sense-spouse "#inzuwilt" ()
    (LET level 1)
    (LET school MAGIC)
    (=>
        (GUARD
            (MANA 7)
            (CASTTIME 400)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (REQUIRE
                (is_married caster))
            (REQUIRE
                (is_equipped caster "WeddingRing")))
        (EFFECT
            (CALL adjust_spellpower school)
            (CALL default_effect)
            (IF (||
                    (failed
                        (partner caster))
                    (not
                        (is_equipped
                            (partner caster)
                            "WeddingRing")))
                (BLOCK
                    (message caster "You cannot sense your partner.")
                    (ABORT)))
            (SET partner
                (partner caster))
            (SET name
                (name_of partner))
            (IF (||
                    (is_dead partner)
                    (!=
                        (map_nr
                            (location partner))
                        (map_nr
                            (location caster))))
                (BLOCK
                    (message caster
                        (+
                            (+ "You cannot sense " name)
                            " nearby."))
                    (ABORT)))
            (IF (&&
                    (>
                        (map_level
                            (location partner))
                        2)
                    (<
                        (map_level
                            (location caster))
                        (map_level
                            (location partner))))
                (BLOCK
                    (message caster
                        (+
                            (+ "You sense " name)
                            " somewhere below."))
                    (ABORT)))
            (IF (&&
                    (>
                        (map_level
                            (location caster))
                        2)
                    (<
                        (map_level
                            (location partner))
                        (map_level
                            (location caster))))
                (BLOCK
                    (message caster
                        (+
                            (+ "You sense " name)
                            " somewhere above."))
                    (ABORT)))
            (IF (!=
                    (map_level
                        (location caster))
                    (map_level
                        (location partner)))
                (message caster
                    (+
                        (+ "You sense " name)
                        " somewhere in the vincinity."))
                (BLOCK
                    (SET distance
                        (rdistance
                            (location caster)
                            (location partner)))
                    (SET dir
                        (dir_towards
                            (location caster)
                            (location partner)
                            1))
                    (IF (< distance 3)
                        (message caster
                            (+
                                (+ "You sense " name)
                                " right next to you."))
                        (IF (< distance 30)
                            (message caster
                                (+
                                    (+
                                        (+
                                            (+ "You sense " name)
                                            " close by, towards the ")
                                        dir)
                                    "."))
                            (IF (< distance 200)
                                (message caster
                                    (+
                                        (+
                                            (+
                                                (+ "You sense " name)
                                                " nearby, towards the ")
                                            dir)
                                        "."))
                                (message caster
                                    (+
                                        (+
                                            (+
                                                (+ "You sense " name)
                                                " in the ")
                                            dir)
                                        "."))))))))))

(SPELL () hide "#anwiltyp" (PC target)
    (LET level 1)
    (LET school ASTRAL)
    (=>
        (GUARD
            (MANA 11)
            (CASTTIME 1000)
            (REQUIRE
                (>
                    (skill caster MAGIC)
                    level))
            (REQUIRE
                (>
                    (skill caster school)
                    level))
            (GUARD
                (OR
                    (REQUIRE
                        (>
                            (skill caster school)
                            3))
                    (COMPONENTS "CottonCloth")))
            (REQUIRE
                (<
                    (rdistance
                        (location target)
                        (location caster))
                    (+ 2
                        (/ spellpower 30)))))
        (EFFECT
            (CALL adjust_spellpower school)
            (sfx target SFX_DEFAULT 0)
            (IF (!= caster target)
                (CALL default_effect))
            (status_change target SC_HIDE 0 0 0 0
                (+ 5000
                    (* spellpower 2500)))
            (CALL gain_xp 2 29)
            (message target "You are hidden!")
            (IF (!= caster target)
                (message caster "You hid someone!"))
            (ATEND
                (message target "You are no longer hidden.")))))