summaryrefslogtreecommitdiff
path: root/npc/029-9/boss.txt
blob: 9cb75ecefc7ef8b8b97f4ab06daba774a61bd454 (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
// TMW2 scripts.
// Author:
//    Jesusalva
// Description:
//    Fires of Steam: The Death of Andrei Sakar
/* *****************************************
$@FIRESOFSTEAM_BOSS
0 = Off; 1 = Moubootaur summoning; 2 = Moubootaur summoned
$@FIRESOFSTEAM_DIFF
Level of difficulty setting (100/130/160/190/220)
***************************************** */

//////////////////////////////////////////
// Boss Room
029-9,96,22,0	script	Book#FoS	NPC_NO_SPRITE,{
    if (!is_staff() && strcharinfo(0) != $MOST_HEROIC$) end;
    if ($@FIRESOFSTEAM_BOSS) end;
    select
        l("Ignore this book"),
        l("Begin classic mode"),
        rif(is_staff() && $FIRESOFSTEAM >= 10, l("Skip prologue"));
    mes "";
    $@FIRESOFSTEAM_BOSS=(@menu-1);
    if ($@FIRESOFSTEAM_BOSS == 0) close;
    select
        l("Easy Mode"),
        rif($FIRESOFSTEAM >= 10, l("Crazy Mode")),
        rif($FIRESOFSTEAM >= 10, l("Cadis Mode")),
        rif($FIRESOFSTEAM >= 10, l("Crazy Cadis Ultimate Pandorica Mode")),
        rif($FIRESOFSTEAM >= 10, l("Portable Apocalypse"));
    mes "";
    $@FIRESOFSTEAM_DIFF=70+(@menu*30);
    switch (@menu) {
    case 1: .@d$="##2Easy"; break;
    case 2: .@d$="##3Crazy"; break;
    case 3: .@d$="##5Cadis"; break;
    case 4: .@d$="##6Crazy Cadis Ultimate Pandorica"; break;
    case 5: .@d$="##1Portable Apocalypse"; break;
    default: .@d$="Unknown";
    }
    mapannounce("029-9", "Difficulty Selected: ##B"+.@d$+"##b", 0);
    changemusic("029-9", "mythica.ogg");
    closeclientdialog;
    // Dispose of the GM
    warp "029-8", 175, 80;
    sleep(200);
    // PC no longer attached
    // Start the event
    mapwarp("029-9", "029-9", 96, 41);
    sleep(200);
    .@c = getunits(BL_PC|BL_MER|BL_HOM, .@players, MAX_CYCLE_PC, "029-9");
    for (.@i = 0; .@i < .@c; .@i++) {
        sc_start(SC_STUN, 18000, 1, 10000,
                 SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .@players[.@i]);
    }
    sleep(100);
    // Cleanup previous data (if any)
    $@FOS_ISB=0;
    $@FOS_MOB=0;
    $@FOS_AND=0;
    .Support1=0;
    .Support2=0;
    .Support3=0;
    .Support4=0;
    .Support5=0;
    // Lockdown
    disablenpc "#029-9_97_49";  // Exit
    disablenpc "#029-9_103_48"; // To Storage
    disablenpc "#029-9_91_26";  // To Moubootaur
    disablenpc "#029-9_34_23";  // From Moubootaur
    disablenpc "#029-9_137_41"; // From Storage
    // Summon Andrei, and handle prologue skips
    $@FOS_AND=monster("029-9", 96, 35, "Andrei Sakar", AndreiSakar, 1);
    if ($@FIRESOFSTEAM_BOSS == 2) goto OnProlEnd;
    // Spawn Isbamuth and his support
    $@FOS_ISB=monster("029-9", 96, 32, "Isbamuth", Isbamuth, 1, "Book#FoS::OnProlEnd");
    .Support1=monster("029-9", 95, 31, "Hooded Assassin", HoodedAssassin, 1);
    .Support2=monster("029-9", 97, 31, "Hooded Assassin", HoodedAssassin, 1);
    .Support3=monster("029-9", 95, 27, "Assassin", Assassin, 1);
    .Support4=monster("029-9", 96, 27, "Assassin", Assassin, 1);
    .Support5=monster("029-9", 97, 27, "Assassin", Assassin, 1);
    // Freeze everyone!
    sc_start(SC_STUN, 18000, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, $@FOS_AND);
    sc_start(SC_STUN, 18000, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, $@FOS_ISB);
    sc_start(SC_STUN, 18000, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .Support1);
    sc_start(SC_STUN, 18000, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .Support2);
    sc_start(SC_STUN, 18000, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .Support3);
    sc_start(SC_STUN, 18000, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .Support4);
    sc_start(SC_STUN, 18000, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .Support5);
    // Boost Isbamuth stats
    .@avg=$@FIRESOFSTEAM_DIFF;
    // Reconfigure the monster
    setunitdata($@FOS_ISB, UDT_LEVEL, .@avg);
    setunitdata($@FOS_ISB, UDT_STR, 1+.@avg/2);
    setunitdata($@FOS_ISB, UDT_AGI, 1+.@avg/2);
    setunitdata($@FOS_ISB, UDT_VIT, 1+.@avg/2);
    setunitdata($@FOS_ISB, UDT_INT, 1+.@avg/2);
    setunitdata($@FOS_ISB, UDT_DEX, 1+.@avg/2);
    setunitdata($@FOS_ISB, UDT_LUK, 1+.@avg/2);
    setunitdata($@FOS_ISB, UDT_ADELAY, 1072);
    setunitdata($@FOS_ISB, UDT_ATKRANGE, 4);
    // Battle Status
    setunitdata($@FOS_ISB, UDT_MAXHP,    .@avg*700);
    setunitdata($@FOS_ISB, UDT_HP,       .@avg*700);
    setunitdata($@FOS_ISB, UDT_ATKMIN,   .@avg*6);
    setunitdata($@FOS_ISB, UDT_ATKMAX,   .@avg*8);
    setunitdata($@FOS_ISB, UDT_DEF,      4+.@avg);
    setunitdata($@FOS_ISB, UDT_MDEF,     1+.@avg);
    setunitdata($@FOS_ISB, UDT_HIT,      .@avg*12); // Advised: x18
    setunitdata($@FOS_ISB, UDT_FLEE,     .@avg*4); // Advised: x5
    setunitdata($@FOS_ISB, UDT_CRIT,     20+.@avg);
    // Reconfigure the AI
    .@opt=getunitdata($@FOS_ISB, UDT_MODE);
    // Disable looting
    if (.@opt & MD_LOOTER)
        .@opt=.@opt^MD_LOOTER;
    // Add knockback immunity
    .@opt=.@opt|MD_NOKNOCKBACK;
    // Mark as boss
    .@opt=.@opt|MD_BOSS;
    // Mark as aggressive
    .@opt=.@opt|MD_AGGRESSIVE;
    .@opt=.@opt|MD_ANGRY;
    // Make it crazy
    .@opt=.@opt|MD_RANDOMTARGET;
    setunitdata($@FOS_ISB, UDT_MODE, .@opt);

    // Begin Isbamuth's monologue
    unittalk($@FOS_ISB, "You are too late! I did it!! Muahahaha!");
    sleep(1000);
    unittalk(.Support1, "Yeah, you did it!");
    sleep(400);
    unittalk(.Support2, "Yeah, you are the best!");
    sleep(600);
    unittalk($@FOS_ISB, "Silence!");
    sleep(1000);
    unittalk($@FOS_ISB, "You did well tracking me down... However the rite is almost complete.");
    sleep(3000);
    unittalk($@FOS_ISB, "The power of the Moubootaur will be mine...");
    sleep(2000);
    unittalk($@FOS_ISB, "And you no longer can stop me!! Muahahahaha!");
    sleep(1000);
    unittalk(.Support1, "Yeah, that's our boss!");
    sleep(600);
    unittalk(.Support2, "Yeah, none is like boss!");
    sleep(400);
    unittalk($@FOS_AND, "Your evil plans shall never prevail, Isbamuth!");
    sleep(2500);
    unittalk($@FOS_AND, "Adventurers! I'll go ahead, you shall buy me time!");
    maptimer2("029-9", 200, "Book#FoS::OnMFAndreiMagic");
    sleep(500);
    sc_end(SC_STUN, $@FOS_AND);
    unitwalk($@FOS_AND, 96, 24);
    sleep(1000);
    unitwalk($@FOS_AND, 96, 24);
    sleep(1000);
    unittalk($@FOS_AND, "I'm sure Isbamuth will be no match for all of you!");
    unitwalk($@FOS_AND, 90, 26);
    sleep(1500);
    unitwarp($@FOS_AND, "029-9", 39, 21);
    unittalk($@FOS_ISB, "Hahaha... YOU THINK YOU CAN DEFEAT ME??");
    sc_start(SC_STUN, INT_MAX, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, $@FOS_AND);
    sleep(1000);
    unittalk($@FOS_ISB, "We will see! Engarde!!");
    initnpctimer;
    changemusic("029-9", "let_the_battles_begin.ogg");
    end;

////////////// Prologue End //////////////
OnProlEnd:
    if (playerattached())
        getexp 200000, 50000;
    changemusic("029-9", "steam.ogg");
    mapannounce("029-9", "##1##BA huge sound is heard from the basement.", 0);
    $@FIRESOFSTEAM_BOSS=2;
    enablenpc "#029-9_91_26";  // To Moubootaur
    // Cleanup previous data (if any)
    $@FOS_ISB=0;
    $@FOS_MOB=0;
    .Support1=0;
    .Support2=0;
    .Support3=0;
    .Support4=0;
    .Support5=0;
    maptimer2("029-9", 10000, "Book#FoS::OnMFMark");
    maptimer2("029-9", 18000, "Book#FoS::OnMFScene");
    // Ensure Andrei Sakar is at his place and stunned
    unitwarp($@FOS_AND, "029-9", 39, 21);
    sc_start(SC_STUN, INT_MAX, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, $@FOS_AND);
    // Bring on the Gemini Assassins
    .Support1=monster("029-9", 38, 21, "Valia", Sagratha, 1);
    .Support2=monster("029-9", 40, 21, "Luvia", Luvia, 1);
    sc_start(SC_STUN, INT_MAX, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .Support1);
    sc_start(SC_STUN, INT_MAX, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .Support2);
    setunitdata($@FOS_AND, UDT_MAXHP,    999999);
    setunitdata($@FOS_AND, UDT_HP,       999999);
    setunitdata(.Support1, UDT_MAXHP,    999999);
    setunitdata(.Support1, UDT_HP,       999999);
    setunitdata(.Support2, UDT_MAXHP,    999999);
    setunitdata(.Support2, UDT_HP,       999999);
    sleep(18000+100); // Wait for cutscene to start + latebloomers
    .@c = getunits(BL_PC|BL_MER|BL_HOM, .@players, MAX_CYCLE_PC, "029-9");
    for (.@i = 0; .@i < .@c; .@i++) {
        sc_start(SC_STUN, 18000, 1, 10000,
                 SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .@players[.@i]);
    }
    sleep(100);
    //////////////////////////////////////////////////////////////
    unittalk(.Support1, "...I'm sorry!");
    sleep(1000);
    unittalk(.Support2, "...But Isbamuth told us to kill you!");
    sleep(1000);
    unittalk(.Support1, "...Die for us!");
    sleep(1000);
    unitkill($@FOS_AND); // DEAD
    $@FOS_AND=0;
    maptimer2("029-9", 3000, "Book#FoS::OnMFShake");
    sleep(3200); // Dramatic Silence
    mapannounce("029-9", "##1##BGRRRRRRRRR!!!!", 0);
    sleep(800);
    mapannounce("029-9", "##1##BHUMANS!!!!", 0);
    sleep(2000);
    unittalk(.Support2, "Sister, we should go.");
    sleep(3000);
    unittalk(.Support1, "...Yes, sister, let's go!");
    sleep(3000);
    unitwarp(.Support1, "029-9", 130, 32);
    unitwarp(.Support2, "029-9", 131, 32);
    sleep(1000); // Dramatic Silence
    unitkill(.Support1);
    unitkill(.Support2);
    $@FOS_MOB=monster("029-9", 39, 36, "Moubootaur (Sealed)", MobMoubootaur, 1, "Book#FoS::OnEventEnd");
    sc_start(SC_STUN, 31000, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, $@FOS_MOB);
    sleep(1000); // Dramatic Silence
    unittalk($@FOS_MOB, "##1Who dares awake me from my slumber...");
    sleep(3000);
    unittalk($@FOS_MOB, "##1It was just a few nights since I turned a nearby town in Mouboos for their insolence...");
    sleep(5000);
    maptimer2("029-9", 2000, "Book#FoS::OnMFShake");
    sleep(2000);
    unittalk($@FOS_MOB, "##1AND YOU DARE TO NOT LEARN YOUR LESSON?? %%e");
    sleep(2000);
    unittalk($@FOS_MOB, "##1USELESS, UNWORTHY CREATURES!! %%e");
    sleep(6000);
    unittalk($@FOS_MOB, "##1I SHALL TURN THIS WHOLE WORLD INTO MOUBOOS...");
    sleep(6000);
    unittalk($@FOS_MOB, "##1THE PROPHECY... OF MY RETURN... IS FULFILLED AT LEAST!!");
    .@avg=$@FIRESOFSTEAM_DIFF*13/10; // Moubootaur: +30% bonus (+30~60 lvls)
    // Reconfigure the monster (otherwise it is night immortal)
    setunitdata($@FOS_MOB, UDT_LEVEL, .@avg);
    setunitdata($@FOS_MOB, UDT_STR, 1+.@avg*3/4);
    setunitdata($@FOS_MOB, UDT_AGI, 1+.@avg*3/4);
    setunitdata($@FOS_MOB, UDT_VIT, 1+.@avg*3/4);
    setunitdata($@FOS_MOB, UDT_INT, 1+.@avg*3/4);
    setunitdata($@FOS_MOB, UDT_DEX, 1+.@avg*3/4);
    setunitdata($@FOS_MOB, UDT_LUK, 1+.@avg*3/4);
    setunitdata($@FOS_MOB, UDT_ADELAY, 1472);
    setunitdata($@FOS_MOB, UDT_ATKRANGE, 4);
    // Battle Status
    setunitdata($@FOS_MOB, UDT_MAXHP,    .@avg*1350);
    setunitdata($@FOS_MOB, UDT_HP,       .@avg*1350);
    setunitdata($@FOS_MOB, UDT_ATKMIN,   .@avg*6);
    setunitdata($@FOS_MOB, UDT_ATKMAX,   .@avg*8);
    setunitdata($@FOS_MOB, UDT_DEF,      12+.@avg*5/3);
    setunitdata($@FOS_MOB, UDT_MDEF,     1+.@avg);
    setunitdata($@FOS_MOB, UDT_HIT,      .@avg*18); // Advised: x18
    setunitdata($@FOS_MOB, UDT_FLEE,     .@avg*4); // Advised: x5
    setunitdata($@FOS_MOB, UDT_CRIT,     60+.@avg*4/3);
    // Reconfigure the AI
    .@opt=getunitdata($@FOS_MOB, UDT_MODE);
    // Disable looting
    if (.@opt & MD_LOOTER)
        .@opt=.@opt^MD_LOOTER;
    // Add knockback immunity
    .@opt=.@opt|MD_NOKNOCKBACK;
    // Mark as boss
    .@opt=.@opt|MD_BOSS;
    // Mark as aggressive
    .@opt=.@opt|MD_AGGRESSIVE;
    .@opt=.@opt|MD_ANGRY;
    // Make it more op
    .@opt=.@opt|MD_DETECTOR;
    .@opt=.@opt|MD_CASTSENSOR_CHASE;
    .@opt=.@opt|MD_CASTSENSOR_IDLE;
    .@opt=.@opt|MD_CHANGECHASE;
    .@opt=.@opt|MD_CHANGETARGET_MELEE;
    .@opt=.@opt|MD_CHANGETARGET_CHASE;
    setunitdata($@FOS_MOB, UDT_MODE, .@opt);
    sleep(1000);
    mapannounce("029-9", "##1##BON YOUR MARKS...", 0);
    sleep(2000);
    mapannounce("029-9", "##1##B3...", 0);
    sleep(1000);
    mapannounce("029-9", "##1##B2...", 0);
    sleep(1000);
    mapannounce("029-9", "##1##B1...", 0);
    sleep(1000);
    mapannounce("029-9", "##1##BBEGIN!!", 0);
    .Support3=monster("029-9", 25, 29, "Magic Commander", Moubi, 1);
    .Support4=monster("029-9", 53, 29, "Army Commander", BloodyMouboo, 1);
    .Support5=monster("029-9", 39, 45, "Mouboo Governor", AlphaMouboo, 1);
    setunitdata(.Support3, UDT_MAXHP,    .@avg*300);
    setunitdata(.Support3, UDT_HP,       .@avg*300);
    setunitdata(.Support4, UDT_MAXHP,    .@avg*300);
    setunitdata(.Support4, UDT_HP,       .@avg*300);
    setunitdata(.Support5, UDT_MAXHP,    .@avg*300);
    setunitdata(.Support5, UDT_HP,       .@avg*300);
    setunitdata(.Support3, UDT_RACE,     RC_Legendary);
    setunitdata(.Support4, UDT_RACE,     RC_Legendary);
    setunitdata(.Support5, UDT_RACE,     RC_Legendary);
    initnpctimer;
    changemusic("029-9", "Arabesque.ogg");
    end;

////////////// Player's Victory //////////////
OnEventEnd:
    stopnpctimer;
    changemusic("029-9", "Misty_Shrine.ogg");
    enablenpc "#029-9_97_49";  // Exit
    enablenpc "#029-9_103_48"; // To Storage
    enablenpc "#029-9_34_23";  // From Moubootaur
    enablenpc "#029-9_137_41"; // From Storage
    maptimer2("029-9", 10, "Book#FoS::OnMFSurvive");
    mapannounce("029-9", "Moubootaur : ##1##BThis is not the place...", 0);
    sleep(2000);
    mapannounce("029-9", "Moubootaur : ##1##BMy powers are weak here...", 0);
    sleep(2000);
    mapannounce("029-9", "Moubootaur : ##1##BHowever... I know where I must go.", 0);
    sleep(3000);
    mapannounce("029-9", "Moubootaur : ##1##BThe prophecy... LIVES!", 0);
    sleep(3000);
    // XXX Reward cycle XXX
    // This can be slow, beware
    .@c = getunits(BL_PC, .@players, MAX_CYCLE_PC);
    for (.@i = 0; .@i < .@c; .@i++) {
        attachrid(.@players[.@i]);
        if ($FIRESOFSTEAM >= 10) {
            getexp 50000+($@FIRESOFSTEAM_DIFF*10), 5000+$@FIRESOFSTEAM_DIFF;
        } else {
            getexp 1000000, 250000;
            getitem StrangeCoin, 200;
            Mobpt+=500000;
            Zeny+=250000;
        }
        dispbottom l("Congratulations! You've received participation rewards due to the Moubootaur Death.");
        detachrid();
    }
    if ($FIRESOFSTEAM < 10) {
        kamibroadcast("The Moubootaur has been awakened. The gears of destiny are on motion.", "Jesusalva");
        sleep(5000);
        kamibroadcast("Great calamity shall soon befall upon this world.", "Jesusalva");
        sleep(5000);
        kamibroadcast("But if we all fight together, we might have a chance!", "Saulc");
        sleep(5000);
        kamibroadcast("At due time... The Secret of Mana will be revealed.", "Jesusalva");
        sleep(5000);
        kamibroadcast("May the apocalypse begin: The revelation of this world!", "Jesusalva");
        kamibroadcast("MOUBOOTAUR LEGENDS, FIFTH ACT - THE WORLD'S CURSE");
        $FIRESOFSTEAM=10;
        $GAME_STORYLINE=4;
        $MANA_BLVL-=5; // Set level to 15~25
        $MANA_JLVL-=5; // Set job level to 10
        $MANA_BINT-=15; // Set min. int to 15
        disablenpc "Andrei Sakar";
        setnpcdisplay("Andrei Sakar#FoS290", "Elora#FoS290", NPC_HUMAN_FEMALE_NOOB);
        setnpcdisplay("Andrei Sakar#FoS298", "Elora#FoS298", NPC_HUMAN_FEMALE_NOOB);
        disablenpc "Elora";
    }
    $@FIRESOFSTEAM_BOSS=0;
    $@FIRESOFSTEAM_DIFF=0;
    end;

////////////// Map Broadcast //////////////
OnMFAndreiMagic:
    .@stat=max(1, 5-((100-$@FIRESOFSTEAM_DIFF)/30));
    dispbottom col(l("Enemies stunned!"), 3);
    dispbottom col(l("All Stats temporarily raised!"), 2);
    dispbottom l("Andrei Sakar used magic: %s", b(l("Triumph of the Eternals")));
    sc_start(SC_INCALLSTATUS, .boostime, .@stat, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK);
    end;

OnMFMark:
    dispbottom col(l("On your marks..."), 1);
    end;

OnMFScene:
    if (!isin("029-9", 20, 20, 60, 50))
        warp "029-9", rand2(33,34), rand2(24,26);
    end;

OnMFShake:
    sshake();
    closeclientdialog;
    sleep2(1000);
    sshake();
    sshake();
    closeclientdialog;
    end;

OnMFDispose:
    if (ispcdead() && getq(General_Narrator) >= 20) warp("025-2", 100, 27);
    end;

OnMFSurvive:
    dispbottom l("Mission accomplished. Well played!");
    getitem StrangeCoin, max(1, 1+(($@FIRESOFSTEAM_DIFF-100)/30));
    if (!MOUBOOTAUR_WINNER)
        MOUBOOTAUR_WINNER=gettimetick(2);
    end;

////////////// Heartbeat //////////////
OnTimer15000:
    maptimer2("029-9", 10, "Book#FoS::OnMFDispose");
    sleep(30);
    if (getmapusers("029-9") < 1) goto L_Defeat;
    // Main cycle
    if ($@FIRESOFSTEAM_BOSS == 1) {
        monster("029-9", 102, 47, "Assassin", Assassin, 1);
    } else if ($@FIRESOFSTEAM_BOSS == 2) {
        // Handle Moubootaur Magic
        // But only if .Support3 was defined (control variable)
        if (!.Support3) {initnpctimer; end;}
        // Spawn a fiend
        .@m=monster("029-9", 39, 36, "Mouboo", Mouboo, 1);
        setunitdata(.@m, UDT_RACE, RC_Legendary);
        .@hp=getunitdata(.@m, UDT_MAXHP)*$@FIRESOFSTEAM_DIFF/80;
        .@op=getunitdata(.@m, UDT_MODE);
        .@op=.@op|MD_AGGRESSIVE;
        setunitdata(.@m, UDT_MAXHP,    .@hp);
        setunitdata(.@m, UDT_HP,       .@hp);
        setunitdata(.@m, UDT_MODE,     .@op);
        // Select random magic from arsenal
        .@r=rand2(16);
        switch (.@r) {
        case 1:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Bleeding", 0);
            areasc2("029-9", 40, 35, 20, 15000, SC_BLOODING, BL_PC, 1);
            break;
        case 2:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Blind", 0);
            areasc2("029-9", 40, 35, 20, 15000, SC_BLIND, BL_PC, 1);
            break;
        case 3:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Lag", 0);
            areasc2("029-9", 40, 35, 20, 15000, SC_CONFUSION, BL_PC, 1);
            break;
        case 4:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Curse", 0);
            areasc2("029-9", 40, 35, 20, 15000, SC_CURSE, BL_PC, 1);
            break;
        case 5:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Poison", 0);
            areasc2("029-9", 40, 35, 20, 15000, SC_POISON, BL_PC, 1);
            break;
        case 6:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Sleep", 0);
            areasc2("029-9", 40, 35, 20, 15000, SC_SLEEP, BL_PC, 1);
            break;
        case 7:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Deadly Poison", 0);
            areasc2("029-9", 40, 35, 20, 15000, SC_DPOISON, BL_PC, 1);
            break;
        case 8:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Chilling", 0);
            areasc2("029-9", 40, 35, 20, 15000, SC_COLD, BL_PC, 1);
            break;
        case 9:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Burning", 0);
            areasc2("029-9", 40, 35, 20, 15000, SC_BURNING, BL_PC, 1);
            break;
        case 10:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Fear", 0);
            areasc2("029-9", 40, 35, 20, 15000, SC_FEAR, BL_PC, 1);
            break;
        case 11:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Obliterate", 0);
            rectharm($@FOS_MOB, 7, 7, rand2(700, 900), HARM_MISC, Ele_Holy, "filter_always", BL_PC | BL_MER | BL_HOM);
            break;
        case 12:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Disarm Homun", 0);
            areasc2("029-9", 40, 35, 20, 15000, SC_STUN, BL_HOM, 1);
            break;
        case 13:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Exterminate Lesserform", 0);
            rectharm($@FOS_MOB, 7, 7, rand2(800, 1400), HARM_MISC, Ele_Holy, "filter_always", BL_MER | BL_HOM);
            break;
        case 14:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Summon Reinforcement", 0);
            for (.@i=0;.@i <= rand2(4);.@i++) {
                .@m=monster("029-9", rand2(35,43), rand2(35,38), "Reinforcement",
                    any(AlphaMouboo, Moubi, BloodyMouboo, Moubi), 1);
                setunitdata(.@m, UDT_RACE, RC_Legendary);
                .@hp=getunitdata(.@m, UDT_MAXHP)*$@FIRESOFSTEAM_DIFF/60;
                setunitdata(.@m, UDT_MAXHP,    .@hp);
                setunitdata(.@m, UDT_HP,       .@hp);
            }
            break;
        case 15:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Wizcat", 0);
            for (.@i=0;.@i <= 2+rand2(7);.@i++) {
                .@m=monster("029-9", rand2(35,43), rand2(35,38),
                    "Reinforcement", BlackCat, 1);
                setunitdata(.@m, UDT_RACE, RC_Legendary);
                .@hp=getunitdata(.@m, UDT_MAXHP)*$@FIRESOFSTEAM_DIFF/70;
                setunitdata(.@m, UDT_MAXHP,    .@hp);
                setunitdata(.@m, UDT_HP,       .@hp);
            }
            break;
        case 16:
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Nuke", 0);
            rectharm($@FOS_MOB, 14, 14, rand2(450, 750), HARM_MISC, Ele_Holy, "filter_always", BL_PC | BL_MER | BL_HOM);
            break;
        default: // case 0
            mapannounce("029-9", "Moubootaur : ##BAncient Magic: Seal", 0);
            areasc2("029-9", 40, 35, 20, 15000, SC_SILENCE, BL_PC, 1);
            break;
        }
        sleep(rand2(45000)); // Wait a bit longer between magic (random)
    }
    initnpctimer;
    end;

////////////// Player's Defeat //////////////
OnDefeat:
L_Defeat:
    $@FIRESOFSTEAM_BOSS=0;
    $@FIRESOFSTEAM_DIFF=0;
    $@FOS_ISB=0;
    $@FOS_MOB=0;
    $@FOS_AND=0;
    .Support1=0;
    .Support2=0;
    .Support3=0;
    .Support4=0;
    .Support5=0;
    killmonsterall("029-9");
    kamibroadcast("The players were defeated at Fires of Steam Showdown.", "Fires of Steam");
    enablenpc "#029-9_97_49";  // Exit
    enablenpc "#029-9_91_26";  // To Moubootaur
    enablenpc "#029-9_103_48"; // To Storage
    enablenpc "#029-9_34_23";  // From Moubootaur
    enablenpc "#029-9_137_41"; // From Storage
    stopnpctimer;
    end;

OnInit:
    .boostime = 900000;
    .subitime = 47000;
    .distance = 5;
    .sex = G_OTHER;
    end;
}