summaryrefslogtreecommitdiff
path: root/npc/008-3-0/juliet.txt
blob: e0d256becd777649ea2fa92192ae6819000b0b79 (plain) (blame)
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
// The Mana World scripts.
// Author:
//    Jesusalva
// Description:
//    Core for rescuing Juliet.
//    Named as "Juliet" so `pluma npc/*/juliet.txt` resolves to something tangible.
008-3-0	mapflag	nosave	008-1-1,49,158

008-3-0,92,89,0	script	Summoning Altar#Rossy	NPC_NO_SPRITE,{
    .@q2=getq2(HurnscaldQuests_Rossy);
    // Not ready
    if (.@q2 < ROSSY_READY) {
        mesn;
        mesq l("Better not touch this.");
        close;
    }
    // Complete
    if (.@q2 & ROSSY_BOSSCAVE) {
        dispbottom l("You find someone hiding behind the altar.");
        enablenpc instance_npcname("Juliet");
        disablenpc instance_npcname("Summoning Altar#Rossy");
        end;
    }
    // Battle
    mesc l("This is the boss room! Be prepared for the worst!!"), 1;
    callfunc("RossyCave", ROSSY_BOSSCAVE);
    close;

OnInit:
    .distance = 4;
    end;

// Time to configure the map
OnInstanceInit:
    .@m$=instance_mapname("008-3-0");
    // Rebuild spawns
    // WARNING: Originals were generated automatically!
    // print('\tareamonster(.@m$, %d, %d, %d, %d, strmobinfo(1, %s), %s, %d);' % (obj.x, obj.y, obj.x+obj.w, obj.y+obj.h, obj.name.replace(' ', ''), obj.name.replace(' ', ''), obj.max_beings))
    areamonster(.@m$, 30, 113, 37, 127, strmobinfo(1, CaveMaggot), CaveMaggot, 5);
	areamonster(.@m$, 102, 116, 116, 124, strmobinfo(1, CaveMaggot), CaveMaggot, 5);
	areamonster(.@m$, 79, 144, 89, 150, strmobinfo(1, CaveMaggot), CaveMaggot, 7);
	areamonster(.@m$, 158, 87, 168, 99, strmobinfo(1, CaveMaggot), CaveMaggot, 7);
	areamonster(.@m$, 34, 28, 37, 32, strmobinfo(1, PoisonSkull), PoisonSkull, 1);
	areamonster(.@m$, 160, 124, 165, 127, strmobinfo(1, Ratto), Ratto, 4);
	areamonster(.@m$, 155, 163, 156, 170, strmobinfo(1, Ratto), Ratto, 4);
	areamonster(.@m$, 128, 146, 133, 149, strmobinfo(1, Ratto), Ratto, 4);
	areamonster(.@m$, 120, 61, 125, 64, strmobinfo(1, Ratto), Ratto, 4);
	areamonster(.@m$, 138, 64, 148, 71, strmobinfo(1, Crafty), Crafty, 10);
	areamonster(.@m$, 129, 102, 140, 108, strmobinfo(1, Crafty), Crafty, 6);
	areamonster(.@m$, 67, 114, 77, 116, strmobinfo(1, Spider), Spider, 3);
	areamonster(.@m$, 109, 145, 113, 155, strmobinfo(1, Spider), Spider, 5);
	areamonster(.@m$, 68, 84, 71, 91, strmobinfo(1, Spider), Spider, 4);
	areamonster(.@m$, 80, 169, 80, 169, strmobinfo(1, DiamondVein), DiamondVein, 1);
	areamonster(.@m$, 118, 96, 118, 96, strmobinfo(1, GemVeinbloc), GemVeinbloc, 1);
	areamonster(.@m$, 131, 93, 131, 93, strmobinfo(1, CoalVeinbloc), CoalVeinbloc, 1);
	areamonster(.@m$, 119, 101, 119, 101, strmobinfo(1, GoldVeinbloc), GoldVeinbloc, 1);
	areamonster(.@m$, 113, 60, 136, 68, strmobinfo(1, CaveMaggot), CaveMaggot, 7);
	areamonster(.@m$, 199, 68, 207, 77, strmobinfo(1, Crafty), Crafty, 5);
	areamonster(.@m$, 160, 47, 177, 52, strmobinfo(1, Crafty), Crafty, 5);
	areamonster(.@m$, 119, 200, 139, 204, strmobinfo(1, Spider), Spider, 5);
	areamonster(.@m$, 34, 193, 45, 202, strmobinfo(1, Spider), Spider, 5);
	areamonster(.@m$, 26, 115, 31, 132, strmobinfo(1, Spider), Spider, 5);
	areamonster(.@m$, 82, 60, 103, 67, strmobinfo(1, CaveMaggot), CaveMaggot, 5);
	areamonster(.@m$, 38, 193, 54, 197, strmobinfo(1, CaveMaggot), CaveMaggot, 5);
	areamonster(.@m$, 114, 199, 126, 202, strmobinfo(1, Ratto), Ratto, 4);
	areamonster(.@m$, 106, 30, 116, 37, strmobinfo(1, Crafty), Crafty, 5);
	areamonster(.@m$, 78, 128, 89, 149, strmobinfo(1, Ratto), Ratto, 4);
	areamonster(.@m$, 117, 141, 152, 152, strmobinfo(1, Crafty), Crafty, 10);
	areamonster(.@m$, 117, 101, 135, 112, strmobinfo(1, Ratto), Ratto, 7);
	areamonster(.@m$, 130, 88, 130, 88, strmobinfo(1, RubyVein), RubyVein, 1);
	areamonster(.@m$, 122, 94, 122, 94, strmobinfo(1, RubyVein), RubyVein, 1);
	areamonster(.@m$, 31, 181, 31, 181, strmobinfo(1, SapphireVein), SapphireVein, 1);
	areamonster(.@m$, 31, 198, 31, 198, strmobinfo(1, SapphireVein), SapphireVein, 1);
	areamonster(.@m$, 135, 127, 135, 127, strmobinfo(1, TopazVein), TopazVein, 1);
	areamonster(.@m$, 120, 125, 120, 125, strmobinfo(1, TopazVein), TopazVein, 1);
	areamonster(.@m$, 31, 112, 31, 112, strmobinfo(1, AmethystVein), AmethystVein, 1);
	areamonster(.@m$, 24, 123, 24, 123, strmobinfo(1, AmethystVein), AmethystVein, 1);
	areamonster(.@m$, 193, 123, 193, 123, strmobinfo(1, EmeraldVein), EmeraldVein, 1);
	areamonster(.@m$, 204, 116, 204, 116, strmobinfo(1, EmeraldVein), EmeraldVein, 1);
	areamonster(.@m$, 89, 168, 89, 168, strmobinfo(1, DiamondVein), DiamondVein, 1);
	areamonster(.@m$, 132, 192, 132, 192, strmobinfo(1, SapphireVein), SapphireVein, 1);
	areamonster(.@m$, 39, 174, 39, 174, strmobinfo(1, AmethystVein), AmethystVein, 1);
	areamonster(.@m$, 44, 174, 44, 174, strmobinfo(1, TopazVein), TopazVein, 1);
	areamonster(.@m$, 118, 196, 118, 196, strmobinfo(1, EmeraldVein), EmeraldVein, 1);
	areamonster(.@m$, 65, 105, 65, 105, strmobinfo(1, DiamondVein), DiamondVein, 1);
	areamonster(.@m$, 143, 139, 143, 139, strmobinfo(1, GemVeinbloc), GemVeinbloc, 1);
	areamonster(.@m$, 156, 121, 156, 121, strmobinfo(1, GemVeinbloc), GemVeinbloc, 1);
	areamonster(.@m$, 155, 166, 155, 166, strmobinfo(1, GemVeinbloc), GemVeinbloc, 1);
	areamonster(.@m$, 125, 162, 125, 162, strmobinfo(1, GemVeinbloc), GemVeinbloc, 1);
	areamonster(.@m$, 107, 141, 107, 141, strmobinfo(1, GemVeinbloc), GemVeinbloc, 1);
	areamonster(.@m$, 77, 148, 77, 148, strmobinfo(1, GemVeinbloc), GemVeinbloc, 1);
	areamonster(.@m$, 62, 119, 62, 119, strmobinfo(1, GemVeinbloc), GemVeinbloc, 1);
	areamonster(.@m$, 162, 95, 162, 95, strmobinfo(1, CoalVeinbloc), CoalVeinbloc, 1);
	areamonster(.@m$, 157, 66, 157, 66, strmobinfo(1, CoalVeinbloc), CoalVeinbloc, 1);
	areamonster(.@m$, 112, 60, 112, 60, strmobinfo(1, CoalVeinbloc), CoalVeinbloc, 1);
	areamonster(.@m$, 66, 54, 66, 54, strmobinfo(1, CoalVeinbloc), CoalVeinbloc, 1);
	areamonster(.@m$, 63, 91, 63, 91, strmobinfo(1, GoldVeinbloc), GoldVeinbloc, 1);
	areamonster(.@m$, 76, 127, 76, 127, strmobinfo(1, GoldVeinbloc), GoldVeinbloc, 1);
	areamonster(.@m$, 111, 148, 111, 148, strmobinfo(1, GoldVeinbloc), GoldVeinbloc, 1);
    /*
	areamonster(.@m$, 101, 27, 104, 31, strmobinfo(1, PoisonSkull), PoisonSkull, 1);
	areamonster(.@m$, 165, 28, 168, 32, strmobinfo(1, PoisonSkull), PoisonSkull, 1);
	areamonster(.@m$, 199, 67, 202, 71, strmobinfo(1, PoisonSkull), PoisonSkull, 1);
	areamonster(.@m$, 199, 109, 202, 113, strmobinfo(1, PoisonSkull), PoisonSkull, 1);
	areamonster(.@m$, 197, 194, 200, 198, strmobinfo(1, PoisonSkull), PoisonSkull, 1);
	areamonster(.@m$, 133, 199, 136, 203, strmobinfo(1, PoisonSkull), PoisonSkull, 1);
	areamonster(.@m$, 34, 194, 37, 198, strmobinfo(1, PoisonSkull), PoisonSkull, 1);
	areamonster(.@m$, 26, 111, 29, 115, strmobinfo(1, PoisonSkull), PoisonSkull, 1);
    */
	areamonster(.@m$, 88, 48, 88, 48, strmobinfo(1, CoalVein), CoalVein, 1);
	areamonster(.@m$, 100, 49, 100, 49, strmobinfo(1, CoalVein), CoalVein, 1);
	areamonster(.@m$, 130, 44, 130, 44, strmobinfo(1, CoalVein), CoalVein, 1);
	areamonster(.@m$, 67, 47, 67, 47, strmobinfo(1, CoalVein), CoalVein, 1);
	areamonster(.@m$, 124, 94, 124, 94, strmobinfo(1, CoalVein), CoalVein, 1);
	areamonster(.@m$, 158, 60, 158, 60, strmobinfo(1, CoalVein), CoalVein, 1);
	areamonster(.@m$, 56, 53, 56, 53, strmobinfo(1, IronVein), IronVein, 1);
	areamonster(.@m$, 55, 98, 55, 98, strmobinfo(1, IronVein), IronVein, 1);
	areamonster(.@m$, 62, 103, 62, 103, strmobinfo(1, IronVein), IronVein, 1);
	areamonster(.@m$, 69, 125, 69, 125, strmobinfo(1, IronVein), IronVein, 1);
	areamonster(.@m$, 62, 153, 62, 153, strmobinfo(1, IronVein), IronVein, 1);
	areamonster(.@m$, 96, 145, 96, 145, strmobinfo(1, IronVein), IronVein, 1);

    // Yay yay yay
    end;
}

/////////////////////////////////////////////////////////
// Main script controller for Rossy Quest
-	script	#RossyQuest	NPC_HIDDEN,{
    end;

OnStage2:
    if (!playerattached()) end; // ERROR
    if (!@rossylock) end; // Invalid
    if (mobcount(getmap(), "#RossyQuest::OnStage2")) end; // Still working
    .@q2=getq2(HurnscaldQuests_Rossy);
    setq2 HurnscaldQuests_Rossy, .@q2 | ROSSY_CAVE1;
    goto OnBeat;

OnStage4:
    if (!playerattached()) end; // ERROR
    if (!@rossylock) end; // Invalid
    if (mobcount(getmap(), "#RossyQuest::OnStage4")) end; // Still working
    .@q2=getq2(HurnscaldQuests_Rossy);
    setq2 HurnscaldQuests_Rossy, .@q2 | ROSSY_CAVE2;
    goto OnBeat;

OnStage8:
    if (!playerattached()) end; // ERROR
    if (!@rossylock) end; // Invalid
    if (mobcount(getmap(), "#RossyQuest::OnStage8")) end; // Still working
    .@q2=getq2(HurnscaldQuests_Rossy);
    setq2 HurnscaldQuests_Rossy, .@q2 | ROSSY_CAVE3;
    goto OnBeat;

OnStage16:
    if (!playerattached()) end; // ERROR
    if (!@rossylock) end; // Invalid
    if (mobcount(getmap(), "#RossyQuest::OnStage16")) end; // Still working
    .@q2=getq2(HurnscaldQuests_Rossy);
    setq2 HurnscaldQuests_Rossy, .@q2 | ROSSY_CAVE4;
    goto OnBeat;

OnStage32:
    if (!playerattached()) end; // ERROR
    if (!@rossylock) end; // Invalid
    if (mobcount(getmap(), "#RossyQuest::OnStage32")) end; // Still working
    .@q2=getq2(HurnscaldQuests_Rossy);
    setq2 HurnscaldQuests_Rossy, .@q2 | ROSSY_CAVE5;
    goto OnBeat;

OnStage64:
    if (!playerattached()) end; // ERROR
    if (!@rossylock) end; // Invalid
    if (mobcount(getmap(), "#RossyQuest::OnStage64")) end; // Still working
    .@q2=getq2(HurnscaldQuests_Rossy);
    setq2 HurnscaldQuests_Rossy, .@q2 | ROSSY_CAVE6;
    goto OnBeat;

OnStage128:
    if (!playerattached()) end; // ERROR
    if (!@rossylock) end; // Invalid
    if (mobcount(getmap(), "#RossyQuest::OnStage128")) end; // Still working
    .@q2=getq2(HurnscaldQuests_Rossy);
    setq2 HurnscaldQuests_Rossy, .@q2 | ROSSY_CAVE7;
    goto OnBeat;

OnStage256:
    if (!playerattached()) end; // ERROR
    if (!@rossylock) end; // Invalid
    if (mobcount(getmap(), "#RossyQuest::OnStage256")) end; // Still working
    .@q2=getq2(HurnscaldQuests_Rossy);
    setq2 HurnscaldQuests_Rossy, .@q2 | ROSSY_CAVE8;
    goto OnBeat;

OnStage512:
    if (!playerattached()) end; // ERROR
    if (!@rossylock) end; // Invalid
    if (mobcount(getmap(), "#RossyQuest::OnStage512")) end; // Still working
    .@q2=getq2(HurnscaldQuests_Rossy);
    setq2 HurnscaldQuests_Rossy, .@q2 | ROSSY_CAVE9;
    goto OnBeat;

OnStage1024:
    if (!playerattached()) end; // ERROR
    if (!@rossylock) end; // Invalid
    if (mobcount(getmap(), "#RossyQuest::OnStage1024")) end; // Still working
    .@q2=getq2(HurnscaldQuests_Rossy);
    setq2 HurnscaldQuests_Rossy, .@q2 | ROSSY_BOSSCAVE;
    goto OnBeat;

OnBeat:
    @rossylock = false;
    dispbottom l("*** Cave Cleared ***");
    delcells "Rossy"+getcharid(0)+"Wall";
    .@inst = getq3(HurnscaldQuests_Rossy);
    instance_set_timeout(ROSSY_INSTIME, ROSSY_INSTIME, .@inst);
    if (.@q2 < ROSSY_BOSSCAVE)
        addtimer2(300000, "#RossyQuest::OnTick1");
    else
        deltimer("#RossyQuest::OnTick1");
    deltimer("#RossyQuest::OnTick2");
    deltimer("#RossyQuest::OnTick3");
    deltimer("#RossyQuest::OnTick4");
    deltimer("#RossyQuest::OnTick5");
    end;

/* ****************************************** */
OnTick1:
    dispbottom l("Time remaining: %d minutes", 15);
    addtimer2(300000, "#RossyQuest::OnTick2");
    end;

OnTick2:
    dispbottom l("Time remaining: %d minutes", 10);
    addtimer2(300000, "#RossyQuest::OnTick3");
    end;

OnTick3:
    dispbottom l("Time remaining: %d minutes", 5);
    addtimer2(240000, "#RossyQuest::OnTick4");
    end;

OnTick4:
    dispbottom l("Time remaining: 1 minute");
    addtimer2(45000, "#RossyQuest::OnTick5");
    end;

OnTick5:
    dispbottom l("Time remaining: %d seconds!", 15);
    end;

}

/////////////////////////////////////////////////////////
// RossyCave(Cave ID)
function	script	RossyCave	{
    // Fight ongoing - cannot trigger
    if (@rossylock)
        return false;

    // Check quest consistency
    // HurnscaldQuests_Rossy
    // (MAIN QUEST, CAVE CONTROL, INSTANCE CONTROL)
    .@q=getq(HurnscaldQuests_Rossy);
    .@q2=getq2(HurnscaldQuests_Rossy);
    .@inst=getq3(HurnscaldQuests_Rossy);

    if (instance_id() != .@inst)
        return false;
    if (.@q != 16)
        return false;
    if (!.@q2) {
        dispbottom l("This looks DANGEROUS! Maybe someone around here can tell me what I'm supposed to do.");
        return false;
    }
    if (.@q2 & .caveid)
        return false;

    // ---------------
    // Main node setup
    .@c=getarg(0);
    .@m$=getmap();
    .@n$="#RossyQuest::OnStage"+.@c;

    // Obtain and Write Configuration
    switch (.@c) {
    case ROSSY_CAVE1:
        .@boss=PoisonSkull;
        .@mobc=rand2(3,5);
        .@x1=85;.@y1=21;.@x2=108;.@y2=39;
        .@x3=109;.@y3=33; .@x4=109; .@y4=36;
        break;
    case ROSSY_CAVE2:
        .@boss=Troll;
        .@mobc=rand2(3,5);
        .@x1=191;.@y1=103;.@x2=205;.@y2=122;
        .@x3=201;.@y3=123; .@x4=201; .@y4=123;
        break;
    case ROSSY_CAVE3:
        .@boss=FireWisp;
        .@mobc=rand2(2,4);
        .@x1=26;.@y1=23;.@x2=43;.@y2=36;
        .@x3=38;.@y3=37; .@x4=38; .@y4=37;
        break;
    case ROSSY_CAVE4:
        .@boss=WaterWisp;
        .@mobc=rand2(6,12);
        .@x1=180;.@y1=176;.@x2=206;.@y2=207;
        .@x3=179;.@y3=200; .@x4=179; .@y4=200;
        break;
    case ROSSY_CAVE5:
        .@boss=Serqet;
        .@mobc=rand2(6,8);
        .@x1=98;.@y1=188;.@x2=141;.@y2=207;
        .@x3=97;.@y3=190; .@x4=97; .@y4=197;
        break;
    case ROSSY_CAVE6:
        .@boss=SnakeGhost;
        .@mobc=rand2(5,7);
        .@x1=19;.@y1=98;.@x2=36;.@y2=136;
        .@x3=37;.@y3=125; .@x4=37; .@y4=125;
        break;
    case ROSSY_CAVE7:
        .@boss=ScorpionGhost;
        .@mobc=rand2(5,7);
        .@x1=22;.@y1=181;.@x2=50;.@y2=205;
        .@x3=51;.@y3=192; .@x4=51; .@y4=197;
        break;
    case ROSSY_CAVE8:
        .@boss=JackO;
        .@mobc=rand2(3,5);
        .@x1=158;.@y1=20;.@x2=176;.@y2=35;
        .@x3=175;.@y3=36; .@x4=177; .@y4=36;
        break;
    case ROSSY_CAVE9:
        .@boss=GreenSlimeProgenitor;
        .@mobc=rand2(5,7);
        .@x1=187;.@y1=58;.@x2=208;.@y2=85;
        .@x3=186;.@y3=82; .@x4=186; .@y4=85;
        break;
    case ROSSY_BOSSCAVE:
        .@boss=Golem;
        .@mobc=rand2(3,5);
        .@x1=84;.@y1=85;.@x2=101;.@y2=101;
        .@x3=92;.@y3=102; .@x4=93; .@y4=102;
        break;
    default:
        consolemes(CONSOLEMES_ERROR, "INVALID ROSSY CAVE ID - "+.@c+" - SCRIPT ABORTED");
        return false;
    }

    // This is cast from a dialog so prompt comes before any advanced calculation
    mesc l("Drop a %s here to summon monsters.", getitemlink(PileOfAsh));
    if (.@c == ROSSY_BOSSCAVE)
        mesc l("This is the master's room seal, be careful!"), 1;
    else
        mesc l("Weaken all nine seals to be able to undo the final one.");
    select
        rif(countitem(PileOfAsh), l("Place pile of ashes")),
        l("Run away in fear");
    mes "";
    closeclientdialog;
    if (@menu == 2)
        return false;

    // Delete the item and lock for the quest
    delitem PileOfAsh, 1;
    @rossylock = true;

    // Spawn underlings
    for (.@i=0; .@i < .@mobc; .@i++) {
        // FIXME: Penguin? Mister Prickel? Ice Goblin? Wolvern?
        // I think all those four could be removed.
        .@mobId=any(Bandit, RobinBandit, Skeleton, MisterPrickel, ManaGhost, Penguin, CraftyGhost, Zombie, Wolvern, SpiderGhost, IceGoblin); // Mobs lv 26~47
        .@mob=areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mobId), .@mobId, 1, .@n$);
        // Make it aggresive
        .@bmod=getunitdata(.@mob, UDT_MODE);
        setunitdata(.@mob, UDT_MODE, .@bmod|4); // 4 = MD_AGGRESSIVE
    }

    // Spawn boss
    .@mob=areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@boss), .@boss, 1, .@n$);

    // Obain boss basic status...
    .@bhp= getunitdata(.@mob, UDT_MAXHP);
    .@bat1=getunitdata(.@mob, UDT_ATKMIN);
    .@bat2=getunitdata(.@mob, UDT_ATKMAX);
    .@bhit=getunitdata(.@mob, UDT_HIT);
    .@bmod=getunitdata(.@mob, UDT_MODE);
    .@bmod=.@bmod|4; // 4 = MD_AGGRESSIVE

    // ...And Tweak Battle Status
    setunitdata(.@mob, UDT_MAXHP,    .@bhp*15/10);
    setunitdata(.@mob, UDT_HP,       .@bhp*15/10);
    setunitdata(.@mob, UDT_ATKMIN,   .@bat1*7/10);
    setunitdata(.@mob, UDT_ATKMAX,   .@bat2*7/10);
    setunitdata(.@mob, UDT_HIT,      .@bhit*2);
    setunitdata(.@mob, UDT_MODE,     .@bmod|32); // 32 = MD_BOSS

    // Build the wall so you cannot leave :>
    setcells getmap(), .@x3, .@y3, .@x4, .@y4, 3, "Rossy"+getcharid(0)+"Wall";
    return true;
}

///////////////////////////////////////////////
// Reset quest when you die
function	script	RossyDeath	{
    if (getq(HurnscaldQuests_Rossy) != 16)
        return;
    if (@rossylock)
        delcells("Rossy"+getcharid(0)+"Wall");
    @rossylock=false;
    setq2 HurnscaldQuests_Rossy, 0;
    deltimer("#RossyQuest::OnTick1");
    deltimer("#RossyQuest::OnTick2");
    deltimer("#RossyQuest::OnTick3");
    deltimer("#RossyQuest::OnTick4");
    deltimer("#RossyQuest::OnTick5");
    return;
}

// May reset quest when you logout
function	script	RossyLogout	{
    if (getq(HurnscaldQuests_Rossy) != 16)
        return;
    if (@rossylock) {
        delcells("Rossy"+getcharid(0)+"Wall");
        @rossylock=false;
        setq2 HurnscaldQuests_Rossy, 0;
    }
    // FIXME: Set timers again when you login back? =/
    return;
}

/////////////////////////////////////////////////////////
// Position the triggers

// Begin Cave Code
008-3-0,98,27,0	script	#RossyCave01	NPC_SUMMONING_CIRC,{
    if (RossyCave(.caveid))
        disablenpc instance_npcname(.name$);
    close;

OnInit:
    disablenpc "#RossyCave01";
OnInstanceInit:
    .distance=1;
    .caveid=ROSSY_CAVE1;
    end;
}

// Begin Cave Code
008-3-0,199,109,0	script	#RossyCave02	NPC_SUMMONING_CIRC,{
    if (RossyCave(.caveid))
        disablenpc instance_npcname(.name$);
    close;

OnInit:
    disablenpc "#RossyCave02";
OnInstanceInit:
    .distance=1;
    .caveid=ROSSY_CAVE2;
    end;
}

// Begin Cave Code
008-3-0,35,26,0	script	#RossyCave03	NPC_SUMMONING_CIRC,{
    if (RossyCave(.caveid))
        disablenpc instance_npcname(.name$);
    close;

OnInit:
    disablenpc "#RossyCave03";
OnInstanceInit:
    .distance=1;
    .caveid=ROSSY_CAVE3;
    end;
}

// Begin Cave Code
008-3-0,198,193,0	script	#RossyCave04	NPC_SUMMONING_CIRC,{
    if (RossyCave(.caveid))
        disablenpc instance_npcname(.name$);
    close;

OnInit:
    disablenpc "#RossyCave04";
OnInstanceInit:
    .distance=1;
    .caveid=ROSSY_CAVE4;
    end;
}

// Begin Cave Code
008-3-0,133,200,0	script	#RossyCave05	NPC_SUMMONING_CIRC,{
    if (RossyCave(.caveid))
        disablenpc instance_npcname(.name$);
    close;

OnInit:
    disablenpc "#RossyCave05";
OnInstanceInit:
    .distance=1;
    .caveid=ROSSY_CAVE5;
    end;
}

// Begin Cave Code
008-3-0,27,104,0	script	#RossyCave06	NPC_SUMMONING_CIRC,{
    if (RossyCave(.caveid))
        disablenpc instance_npcname(.name$);
    close;

OnInit:
    disablenpc "#RossyCave06";
OnInstanceInit:
    .distance=1;
    .caveid=ROSSY_CAVE6;
    end;
}

// Begin Cave Code
008-3-0,31,192,0	script	#RossyCave07	NPC_SUMMONING_CIRC,{
    if (RossyCave(.caveid))
        disablenpc instance_npcname(.name$);
    close;

OnInit:
    disablenpc "#RossyCave07";
OnInstanceInit:
    .distance=1;
    .caveid=ROSSY_CAVE7;
    end;
}

// Begin Cave Code
008-3-0,165,26,0	script	#RossyCave08	NPC_SUMMONING_CIRC,{
    if (RossyCave(.caveid))
        disablenpc instance_npcname(.name$);
    close;

OnInit:
    disablenpc "#RossyCave08";
OnInstanceInit:
    .distance=1;
    .caveid=ROSSY_CAVE8;
    end;
}

// Begin Cave Code
008-3-0,201,69,0	script	#RossyCave09	NPC_SUMMONING_CIRC,{
    if (RossyCave(.caveid))
        disablenpc instance_npcname(.name$);
    close;

OnInit:
    disablenpc "#RossyCave09";
OnInstanceInit:
    .distance=1;
    .caveid=ROSSY_CAVE9;
    end;
}

// --------------------------------------------------------------------
008-3-0,92,90,0	script	Juliet	NPC_TANISHA,{
    // Check quest consistency
    // HurnscaldQuests_Rossy
    // (MAIN QUEST, CAVE CONTROL, INSTANCE CONTROL)
    .@q=getq(HurnscaldQuests_Rossy);
    .@q2=getq2(HurnscaldQuests_Rossy);
    .@inst=getq3(HurnscaldQuests_Rossy);

    if (instance_id() != .@inst)
        end;
    if (!.@q2)
        end;

    // A bug!
    if (.@q != 16) {
        disablenpc instance_npcname("Juliet", .@inst);
        end;
    }

    // Another bug!!
    if (!(.@q2 & ROSSY_BOSSCAVE)) {
        disablenpc instance_npcname("Juliet", .@inst);
        end;
    }

    // Prepare rewards
    .@rune=any(RunestoneUruz, RunestoneRaido, RunestoneThurisaz, RunestoneKaunaz, RunestoneDagaz, RunestonePeorth);
    .@gems=any(CrudeDiamond, CrudeRuby, CrudeEmerald, CrudeSapphire, CrudeTopaz, CrudeAmethyst);
    inventoryplace .@rune, 1, .@gems, 1;

    // Run epilogue
    mesn;
    mesq l("I heard some battle noises a few minutes ago. Are you here to save me?");
    next;
    select
        l("Of course I'm here to save you, Rossy sent me here!");
    mes "";
    mesn;
    mesc l("Juliet starts scavenging the fallen Golem.");
    mesq l("Mommy teached me about precious gemstones. This Golem has quite a few of them.");
    next;
    mesn;
    mesq l("Here you go!");
    getitem .@gems, 1;
    quest_item(.@rune, 1);
    quest_xp(.maxLevel, 100000);
    quest_jxp(.maxLevel, 10000);
    setq HurnscaldQuests_Rossy, 17, 0, .@inst;
    next;
    mesn;
    mesq l("Thanks for helping me... I'll be on my way now.");
    next;
    select
        l("Go safely!"),
        l("Do you need an escort?"),
        l("What was following you, anyway?");
    mes "";
    if (@menu == 2) {
        mesn;
        mesq l("I'll be fine, but thanks for the concern.");
    } else if (@menu == 3) {
        // This opens path for additional questline
        mesn;
        mesq l("Actually... I don't remember. I'm not sure why.");
        next;
        mesn;
        mesq l("But it was big and scary! I haven't seen it since I entered this cave, though...");
        next;
        mesn;
        mesq l("It probably went away after seeing your bravure, tee-hee!");
        next;
        mesn;
        mesq l("I must go now. I've already spent too much time here already.");
    }
    disablenpc instance_npcname("Juliet", .@inst);
    close;

OnInit:
    disablenpc "Juliet";
    .distance=4;
    .maxLevel=80;
    end;

OnInstanceInit:
    disablenpc instance_npcname("Juliet");
    .distance=4;
    .maxLevel=90;
    end;
}