summaryrefslogtreecommitdiff
path: root/npc/030-4/mana_battery.txt
blob: 8fd59ab1846130f1cf3a80ea419a685d08ddd508 (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
030-4,32,21,0	script	AniManOMat	NPC400,{
    $@XmasBattleStatusClone = 0;
    callfunc "XmasStates";
    @xmas_battle_side = 0;
    if ($@XmasBattleCoolDown)
        goto L_CoolDown;
    if (@xmas_side)
        @xmas_battle_side = 1;
    if ($@XmasBattleStatus)
        goto L_BattleInProgress;
    if (@xmas_state < $@xmas_boss_door_open_state)
        goto L_ThrowOut;
    if ((@xmas_boss_start) && (@xmas_state > $@xmas_boss_door_open_state))
        goto L_Helper;
    if (@xmas_state == $@xmas_boss_door_open_state)
        goto L_InitiateBattle;
    goto L_InitiateBattle;

L_InitiateBattle:
    callfunc "XmasSetBossStart";
    if(@xmas_battle_side)
        goto L_BattleBad;
    goto L_BattleGood;

L_BattleBad:
    mesn l("Balthasar");
    mes "\"So this is where this whole shallow charade will end...\"";
    mes "\"Good. Are you ready to get this over with?\"";
    menu
        "Huh? Sure, why not.", L_KeepGoing,
        "Wait a sec.", L_close,
        "Well... since you ask... I prefer to leave now, this is way to dangerous. I have responsibities.", L_Coward;

L_KeepGoing:
    mesn l("Balthasar");
    mes "\"Okay now listen closely, at least for once.\"";
    mes "\"Put the mana battery into that vessel in front of you.\"";
    next;
    menu
        "Ok.", L_YeahOk,
        "No way, I prefer to leave. Now!", L_Coward,
        "Give me a second, I need to consider my options.", L_close;

L_YeahOk:
    mes "You carefully install the Mana Battery as good as you can manage.";
    mes "As you bend over, you notice a strong sulphur odour coming from the crate";
    next;
    mesn l("Balthasar");
    mes "\"Ok. now this should be enough.\"";
    mes "\"Get out of here, before the bomb explodes!.\"";
    menu
        "Agreed.", L_StartBad,
        "You know what? If I pull this lever this should become HUGE! (Beware! that's dangerous)", L_StartBadHard;

L_BattleGood:
    mes "You stare into a box that even through your unexperienced eyes looks less than secure to harbour such a powerful device as the mana battery is.";
    menu
        "Ok, this should be where the battery belongs.", L_StartGood,
        "No WAY! I am not going to put my life in danger", L_close,
        "Ok that does it, I am going to leave! I cannot be responsible for blowing up the entire mana world.", L_Coward,
        "I studied magic and this looks all wrong. (Beware! that's dangerous)", L_StartGoodHard;

L_StartGood:
    if ($@XmasBattleStatus)
        goto L_BattleInProgress;
    @xmas_battle_status = 1;
    goto L_Start;

L_StartGoodHard:
    if ($@XmasBattleStatus)
        goto L_BattleInProgress;
    callsub S_CheckHardReq;
    delitem $@xmas_boss_req$[ @xmas_battle_side ], $@xmas_boss_amount[ @xmas_battle_side ];
    mes "You pour a handfull of " + $@xmas_boss_req$[@xmas_battle_side] + " over the Mana Battery.";
    @xmas_battle_status = 2;
    goto L_Start;

L_StartBad:
    if ($@XmasBattleStatus)
        goto L_BattleInProgress;
    @xmas_battle_status = 3;
    goto L_Start;

L_StartBadHard:
    if ($@XmasBattleStatus)
        goto L_BattleInProgress;
    callsub S_CheckHardReq;
    delitem $@xmas_boss_req$[ @xmas_battle_side ], $@xmas_boss_amount[ @xmas_battle_side ];
    mes "You pour a handfull of " + $@xmas_boss_req$[@xmas_battle_side] + " over the Mana Battery.";
    @xmas_battle_status = 4;
    goto L_Start;

L_Start:
    mes "You struggle a little with your task, since the mana battery doesn't seem to fit in as smooth as you expected it.";
    next;
    mes "W00t!";
    next;
    mes "Now it is glowing wildly";
    next;
    mes "it seems like this will not turn out as planned, Look this Guard of Honour is going crazy!";
    next;
    npctalk strnpcinfo(0), "The Guards are out of control!";
    if ($@XmasBattleStatus)
        goto L_BattleAlreadyStarted;
    $@XmasBattleStatus = @xmas_battle_status;
    $@XmasBattleStatusClone = $@XmasBattleStatus;
    $@XmasBossRound = 0;
    $@XmasBossPlayerCount = getmapusers("030-4");
    areamonster "030-4", 20, 21, 40, 40, "", 1114, 1, "AniManOMat::OnGuardDeath";
    initnpctimer;
    goto L_close;

L_ThrowOut:
    // if the player didnt get a bomb yet
    mes "This looks dangerous. Come back when you are prepared";
    next;
    warp "030-2",151,25;
    goto L_close;

L_Coward:
    //Player chose to cancel
    mes "What a pitty now you still have a bomb in your hands but...";
    mes "As you wish.";
    next;
    warp "030-2",151,25;
    goto L_close;

L_Helper:
    //Player used up his own chance to start
    mes "mmh the AniManOMat is empty again, maybe we should try with a different mana battery.";
    menu
        "No I prefer to leave now, get me out of here.", L_Quit,
        "Wait let me check if i can fix this ...(Beware!)", L_Repeat,
        "Why would I do that? Aaaah... Nevermind.", L_close;

L_Repeat:
    //Player wants to try again on hard mode again
    if ($@XmasBattleStatus)
        goto L_BattleInProgress;
    callsub S_CheckHardReq;
    delitem $@xmas_boss_req$[ @xmas_battle_side ], $@xmas_boss_amount[ @xmas_battle_side ];
    @xmas_battle_status = (2 * (@xmas_battle_side)) + 2;
    goto L_Start;

L_Quit:
   warp "030-2",151,25;
   goto L_close;

L_CoolDown:
    mes "The AniManOMat is too hot to handle right now, you should wait a bit to try a new battery.";
    menu
        "No I prefer to leave now, get me out of here.", L_Quit,
        "Ughhh, but I'm certain this time the battery will work!", L_close;

L_BattleInProgress:
    mes "The mana battery looks like it is about to explode. You better take cover!";
    goto L_close;

L_BattleAlreadyStarted:
    mes "Seems like someone was faster than you.";
    goto L_close;

L_close:
    callsub S_ClearVariables;
    close;

    // per NPC logic
OnTimer5000:
    setnpctimer 0;
    if ($@XmasBattleStatus)
        goto L_CaveLogic;
    goto L_CleanUp;

L_Return_1:
    $@XmasBossPlayerCount = 0;
    areatimer 0, "030-4", 0, 0, 60, 60, 10, "AniManOMat::OnTick";
    end;

L_CaveLogic:
    if ($@XmasBossPlayerCount < 1)
        goto L_AllDead;
    set $@BombTimer, $@BombTimer + 5; // Advance 5 seconds
    if ((mobcount("030-4", "AniManOMat::OnGuardDeath") + 1) == 0)
        goto L_NextWave;
    if ($@BombTimer >= 120)
        goto L_NextWave;
    goto L_Return_1;

L_NextWave:
    $@BombTimer = 0;
    $@DangerCellNumber = rand(8);
    $@XmasBossRound = $@XmasBossRound + 1;
    if (($@XmasBossRound > 10)  && ((mobcount("030-4", "AniManOMat::OnGuardDeath") + 1) == 0))
        goto L_Finished;
    // Break/LastChance(s)
    if (($@XmasBossRound > 10)  && ($@XmasBossRound <= 16))
        goto L_Return_1;
    //KillerWaves
    if ($@XmasBossRound > 16)
        areamonster "030-4", 0, 0, 50, 50, "", 1114, $@XmasBossRound*2 + $@XmasBossPlayerCount*3, "AniManOMat::OnGuardDeath";
    //Normal Waves 1 to 10
    // Guard Amount doubles if on hard mode
    $@GuardAmount = 1 + (6 + ($@XmasBossRound) + (2 * $@XmasBossPlayerCount)) / 7;
    $@SkullAmount = 1 + ($@GuardAmount * $@GuardAmount) / 4;

    if ($@GuardAmount > 15)
        $@GuardAmount = 15;

    //Obliatory Guard Of Honour in the Southern Hallway
    areamonster "030-4", 30, 43, 39, 49, "", 1114, $@GuardAmount, "AniManOMat::OnGuardDeath";
    //CopperSlimes, I love Copper Slimes anywhere anytime
    areamonster "030-4", 20, 21, 49, 49, "", 1098, rand(2,7), "AniManOMat::OnGuardDeath";
    //IceSkulls for hard mode in room 3 and 4
    if ($@XmasBattleStatus == 2 || $@XmasBattleStatus == 4)
        areamonster "030-4", 20, 32, 28, 39, "", 1085, $@SkullAmount / 2, "AniManOMat::OnGuardDeath";
    if ($@XmasBattleStatus == 2 || $@XmasBattleStatus == 4)
        areamonster "030-4", 41, 32, 49, 39, "", 1085, $@SkullAmount / 2 + 1, "AniManOMat::OnGuardDeath";
    //Angry Sea Slimes for Easy Mode in Nice Version in Room 3,4,5,6
    if ($@XmasBattleStatus == 1)
        areamonster "030-4", 20, 32, 28, 49, "", 1109, $@SkullAmount, "AniManOMat::OnGuardDeath";
    if ($@XmasBattleStatus == 1)
        areamonster "030-4", 41, 32, 49, 49, "", 1109, $@SkullAmount, "AniManOMat::OnGuardDeath";
    //Candied Slimes for Nice Mode in Rooms 1 and 2
    if ($@XmasBattleStatus == 1 || $@XmasBattleStatus == 2)
        areamonster "030-4", 20, 21, 28, 28, "", 1111, ($@XmasBossRound / 2) + 1, "AniManOMat::OnGuardDeath";
    if ($@XmasBattleStatus == 1 || $@XmasBattleStatus == 2)
        areamonster "030-4", 41, 21, 49, 28, "", 1111, ($@XmasBossRound / 2) + 2, "AniManOMat::OnGuardDeath";
    //Bluepars for Easy mode in Naughty Variant in Rooms 3,4,5,6
    if ($@XmasBattleStatus == 3)
        areamonster "030-4", 20, 32, 28, 49, "", 1107, $@SkullAmount, "AniManOMat::OnGuardDeath";
    if ($@XmasBattleStatus == 3)
        areamonster "030-4", 41, 32, 49, 49, "", 1107, $@SkullAmount, "AniManOMat::OnGuardDeath";
    // Wicked Mushrooms for Naughty Mode in Rooms 1 and 2
    if ($@XmasBattleStatus == 3 || $@XmasBattleStatus == 4)
        areamonster "030-4", 20, 21, 28, 28, "", 1106, $@XmasBossRound + ($@XmasBossRound / 2), "AniManOMat::OnGuardDeath";
    if ($@XmasBattleStatus == 3 || $@XmasBattleStatus == 4)
        areamonster "030-4", 41, 21, 49, 28, "", 1106, $@XmasBossRound + ($@XmasBossRound / 2), "AniManOMat::OnGuardDeath";

    $@msgnumber = (2 * $@XmasBossRound) + (($@XmasBattleStatus - 1) >> 1);
    $@msg$ = $@XmasBossMes$[ $@msgnumber ];
    $@msgnumber = 0;
    if ($@XmasBossRound > 10) goto L_Return_1;
    callsub S_Announce;
    goto L_Return_1;

OnTick:
    if (ispcdead()) end;
    $@XmasBossPlayerCount = $@XmasBossPlayerCount + 1;
    if(isin("030-4", $@DangerCellX1[$@DangerCellNumber], $@DangerCellY1[$@DangerCellNumber], $@DangerCellX2[$@DangerCellNumber], $@DangerCellY2[$@DangerCellNumber]))
        goto L_DangerCell;
    end;

L_DangerCell:
    message strcharinfo(0), "Target Aquired. Locking on Now.";
    misceffect 10001, strcharinfo(0);
    heal ((MaxHp/100) * -20), 0;
    end;

OnGuardDeath:
    end;

L_AllDead:
    $@msg$ = $@xmas_final_announce$[ ($@XmasBattleStatus - 1) / 2 ];
    callsub S_Announce;
    goto L_CleanUp;

L_Finished:
    $@msg$ = $@xmas_final_announce$[ (($@XmasBattleStatus - 1) / 2) + 2 ];
    callsub S_Announce;
    goto L_CleanUp;

L_CleanUp:
    areatimer 0, "030-4", 0, 0, 50, 50, 10, "AniManOMat::OnReward";
    $@XmasBossPlayerCount = 0;
    $@XmasBossRound = 0;
    $@BombTimer = 0;
    $@GuardAmount = 0;
    $@SkullAmount = 0;
    killmonster "030-4", "AniManOMat::OnGuardDeath";
    stopnpctimer;
    donpcevent "#XmasChamberCooler::OnCommandCoolDown";
    end;

OnReward:
    if (ispcdead())
        end;
    if (($@XmasBattleStatusClone % 2) == 0)
        XMASTIME = XMASTIME | $@xmas_boss_hero_bit;
    @xmas_state = (XMASTIME & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT;
    @bonus = (55 - (BaseLevel / 2));
    DailyQuestBonus = DailyQuestBonus + @bonus;
    message strcharinfo(0), "You feel a temporary rush of power and zest for action.";
    if (@xmas_state != $@xmas_boss_door_open_state )
        goto L_End;
    @xmas_state = $@xmas_reward_start;
    callfunc "XmasSetState";
    @xmas_state = 0;
    @karma_bonus = $@xmas_boss_bonus;
    message strcharinfo(0), "Wow, what happened here?.";
    goto L_End;

L_End:
    if ((($@XmasBattleStatus - 1) / 2) == 0) goto L_EndNice;
    goto L_EndNaughty;

L_EndNaughty:
    callfunc "XmasNaughty";
    callsub S_ClearVariables;
    end;

L_EndNice:
    callfunc "XmasNice";
    callsub S_ClearVariables;
    end;

OnCommandChamberReset:
    areatimer 0, "030-4", 0, 0, 50, 50, 10, "AniManOMat::OnReward";
    $@XmasBattleStatus = 0;
    $@XmasBossPlayerCount = 0;
    $@XmasBossRound = 0;
    $@BombTimer = 0;
    $@GuardAmount = 0;
    $@SkullAmount = 0;
    killmonster "030-4", "AniManOMat::OnGuardDeath";
    stopnpctimer;
    setnpctimer 0;
    goto L_Restart;

OnInit:
    goto L_Restart;

L_Restart:
    $@XmasBattleStatus = 0;
    setarray $@XmasBossMes$,
    "", // unused
    "", // unused
    "Scrrreeeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaaatch",
    "Scrrreeeeeeeeeeeeeeeeeeeeeaaaaaaaaaaaaaaaaaaaaatch",
    "Avalia : I am getting a weird sensation ... ",
    "Balthasar : I think they know what we are up to!",
    "Avalia : Oh no! This is going to blow up",
    "Balthasar : The Door is locked you idiot, fight for your life.",
    "Avalia : Guards of Honor I demand you: STOP!",
    "Balthasar : Okay, this is somewhat funny... why are they coming back?!?",
    "Avalia : You brave fighters! Deactivate the nutcrackers! they are out of control!",
    "Balthasar : The good news is: if we make it this time we will never have to do that again!",
    "Avalia : Oh boy we are so screwed.",
    "Balthasar : Report: I am an Idiot",
    "Avalia : Quick, we need to kill the nutcrackers, before they ruin everything we've been working for.",
    "Balthasar : Strange they are getting more and not less.",
    "Avalia : Oh no, they are too powerful. Fight my warriors, Fight for the spirit of Christmas.",
    "Balthasar : If I was smart enough to stop talking, it would have happened already..",
    "Avalia : I cannot believe it, this is making them stronger. More and more of them are coming.",
    "Balthasar : I think we are almost done, the bomb should explode any second.",
    "Avalia : Those poor creatures. Just kill them all.",
    "Balthasar : A N Y  S E C O N D.",
    "Avalia : Oh well... just try again, I trust in you.",
    "Balthasar : just lol.",
    "Avalia : Wow! You saved christmas.",
    "Balthasar : Yep, it's over... and strange enough you survived.";

    setarray $@xmas_final_announce$,
        "Avalia : Oh no, not only did you slay half my Guard of Honour, but also the issue was not fixed, try to install the battery again!",
        "Balthasar : Boy are you lame. So what now? The battery is still not placed! Go try again!",
        "Avalia : W00t you actually made it through. I think now that the manabattery lost some of its abundant power this seems to have given those nutcrackers that didn't go crazy a good boost of life energy. Thank you for your help all and come see me for a reward.",
        "Balthasar : Good. They are dead. Now GET OUT OF THERE, this bomb is dangerous!";
    // Danger Cells to attack sitters
    // 0: 19,20,29,29
    // 1: 30,20,40,29
    // 2: 41,20,50,29
    // 3: 19,31,29,40
    // 4: 30,31,40,40
    // 5: 41,31,50,40
    // 6: 19,42,29,50
    // 7: 30,42,40,50
    // 8: 41,42,50,50
    setarray $@DangerCellX1, 19, 30, 41, 19, 30, 41, 19, 30, 41;
    setarray $@DangerCellY1, 20, 20, 20, 31, 31, 31, 42, 42, 42;
    setarray $@DangerCellX2, 29, 40, 50, 29, 40, 50, 29, 40, 50;
    setarray $@DangerCellY2, 29, 29, 29, 40, 40, 40, 50, 50, 50;
    end;

S_Announce:
    mapannounce "030-4", "Danger Cell Activated. Zone " + $@DangerCellNumber + " activated.", 0;
    mapannounce "030-4", $@msg$, 0;
    mapannounce "030-2", $@msg$, 0;
    $@msg$ = "";
    return;

S_CheckHardReq:
    if (BaseLevel < $@BossHardLevel)
        goto L_NotHighEnough;
    if (countitem($@xmas_boss_req$[ @xmas_battle_side ]) < $@xmas_boss_amount[ @xmas_battle_side ])
        goto L_NotEnoughItems;
    goto L_Return;

L_NotEnoughItems:
    mes "Nono, you need to bring " + $@xmas_boss_amount[ @xmas_battle_side ] + " " + $@xmas_boss_req$[ @xmas_battle_side ] + "s.";
    goto L_close;

L_NotHighEnough:
    mes "\"Err no sweetie, you don't. just do it the normal way.\"";
    goto L_close;

L_Return:
    return;

S_ClearVariables:
    @xmas_battle_side = 0;
    @bonus = 0;
    @xmas_state = 0;
    @xmas_battle_status = 0;
    @karma_bonus = 0;
    return;
}

030-4,0,0,0	script	#XmasChamberCooler	NPC32767,{
    end;
OnCommandCoolDown:
    $@XmasBattleStatus = 0;
    $@XmasBattleCoolDown = 1;
    initnpctimer;
    end;

OnTimer120000:
    $@XmasBattleCoolDown = 0;
    stopnpctimer;
    end;
}