Debian Codegraph @

content/bgkeyring/src/quests/keyring/cutscenes/mage_and_goons.uc

raw
1 /*
2 *
3 * Copyright (C) 2006 The Exult Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 *
20 * This source file contains some functions specific to a cutscene
21 * from the Keyring Quest.
22 *
23 * Author: Marzo Junior
24 * Last Modified: 2006-02-27
25 */
26
27 //Cutscene levels:
28 enum MageAndGoons_levels {
29 BEGIN_CUTSCENE = 1,
30 FADE_SCREEN = 2,
31 CENTER_VIEW = 3,
32 UNFADE_SCREEN = 4,
33 DISPLAY_REGION = 5,
34 MAKE_VISIBLE = 6,
35 GENERATE_SCRIPTS = 7,
36 FIREWORKS_LAURIANNA = 8,
37 GARGOYLE_WARNS = 9,
38 LAUNDO_SPEAKS = 10,
39 BEGIN_COMBAT = 11,
40 PREPARE_NPC = 12
41 };
42
43 void beginCutsceneMageAndGoons object#() () {
44 var mage;
45 var gargoyle;
46 var cyclops;
47 var troll;
48 var fighter;
49 struct<Position> pos;
50 var dir;
51
52 if (event == BEGIN_CUTSCENE) {
53 //Cutscene begins HERE, with item == AVATAR
54
55 //Play music:
56 UI_play_music(21, 0);
57
58 //Cutscene mode :-)
59 AVATAR->trueFreeze();
60 //Create magical effect:
61 pos = get_object_position();
62 UI_sprite_effect(ANIMATION_BLUE_BEADS, pos.x, pos.y, 0, 0, 0, -1);
63
64 //Screen fader:
65 script item after 5 ticks call beginCutsceneMageAndGoons, FADE_SCREEN;
66
67 //Find Laundo:
68 mage = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
69 SHAPE_MAGE_MALE, 80, ID_MAGE_OR_GOON);
70 //Use him to unfade screen and kick-start the rest of the scene:
71 script mage after 10 ticks {
72 nohalt;
73 call beginCutsceneMageAndGoons, CENTER_VIEW;
74 wait 2;
75 call beginCutsceneMageAndGoons, UNFADE_SCREEN;
76 wait 5;
77 call beginCutsceneMageAndGoons, DISPLAY_REGION;
78 }
79 } else if (event == FADE_SCREEN) {
80 //Fade screen to black:
81 UI_fade_palette(12, 1, 0);
82 } else if (event == CENTER_VIEW) {
83 //center around item:
84 center_view();
85 } else if (event == UNFADE_SCREEN) {
86 //Unfade screen:
87 UI_fade_palette(12, 1, 1);
88 } else if (event == DISPLAY_REGION) {
89 //The magical effect of the Gem of Dispelling
90
91 //item == mage
92
93 //Play a sound effect:
94 UI_play_sound_effect2(SOUND_MOONGATE, item);
95
96 //Get each of the mage's goons:
97 gargoyle = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
98 SHAPE_GARGOYLE_WARRIOR, 80, ID_MAGE_OR_GOON);
99 cyclops = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
100 SHAPE_CYCLOPS, 80, ID_MAGE_OR_GOON);
101 troll = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
102 SHAPE_TROLL, 80, ID_MAGE_OR_GOON);
103 fighter = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
104 SHAPE_FIGHTER_MALE, 80, ID_MAGE_OR_GOON);
105
106 //Make Laurianna visible and generate the scripts for the mage and goons:
107 script LAURIANNA after 6 ticks {
108 nohalt;
109 call trueFreeze;
110 call beginCutsceneMageAndGoons, MAKE_VISIBLE;
111 wait 4;
112 call beginCutsceneMageAndGoons, GENERATE_SCRIPTS;
113 }
114
115 //Make the mage and his goons visible:
116 script item after 6 ticks {
117 nohalt;
118 call beginCutsceneMageAndGoons, MAKE_VISIBLE;
119 };
120 script gargoyle after 6 ticks {
121 nohalt;
122 call beginCutsceneMageAndGoons, MAKE_VISIBLE;
123 };
124 script cyclops after 6 ticks {
125 nohalt;
126 call beginCutsceneMageAndGoons, MAKE_VISIBLE;
127 };
128 script troll after 6 ticks {
129 nohalt;
130 call beginCutsceneMageAndGoons, MAKE_VISIBLE;
131 };
132 script fighter after 6 ticks {
133 nohalt;
134 call beginCutsceneMageAndGoons, MAKE_VISIBLE;
135 };
136 } else if (event == MAKE_VISIBLE) {
137 //item varies
138 //Clears DONT_RENDER flag:
139 clear_item_flag(DONT_RENDER);
140 //Play sound effect:
141 UI_play_sound_effect2(110, item);
142 //Show magic bubbles:
143 pos = get_object_position();
144 UI_sprite_effect(ANIMATION_PURPLE_BUBBLES, pos.x, pos.y, 0, 0, 0, -1);
145 } else if (event == GENERATE_SCRIPTS) {
146 //item = LAURIANNA
147
148 //Make Laurianna have fireworks around her:
149 script LAURIANNA call beginCutsceneMageAndGoons, FIREWORKS_LAURIANNA;
150
151 //Get references for the mage and his goons:
152 mage = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
153 SHAPE_MAGE_MALE, 80, ID_MAGE_OR_GOON);
154 gargoyle = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
155 SHAPE_GARGOYLE_WARRIOR, 80, ID_MAGE_OR_GOON);
156 cyclops = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
157 SHAPE_CYCLOPS, 80, ID_MAGE_OR_GOON);
158 troll = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
159 SHAPE_TROLL, 80, ID_MAGE_OR_GOON);
160 fighter = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
161 SHAPE_FIGHTER_MALE, 80, ID_MAGE_OR_GOON);
162
163 //Laundo's script; he casts a couple spells and wonders why they failed; then,
164 //he turns to the Avatar and begins to talk:
165 script mage {
166 wait 2;
167 actor frame cast_up;
168 wait 2;
169 actor frame cast_out;
170 wait 2;
171 actor frame cast_up;
172 wait 2;
173 actor frame cast_out;
174 wait 2;
175 say "@An Sanct Ort!@";
176 wait 2;
177 actor frame standing;
178 wait 2;
179 actor frame cast_up;
180 wait 2;
181 actor frame cast_out;
182 wait 2;
183 actor frame cast_up;
184 wait 2;
185 actor frame cast_out;
186 wait 2;
187 say "@An Ort Sanct!@";
188 wait 2;
189 actor frame standing;
190 wait 2;
191 face east;
192 say "@Damn! Why doesn't it work?@";
193 wait 18;
194 say "@The spell is correct!@";
195 wait 18;
196 say "@It -should- work!@";
197 wait 18;
198 say "@Something -must- protect her!@";
199 wait 34;
200 say "@What?!@";
201 wait 18;
202 say "@Intruders?!?@";
203 wait 20;
204 say "@I'll talk to them!@";
205 wait 12;
206 call beginCutsceneMageAndGoons, LAUNDO_SPEAKS;
207 }
208
209 //Agra-Lem's script. He patrols around until he sees the Avatar and gang;
210 //then he sounds the alarm:
211 script gargoyle {
212 repeat 4 {
213 step west;
214 wait 2;
215 };
216 actor frame standing;
217 wait 1;
218 face north;
219 wait 1;
220 face east;
221 wait 1;
222 repeat 5 {
223 step east;
224 wait 2;
225 };
226 actor frame standing;
227 wait 1;
228 face north;
229 wait 1;
230 face west;
231 wait 1;
232 repeat 2 {
233 step west;
234 wait 2;
235 };
236 actor frame standing;
237 wait 1;
238 face north;
239 wait 1;
240 actor frame standing;
241 repeat 3 {
242 step north;
243 wait 2;
244 };
245 actor frame standing;
246 wait 1;
247 face east;
248 wait 1;
249 face south;
250 wait 1;
251 repeat 4 {
252 step south;
253 wait 2;
254 };
255 wait 2;
256 say "@!!!@";
257 wait 6;
258 say "@To see intruders!@";
259 repeat 2 {
260 step west;
261 wait 2;
262 };
263 call beginCutsceneMageAndGoons, GARGOYLE_WARNS;
264 }
265
266 //The cyclop's script. He just plays a game of Dragon, Sword, Gold
267 //with the troll:
268 script cyclops {
269 actor frame raise_1h;
270 wait 4;
271 say "@Dragon...@";
272 actor frame ready;
273 wait 4;
274 actor frame raise_1h;
275 wait 4;
276 say "@... sword...@";
277 actor frame ready;
278 wait 4;
279 actor frame raise_1h;
280 wait 4;
281 say "@... gold!@";
282 actor frame strike_1h;
283 wait 4;
284 actor frame standing;
285 wait 8;
286 say "@Damn!@";
287 wait 56;
288 say "@Yer cheatin'!@";
289 wait 18;
290 say "@Yer winnin' always!@";
291 wait 22;
292 say "@Huh?@";
293 }
294
295 //The troll's script. He just plays a game of Dragon, Sword, Gold
296 //with the cyclops:
297 script troll {
298 wait 5;
299 actor frame raise_1h;
300 wait 4;
301 say "@Dragon...@";
302 actor frame ready;
303 wait 4;
304 actor frame raise_1h;
305 wait 4;
306 say "@... sword...@";
307 actor frame ready;
308 wait 4;
309 actor frame raise_1h;
310 wait 4;
311 say "@... gold!@";
312 actor frame strike_1h;
313 wait 4;
314 actor frame standing;
315 wait 6;
316 say "@Haha! My sword...@";
317 wait 18;
318 say "@... kills yer dragon!@";
319 wait 18;
320 say "@I win again!@";
321 wait 22;
322 say "@Am not!@";
323 wait 18;
324 say "@Yer too dumb!@";
325 wait 14;
326 face east;
327 say "@Intruders? Kill!@";
328 }
329
330 //The human is having second doubts, but he is there for
331 //the money anyway...
332 script fighter {
333 wait 4;
334 say "@What am I doing here?@";
335 wait 10;
336 say "@I mean, look who is around...@";
337 face north;
338 wait 16;
339 say "@One dumb troll...@";
340 wait 16;
341 say "@... a dumber cyclops...@";
342 wait 16;
343 say "@... one pissed-off gargoyle...@";
344 face east;
345 wait 16;
346 say "@... and a mad mage.@";
347 wait 20;
348 say "@The only good thing...@";
349 wait 16;
350 say "@... is the gold I get.@";
351 wait 24;
352 say "@Intruders? Where?@";
353 }
354 } else if (event == FIREWORKS_LAURIANNA) {
355 //item = LAURIANNA
356 //This portion of the function is looped over and over
357 //again until Laundo's death halts it.
358 //Creates fireworks around Laurianna:
359 pos = LAURIANNA->get_object_position();
360 UI_sprite_effect(ANIMATION_FIREWORKS, pos.x, pos.y, 0, 0, 0, -1);
361 //Loop:
362 script item after 10 ticks call beginCutsceneMageAndGoons, FIREWORKS_LAURIANNA;
363 } else if (event == GARGOYLE_WARNS) {
364 //item = gargoyle
365 //Gargoyle sounds the alarm:
366 script item {
367 say "@To see intruders!@";
368 wait 12;
369 say "@To believe intruders...@";
370 wait 12;
371 say "@... to see us too!@";
372 }
373
374 //A party member reacts to it:
375 script randomPartyMember() after 20 ticks say "@Ooops...@";
376 } else if (event == LAUNDO_SPEAKS) {
377 //Laundo begins talking to Avatar:
378 KEYRING_ENEMY->show_npc_face(LAUNDO_FACE);
379 say("@Hey! Thou there! Who art thou?@");
380 //Laundo demands Avatar's name...
381 var choice = askForResponse([getAvatarName(), "Avatar", "None of thy business"]);
382 if (choice == "Avatar") {
383 say("The mage whispers to his companions. @I think we are safe. This one seems mad.@");
384 } else if (choice == "None of thy business") {
385 say("@A fiery spirit! I like that! No, wait -- I don't.@ He adds menacingly.");
386 } else {
387 say("@Bah, thy name is not really important and means nothing to me.@");
388 }
389 //...rapid-fires a lot of questions without giving time for answers...
390 say("@-I- am the archmage Laundo. Now, who art thou?");
391 say("@No, wait -- I have already asked that. What did I want to ask again?");
392 say("@Ah, yes! How didst thou -- a mere mortal -- dispel my warding spells?");
393 say("@And what art thou doing in my tower?");
394 say("@Wait -- I am -not- in my tower! Regardless, what art thou doing here?");
395 say("@Come now, speak quickly! Shouldst thou speak not, I shall kill thee where thou standest!");
396 say("@Won't thou say anything? Hast thou a death wish?");
397 say("@I am in the middle of an experiment! I don't have time for this! Speak or die!@");
398 //...and is warned by Agra-Lem of his behaviour:
399 const int GARGOYLE_FACE = -262;
400 GARGOYLE_FACE.say("The gargoyle interrupts. @Master! To not be letting intruder speak!@");
401 GARGOYLE_FACE.hide();
402 say("@Ah, thou art correct, Agra-lem. Go on, peasant! Speak! I shall listen.");
403 say("@Perhaps thou shalt amuse me before dying...@ he adds, sounding hopeful.");
404 add(["name", "job", "bye", "dispel", "tower", "Doing here", "rescue", "experiment", "Laurianna", "Rooted woman"]);
405
406 converse (0) {
407 case "name" (remove):
408 say("@-I- am the archmage Laundo. Now, who art thou?");
409 say("@No, wait -- I have already asked that. Never mind.@");
410
411 case "job" (remove):
412 say("He looks at you with impatience. @I am a mage! An -arch-mage!@");
413 add("archmage");
414
415 case "archmage" (remove):
416 say("He gives you an exasperated look. @A mage so powerful he transcends other mages!");
417 say("@And I am one! Hahaha! Behold my powers and beware!@");
418
419 case "bye" (remove):
420 say("@Not so fast, peasant! Thou didst not tell me what thou art doing here!@");
421
422 case "dispel" (remove):
423 say("@Yes, I want to know how a nothing like thee dispelled my protection spells!");
424 say("@Wilt thou tell me or wilt thou die?@");
425 if (chooseFromMenu2(["tell", "die"]) == 2) {
426 //Quickest way to end the talk:
427 break;
428 }
429 AVATAR.say("You quickly explain about the Gem of Dispelling to Laundo.");
430 AVATAR.hide();
431 say("@Gems of Dispelling? Never heard of them. It doesn't matter anyway.@");
432
433 case "tower" (remove):
434 say("@Yes, I have a tower. All wizards have one. But I want a -castle- instead.@");
435 add("castle");
436
437 case "castle" (remove):
438 say("@I mean castle British, of course. None others are worthy!");
439 say("@But alas, I must first slay that tyrant British to have his castle...@");
440 add("Tyrant British");
441
442 case "Doing here" (remove):
443 say("@Wilt thou tell me what art doing here?@");
444 if (chooseFromMenu2(["rescue", "lie"]) == 1) {
445 say("@I am sorry to say thou hast wasted thy time. That mad mage sent thee on a wild goose chase.");
446 } else {
447 say("@I am sorry to say thou art wasting my time. I can feel the touch of that mad mage upon thee!");
448 }
449 say("@In any case, thou wilt fail to rescue this mageling! She is mine!@");
450 add("fail", "mad mage");
451 remove("rescue");
452
453 case "rescue" (remove):
454 say("@I am sorry to say thou hast wasted thy time. That mad mage sent thee on a wild goose chase.");
455 say("@In any case, thou wilt fail to rescue this mageling! She is mine!@");
456 add("fail", "mad mage");
457 remove("Doing here");
458
459 case "fail" (remove):
460 say("@Yes, thou wilt fail. By which I mean thou shalt die if thou dost try to rescue her.");
461 say("@And even if thou survivest, she will not be going anywhere...");
462 say("@Seest thou the necklace she wears? It is -my- handiwork.@");
463 add("necklace");
464
465 case "mad mage" (remove):
466 say("@Yes, that mage that wants to keep this menace alive!@ he points towards Laurianna.");
467 say("@He wants to keep that -beast- alive! And he helps people! He is -mad-!");
468 say("@With all the power he has, he could -- I mean, -should- -- kill the tyrant British!@");
469 add("Tyrant British");
470
471 case "Laurianna" (remove):
472 say("@Who? Never heard of her.@");
473 AVATAR.say("You explain that Laurianna is the woman with roots just nearby.");
474 AVATAR.hide();
475 say("@Ah, so -that- is her name? Well, it doesn't matter. She won't be going anywhere.");
476 say("@Seest thou the necklace she wears? It is -my- handiwork.@");
477 add("necklace");
478
479 case "necklace" (remove):
480 say("@It is lovely, is it not? It is a mighty artifact!");
481 say("@The person wearing it -- in this case, this dangerous lady here -- cannot move at all from where she is!");
482 say("@Not even magic can move her! And the necklace also cannot be removed! Hah! She shall be here forever!");
483 say("@And the best part is that the necklace will simply -explode- should someone powerful enough to dispel its magic");
484 say("@come even -near- it. That keeps that mad mage from trying to rescue her! Isn't it brilliant?");
485
486 case "experiment" (remove):
487 say("@Since thou wilt die anyway, I don't see why not explain the greatness of my plans to thee!");
488 say("@This woman is a menace. She wields enormous power, and has no control over them.");
489 say("@So I intend to give her powers to a worthy receptacle -- -me-!");
490 say("@I can then do what I want with them, and she won't be a menace anymore! Haha!");
491 say("@Of course, then I can remove other menaces from the face of Britannia.");
492 say("@One that comes to mind is that tyrant British. He -must- die!@");
493 add("Tyrant British");
494
495 case "Tyrant British" (remove):
496 say("@Thou knowest, that bloke with a crown which calls himself 'king'");
497 say("@That miserable excuse of a tyrant must perish for his misdeeds!@");
498
499 case "Rooted woman" (remove):
500 say("@Yes, that is an effect of the necklace I made for her. Isn't it lovely?@");
501 add("necklace");
502 }
503
504 //When all options are exhausted (or the player chose the quick rout),
505 //we get to this point:
506 say("@Well, it was interesting. But thou art boring me. So now it is time to die!@");
507
508 //Return view to avatar:
509 script AVATAR {
510 nohalt;
511 call beginCutsceneMageAndGoons, FADE_SCREEN;
512 wait 2;
513 call beginCutsceneMageAndGoons, CENTER_VIEW;
514 wait 3;
515 call beginCutsceneMageAndGoons, UNFADE_SCREEN;
516 wait 3;
517 call beginCutsceneMageAndGoons, BEGIN_COMBAT;
518 wait 3;
519 call trueUnfreeze;
520 };
521 } else if (event == BEGIN_COMBAT) {
522 //item = AVATAR
523 //Get references to the mage and his goons:
524 mage = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
525 SHAPE_MAGE_MALE, 80, ID_MAGE_OR_GOON);
526 gargoyle = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
527 SHAPE_GARGOYLE_WARRIOR, 80, ID_MAGE_OR_GOON);
528 cyclops = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
529 SHAPE_CYCLOPS, 80, ID_MAGE_OR_GOON);
530 troll = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
531 SHAPE_TROLL, 80, ID_MAGE_OR_GOON);
532 fighter = findNearbyMonsterWithID(LAURIANNA->get_object_position(),
533 SHAPE_FIGHTER_MALE, 80, ID_MAGE_OR_GOON);
534
535 //Make them hostile and in combat:
536 script mage {
537 nohalt;
538 call beginCutsceneMageAndGoons, PREPARE_NPC;
539 };
540 script gargoyle {
541 nohalt;
542 call beginCutsceneMageAndGoons, PREPARE_NPC;
543 };
544 script cyclops {
545 nohalt;
546 call beginCutsceneMageAndGoons, PREPARE_NPC;
547 };
548 script troll {
549 nohalt;
550 call beginCutsceneMageAndGoons, PREPARE_NPC;
551 };
552 script fighter {
553 nohalt;
554 call beginCutsceneMageAndGoons, PREPARE_NPC;
555 };
556
557 //Release the Avatar from cutscene mode:
558 } else if (event == PREPARE_NPC) {
559 //item varies
560 //Make npc hostile:
561 set_alignment(2);
562 //Puts him in combat mode:
563 set_schedule_type(IN_COMBAT);
564 //Just to be sure:
565 clear_item_flag(DONT_RENDER);
566 }
567
568 }
569
570 void registerDeathOfMageOrGoon object#() () {
571 if ((event == DEATH) && (get_npc_id() == ID_MAGE_OR_GOON)) {
572 if (get_item_shape() == SHAPE_MAGE_MALE) {
573 //Laundo has died
574 //Set flag:
575 gflags[MAGE_KILLED] = true;
576 //Halt the fireworks around Laurianna:
577 LAURIANNA->halt_scheduled();
578 }
579 //This is called whenever the mage or one of his goons die
580 //Removes the mage/goon from tournament mode:
581 clear_item_flag(SI_TOURNAMENT);
582 //Kill them:
583 reduce_health(50, MAGIC_DAMAGE);
584 //Increase Laurianna's NPC ID:
585 var new_id = 1 + LAURIANNA->get_npc_id();
586 LAURIANNA->set_npc_id(new_id);
587
588 if (new_id == 5) {
589 LAURIANNA->set_npc_id(5);
590 //Everyone is dead; halt scripts for Laurianna:
591 LAURIANNA->halt_scheduled();
592 //Prepare the next portion of the quest:
593 script LAURIANNA after 20 ticks call Laurianna, CLEAR_FLAGS;
594 }
595 }
596 }