1#textdomain wesnoth-did
2
3[scenario]
4    id=09_A_Small_Favor3
5    name= _ "A Small Favor — Part 3"
6    map_data="{campaigns/Descent_Into_Darkness/maps/09_A_Small_Favor3.map}"
7    {TURNS 21 18 15}
8    next_scenario=10_Alone_at_Last
9    victory_when_enemies_defeated=no
10
11    {UNDERGROUND}
12
13    {SCENARIO_MUSIC       the_city_falls.ogg}
14    {EXTRA_SCENARIO_MUSIC the_king_is_dead.ogg}
15
16    # No story; this occurs immediately after the previous scenario
17
18    # wmllint: validate-off
19    [side]
20        side=1
21        controller=human
22        gold=0
23        team_name=intruders
24        user_team_name= _ "Intruders"
25        {FLAG_VARIANT undead}
26
27        income=-2
28
29        # wmllint: recognize Malin Keshar
30        {CHARACTER_STATS_MALIN_KESHAR}
31
32        shroud=yes
33        share_maps=yes
34        facing=nw
35    [/side]
36    # wmllint: validate-on
37
38    [side]
39        side=2
40        controller=ai
41        team_name=defenders
42        user_team_name= _ "Defenders"
43        no_leader=yes
44        hidden=yes
45
46        # Book guards
47        {NAMED_NOTRAIT_UNIT 2 (Silver Mage) 11 9 ("") ( _ "Guardian")} {GUARDIAN}
48        {NAMED_NOTRAIT_UNIT 2 (Silver Mage) 13 7 ("") ( _ "Guardian")} {GUARDIAN}
49
50        [ai]
51            village_value=0
52            aggression=0.8
53        [/ai]
54    [/side]
55
56    [side]
57        side=3
58        controller=ai
59        team_name=intruders
60        user_team_name= _ "Intruders"
61        no_leader=yes
62        color=black
63        hidden=yes
64        shroud=yes
65        share_maps=no
66
67        [ai]
68            village_value=0
69            aggression=0.8
70            [goal]
71                name=protect_unit
72                [criteria]
73                    side=3
74                    canrecruit=yes
75                [/criteria]
76                value=5
77            [/goal]
78            [goal]
79                name=protect_unit
80                [criteria]
81                    id=Darken Volk
82                [/criteria]
83                protect_radius=6
84                value=20
85            [/goal]
86        [/ai]
87    [/side]
88    # City guard
89    [side]
90        side=4
91        controller=ai
92        team_name=defenders
93        user_team_name= _ "Defenders"
94        no_leader=yes
95        hidden=yes
96        color=green
97        [ai]
98            village_value=0
99            aggression=0.8
100        [/ai]
101    [/side]
102
103    # This macro places the doors and adds the door-opening event
104    {MANOR_DOORS 1,3}
105
106    # scenery
107
108    {PLACE_IMAGE items/dragonstatue.png 23 16}
109    {PLACE_IMAGE items/dragonstatue.png 24 15}
110    {PLACE_IMAGE items/dragonstatue.png 31 12}
111    {PLACE_IMAGE scenery/monolith2.png 34 11}
112    {PLACE_IMAGE scenery/monolith3.png 29 14}
113    {PLACE_IMAGE scenery/monolith1.png 29 16}
114    {PLACE_IMAGE scenery/monolith3.png 26 15}
115    {PLACE_IMAGE scenery/monolith4.png 26 18}
116    {PLACE_IMAGE scenery/castle-ruins2.png 32 15}
117    {PLACE_IMAGE scenery/castle-ruins3.png 32 14}
118    {PLACE_IMAGE scenery/castle-ruins3.png 25 15}
119    {PLACE_IMAGE scenery/castle-ruins2.png 24 18}
120    {PLACE_IMAGE scenery/castle-ruins.png 33 4}
121    {PLACE_IMAGE scenery/castle-ruins3.png 33 3}
122    {PLACE_IMAGE scenery/castle-ruins2.png 31 5}
123    {PLACE_IMAGE scenery/castle-ruins2.png 9 11}
124    {PLACE_IMAGE scenery/castle-ruins.png 8 7}
125
126    {PLACE_IMAGE items/ornate2.png 23 11}
127    {PLACE_IMAGE items/ornate2.png 25 12}
128    {PLACE_IMAGE items/ornate1.png 20 13}
129    {PLACE_IMAGE items/coffin-open.png 22 12}
130
131    {PLACE_IMAGE items/cloak-green.png 11 17}
132    {PLACE_IMAGE items/armor.png 14 16}
133    {PLACE_IMAGE items/armor.png 16 16}
134    {PLACE_IMAGE items/bow.png 30 9}
135    {PLACE_IMAGE items/bow-crystal.png 29 9}
136    {PLACE_IMAGE items/spear-fancy.png 27 10}
137    {PLACE_IMAGE items/axe.png 27 9}
138
139    {PLACE_IMAGE items/potion-blue.png 18 3}
140    {PLACE_IMAGE items/potion-blue.png 17 6}
141    {PLACE_IMAGE items/potion-grey.png 17 3}
142    {PLACE_IMAGE items/potion-grey.png 19 4}
143    {PLACE_IMAGE items/potion-grey.png 21 5}
144    {PLACE_IMAGE items/potion-green.png 19 5}
145    {PLACE_IMAGE items/potion-green.png 22 3}
146    {PLACE_IMAGE items/potion-red.png 19 3}
147    {PLACE_IMAGE items/potion-red.png 14 3}
148    {PLACE_IMAGE items/potion-yellow.png 17 4}
149    {PLACE_IMAGE items/altar-evil.png 18 4}
150    {PLACE_IMAGE items/altar.png 14 8}
151    {PLACE_IMAGE items/holy-water.png 14 9}
152    {PLACE_IMAGE items/holy-water.png 14 7}
153    {PLACE_IMAGE items/holy-water.png 15 8}
154    {PLACE_IMAGE items/holy-water.png 10 8}
155    {PLACE_IMAGE items/stone-tablet.png 7 11}
156    {PLACE_IMAGE items/stone-tablet.png 15 10}
157
158    {PLACE_IMAGE items/dragonstatue.png 19 7}
159    {PLACE_IMAGE scenery/monolith2.png 16 11}
160    {PLACE_IMAGE scenery/monolith2.png 21 7}
161    {PLACE_IMAGE scenery/monolith3.png 19 9}
162    {PLACE_IMAGE scenery/monolith1.png 12 4}
163    {PLACE_IMAGE scenery/monolith1.png 9 12}
164    {PLACE_IMAGE scenery/monolith3.png 10 7}
165    {PLACE_IMAGE scenery/monolith4.png 10 11}
166    {PLACE_IMAGE scenery/monolith4.png 4 10}
167
168    {PLACE_IMAGE items/barrel.png 29 17}
169    {PLACE_IMAGE items/barrel.png 28 17}
170    {PLACE_IMAGE items/barrel.png 28 13}
171    {PLACE_IMAGE items/barrel.png 22 19}
172    {PLACE_IMAGE items/barrel.png 21 19}
173    {PLACE_IMAGE items/barrel.png 29 8}
174    {PLACE_IMAGE items/barrel.png 30 7}
175    {PLACE_IMAGE items/barrel.png 14 17}
176    {PLACE_IMAGE items/barrel.png 34 4}
177    {PLACE_IMAGE items/barrel.png 23 3}
178    {PLACE_IMAGE items/box.png 29 13}
179    {PLACE_IMAGE items/box.png 22 18}
180    {PLACE_IMAGE items/box.png 13 18}
181    {PLACE_IMAGE items/box.png 13 17}
182    {PLACE_IMAGE items/box.png 28 4}
183    {PLACE_IMAGE items/box.png 27 5}
184    {PLACE_IMAGE items/box.png 26 5}
185
186    [event]
187        name=prestart
188
189        # place the book's image
190        [item]
191            location_id=book_start
192            image="items/book5.png"
193        [/item]
194
195        [objectives]
196            side=1
197            [objective]
198                condition=win
199                description= _ "Retrieve the book and escape"
200            [/objective]
201            [objective]
202                condition=lose
203                description= _ "Death of Malin Keshar"
204            [/objective]
205            [objective]
206                condition=lose
207                description= _ "Death of Darken Volk"
208            [/objective]
209
210            {TURNS_RUN_OUT}
211
212            [gold_carryover]
213                bonus=no
214                carryover_percentage=100
215            [/gold_carryover]
216        [/objectives]
217
218        [set_variables]
219            name=guardtypetable
220            [value]
221                type=Shock Trooper
222            [/value]
223#ifndef HARD
224            [value]
225                type=Spearman
226            [/value]
227#endif
228            [value]
229                type=Duelist
230            [/value]
231            [value]
232                type=Pikeman
233            [/value]
234            [value]
235                type=Swordsman
236            [/value]
237#ifndef EASY
238            [value]
239                type=Swordsman
240            [/value]
241            [value]
242                type=Pikeman
243            [/value]
244            [value]
245                type=Duelist
246            [/value]
247#endif
248            [value]
249                type=Heavy Infantryman
250            [/value]
251            [value]
252                type=Spearman
253            [/value]
254            [value]
255                type=Fencer
256            [/value]
257        [/set_variables]
258
259        [set_variables]
260            name=magetypetable
261            [value]
262                type=Mage
263            [/value]
264            [value]
265                type=White Mage
266            [/value]
267            [value]
268                type=Mage
269            [/value]
270            [value]
271                type=Red Mage
272            [/value]
273            [value]
274                type=Red Mage
275            [/value]
276#ifdef EASY
277            [value]
278                type=Mage
279            [/value]
280#endif
281#ifndef EASY
282            [value]
283                type=White Mage
284            [/value]
285            [value]
286                type=Red Mage
287            [/value]
288#endif
289#ifdef HARD
290            [value]
291                type=Red Mage
292            [/value]
293            [value]
294                type=White Mage
295            [/value]
296#endif
297            [value]
298                type=Mage
299            [/value]
300            [value]
301                type=Mage
302            [/value]
303            [value]
304                type=Mage
305            [/value]
306        [/set_variables]
307
308        [random_placement]
309            num_items={ON_DIFFICULTY 5 6 7}
310            variable=loc
311            min_distance=3
312            [filter_location]
313                terrain=Urb,Urb^E*,Ur,Ur^E*
314                [not]
315                    x=27-35
316                    y=1-7
317                [/not]
318                [not]
319                    x=20-35
320                    y=16-20
321                [/not]
322                [not]
323                    x=25-29
324                    y=13-20
325                [/not]
326                [not]
327                    x=30-35
328                    y=11-20
329                [/not]
330                [not]
331                    [filter][/filter]
332                [/not]
333            [/filter_location]
334            [command]
335                {NAMED_NOTRAIT_UNIT 2 "$guardtypetable[$($loc.n % $guardtypetable.length)].type" $loc.x $loc.y () (_ "Guard")} {GUARDIAN}
336            [/command]
337        [/random_placement]
338        [random_placement]
339            num_items={ON_DIFFICULTY 6 6 7}
340            variable=loc
341            min_distance=3
342            [filter_location]
343                terrain=Urb,Urb^E*,Ur,Ur^E*,Irs,Irs^*
344                [not]
345                    x=27-35
346                    y=1-7
347                [/not]
348                [not]
349                    x=20-35
350                    y=16-20
351                [/not]
352                [not]
353                    x=25-29
354                    y=13-20
355                [/not]
356                [not]
357                    x=30-35
358                    y=11-20
359                [/not]
360                [not]
361                    [filter][/filter]
362                [/not]
363            [/filter_location]
364            [command]
365                {NAMED_NOTRAIT_UNIT 2 "$magetypetable[$($loc.n % $magetypetable.length)].type" $loc.x $loc.y () (_ "Mage")} {GUARDIAN}
366            [/command]
367        [/random_placement]
368
369        # Who has the book?
370        {VARIABLE hasBook none}
371
372        # Switch Volk's side
373        [recall]
374            id=Darken Volk
375            x,y=26,16
376        [/recall]
377
378        [store_unit]
379            [filter]
380                id=Darken Volk
381            [/filter]
382            kill=yes
383            variable=stored_Darken
384        [/store_unit]
385
386        {VARIABLE stored_Darken.side         3}
387        {VARIABLE stored_Darken.canrecruit yes}
388
389        {CLEAR_VARIABLE stored_Darken.ellipse}
390
391        [unstore_unit]
392            variable=stored_Darken
393        [/unstore_unit]
394
395        {CLEAR_VARIABLE stored_Darken}
396
397        [lock_view][/lock_view]
398    [/event]
399
400    [event]
401        name=start
402
403        [store_unit]
404            [filter]
405                [filter_wml]
406                    [variables]
407                        got_inside_manor=yes
408                    [/variables]
409                [/filter_wml]
410            [/filter]
411
412            kill=yes
413            variable=units_inside_manor
414        [/store_unit]
415
416        [foreach]
417            array=units_inside_manor
418            [do]
419                [unstore_unit]
420                    variable=this_item
421                    find_vacant=no
422                [/unstore_unit]
423
424                [modify_unit]
425                    [filter]
426                        id=$this_item.id
427                    [/filter]
428
429                    [object]
430                        duration=scenario
431                        [effect]
432                            apply_to=loyal
433                        [/effect]
434                    [/object]
435                [/modify_unit]
436
437                [recall]
438                    id=$this_item.id
439                [/recall]
440
441                [redraw]
442                    clear_shroud=yes
443                    side=1
444                [/redraw]
445            [/do]
446        [/foreach]
447
448        {CLEAR_VARIABLE units_inside_manor}
449
450        # Create DV's units
451        {GENERIC_UNIT 3 (Spectre)    26 16}
452        [+unit]
453            animate=yes
454        [/unit]
455
456        {GENERIC_UNIT 3 (Deathblade) 26 16}
457        [+unit]
458            animate=yes
459        [/unit]
460
461        {GENERIC_UNIT 3 (Necrophage) 26 16}
462        [+unit]
463            animate=yes
464        [/unit]
465
466        {GENERIC_UNIT 3 (Banebow)    26 16}
467        [+unit]
468            animate=yes
469        [/unit]
470
471        [message]
472            speaker=Darken Volk
473            message= _ "The book is very close, somewhere to the northwest."
474        [/message]
475
476        [unlock_view][/unlock_view]
477    [/event]
478
479    [event]
480        name=side 3 turn refresh
481        first_time_only=no
482
483        [store_unit]
484            [filter]
485                id=Darken Volk
486            [/filter]
487            variable=stored_Darken
488        [/store_unit]
489
490        [if]
491            [variable]
492                name=hasBook
493                equals=none
494            [/variable]
495            [then]
496                [if]
497                    [variable]
498                        name=turn_number
499                        greater_than=4
500                    [/variable]
501                    [then]
502                        [store_locations]
503                            location_id=book_start
504                            variable=dest
505                        [/store_locations]
506                    [/then]
507                    [else]
508                        {VARIABLE dest.x 16}
509                        {VARIABLE dest.y 14}
510                    [/else]
511                [/if]
512            [/then]
513            [else]
514                {VARIABLE dest.x 31}
515                {VARIABLE dest.y 1}
516            [/else]
517        [/if]
518
519        [find_path]
520            [traveler]
521                id=Darken Volk
522            [/traveler]
523            [destination]
524                x=$dest.x
525                y=$dest.y
526            [/destination]
527            variable=darken_goto
528            allow_multiple_turns=yes
529        [/find_path]
530
531        [if]
532            [variable]
533                name=darken_goto.step.length
534                greater_than=0
535            [/variable]
536            [then]
537                {VARIABLE index "$(min($stored_Darken.max_moves,$darken_goto.step.length-1))"}
538                {VARIABLE stored_Darken.goto_x $darken_goto.step[$index].x}
539                {VARIABLE stored_Darken.goto_y $darken_goto.step[$index].y}
540            [/then]
541            [else]
542                {VARIABLE stored_Darken.goto_x $dest.x}
543                {VARIABLE stored_Darken.goto_y $dest.y}
544            [/else]
545        [/if]
546
547        [unstore_unit]
548            variable=stored_Darken
549        [/unstore_unit]
550
551        {CLEAR_VARIABLE stored_Darken,dest,darken_goto,index}
552    [/event]
553
554    # If there are no enemies, then DV's troops won't move; this event unblocks the book if necessary.
555    [event]
556        name=side 3 turn refresh
557        first_time_only=no
558        [filter_condition]
559            [variable]
560                name=hasBook
561                equals=none
562            [/variable]
563            [have_unit]
564                # This won't be DV himself, otherwise hasBook is not none.
565                side=3
566                [filter_location]
567                    location_id=book_start
568                [/filter_location]
569            [/have_unit]
570            [not]
571                [have_unit]
572                    # Ignore side=4, the city guard is (hopefully for the player) not near the book.
573                    side=2
574                    [filter_vision]
575                        # There are 3 entrance rooms, one of them might still have all of its doors shut.
576                        side=3
577                    [/filter_vision]
578                [/have_unit]
579            [/not]
580        [/filter_condition]
581        [modify_unit]
582            [filter]
583                [filter_location]
584                    location_id=book_start
585                [/filter_location]
586            [/filter]
587            # Somewhere inside the tunnel, but out-of-the-way for the hexes that Malin must move to.
588            goto_x=29
589            goto_y=2
590        [/modify_unit]
591    [/event]
592
593    # pursuer spawns
594
595#define SPAWN_GUARD
596    [random_placement]
597        num_items=1
598        variable=loc
599        min_distance=1
600        [filter_location]
601            x=33-34,35
602            y=17-18,18-19
603            [not]
604                [filter][/filter]
605            [/not]
606        [/filter_location]
607        [command]
608            [set_variable]
609                name=ind
610                rand=1..$guardtypetable.length
611            [/set_variable]
612            {VARIABLE_OP ind sub 1}
613            {GENERIC_UNIT 4 "$guardtypetable[$ind].type" $loc.x $loc.y}
614            {CLEAR_VARIABLE ind}
615        [/command]
616    [/random_placement]
617#enddef
618#define SPAWN_MAGE
619    [random_placement]
620        num_items=1
621        variable=loc
622        min_distance=1
623        [filter_location]
624            x=33-34,35
625            y=17-18,18-19
626            [not]
627                [filter][/filter]
628            [/not]
629        [/filter_location]
630        [command]
631            [set_variable]
632                name=ind
633                rand=1..$magetypetable.length
634            [/set_variable]
635            {VARIABLE_OP ind sub 1}
636            {GENERIC_UNIT 4 "$magetypetable[$ind].type" $loc.x $loc.y}
637            {CLEAR_VARIABLE ind}
638        [/command]
639    [/random_placement]
640#enddef
641
642    [event]
643        name=new turn
644        first_time_only=no
645
646        [if]
647            [variable]
648                name=turn_number
649                greater_than_equal_to={ON_DIFFICULTY 14 12 10}
650            [/variable]
651            [then]
652                {RANDOM 0..2}
653                [switch]
654                    variable=random
655                    [case]
656                        value=0
657                        {SPAWN_GUARD}
658                        {SPAWN_GUARD}
659                    [/case]
660                    [case]
661                        value=1
662                        {SPAWN_MAGE}
663#ifdef HARD
664                        {SPAWN_MAGE}
665#else
666                        {SPAWN_GUARD}
667#endif
668                    [/case]
669                    [case]
670                        value=2
671                        {SPAWN_GUARD}
672                        {SPAWN_MAGE}
673                    [/case]
674                [/switch]
675            [/then]
676            [elseif]
677                [variable]
678                    name=turn_number
679                    greater_than_equal_to={ON_DIFFICULTY 8 7 6}
680                [/variable]
681                [then]
682                    [set_variable]
683                        name=turn_mod
684                        value=$("($turn_number - {ON_DIFFICULTY 8 7 6}) % 2")
685                    [/set_variable]
686                    [if]
687                        [variable]
688                            name=turn_mod
689                            numerical_equals=0
690                        [/variable]
691                        [then]
692                            {RANDOM 0..3}
693                            [switch]
694                                variable=random
695                                [case]
696                                    value=0
697                                    {SPAWN_GUARD}
698#ifdef HARD
699                                    {SPAWN_GUARD}
700#endif
701                                [/case]
702                                [case]
703                                    value=1
704                                    {SPAWN_GUARD}
705                                    {SPAWN_GUARD}
706                                [/case]
707                                [case]
708                                    value=2
709                                    {SPAWN_MAGE}
710                                [/case]
711                                [case]
712                                    value=3
713                                    {SPAWN_GUARD}
714                                    {SPAWN_MAGE}
715                                [/case]
716                            [/switch]
717                        [/then]
718                    [/if]
719                    {CLEAR_VARIABLE turn_mod}
720                [/then]
721            [/elseif]
722            [elseif]
723                [variable]
724                    name=turn_number
725                    greater_than_equal_to=2
726                [/variable]
727                [then]
728                    [set_variable]
729                        name=turn_mod
730                        value=$("($turn_number - 2) % 3")
731                    [/set_variable]
732                    [if]
733                        [variable]
734                            name=turn_mod
735                            numerical_equals=0
736                        [/variable]
737                        [then]
738                            {RANDOM 0..3}
739                            [switch]
740                                variable=random
741                                [case]
742                                    value=0
743                                    {SPAWN_GUARD}
744                                    {SPAWN_GUARD}
745                                [/case]
746                                [case]
747                                    value=1
748                                    {SPAWN_GUARD}
749#ifdef HARD
750                                    {SPAWN_GUARD}
751#endif
752                                [/case]
753                                [case]
754                                    value=2
755                                    {SPAWN_MAGE}
756                                [/case]
757                                [case]
758                                    value=3
759                                    {SPAWN_GUARD}
760                                    {SPAWN_MAGE}
761                                [/case]
762                            [/switch]
763                        [/then]
764                    [/if]
765                    {CLEAR_VARIABLE turn_mod}
766                [/then]
767            [/elseif]
768        [/if]
769
770        [fire_event]
771            name=city guard dialogue
772        [/fire_event]
773        [fire_event]
774            name=city guard dialogue2
775        [/fire_event]
776    [/event]
777
778    [event]
779        name=city guard dialogue
780        [filter_condition]
781            [variable]
782                name=turn_number
783                equals=2
784            [/variable]
785        [/filter_condition]
786
787        [message]
788            speaker=Darken Volk
789            message= _ "The guards continue to pursue us."
790        [/message]
791    [/event]
792    [event]
793        name=city guard dialogue2
794        [filter_condition]
795            [variable]
796                name=turn_number
797                equals={ON_DIFFICULTY 14 12 10}
798            [/variable]
799        [/filter_condition]
800
801        [message]
802            speaker=Malin Keshar
803            message= _ "The guards are catching up to us!"
804        [/message]
805    [/event]
806
807    # Flavor text
808
809    [event]
810        name=moveto
811        [filter]
812            x,y=15,10
813            side=1
814        [/filter]
815        [message]
816            speaker=narrator
817            message= _ "<i>Beware that, when fighting monsters, you yourself do not become a monster...</i>"
818            image=wesnoth-icon.png
819        [/message]
820        [allow_undo][/allow_undo]
821    [/event]
822    [event]
823        name=moveto
824        [filter]
825            x,y=7,11
826            side=1
827        [/filter]
828        [message]
829            speaker=narrator
830            message= _ "<i>Death is the twilight that follows the light of day.
831Life fades with the setting sun into darkness.
832Existence churns and the soul is reborn into endless night.</i>"
833            image=wesnoth-icon.png
834        [/message]
835        [allow_undo][/allow_undo]
836    [/event]
837    [event]
838        name=moveto
839        [filter]
840            x,y=18,4
841            side=1
842        [/filter]
843        [message]
844            speaker=Malin Keshar
845            message= _ "There are quite a few failed potions around here."
846        [/message]
847        [allow_undo][/allow_undo]
848    [/event]
849    [event]
850        name=moveto
851        [filter]
852            x,y=22,12
853            side=1
854        [/filter]
855        [message]
856            speaker=Malin Keshar
857            message= _ "This coffin is empty."
858        [/message]
859        [allow_undo][/allow_undo]
860    [/event]
861
862    [event]
863        # a side 1 unit finds the book
864        name=moveto
865        [filter]
866            side=1
867            canrecruit=no
868            [filter_location]
869                location_id=book_start
870            [/filter_location]
871        [/filter]
872        [filter_condition]
873            [variable]
874                name=hasBook
875                equals=none
876            [/variable]
877        [/filter_condition]
878
879        [message]
880            [filter_location]
881                location_id=book_start
882            [/filter_location]
883            # po: Spoken by a servant of Malin Keshar (dead or alive one).
884            message=_ "I have found the book, master!"
885        [/message]
886
887        [if]
888            [have_unit]
889                [filter_location]
890                    location_id=book_start
891                [/filter_location]
892                race=undead
893            [/have_unit]
894            [then]
895                [message]
896                    id=Malin Keshar
897                    # po: The speaker addresses an undead minion.
898                    message=_ "Good! Guard it with your unlife while I come to fetch it."
899                [/message]
900            [/then]
901            [else]
902                [message]
903                    id=Malin Keshar
904                    # po: The speaker addresses a human or a bat.
905                    message=_ "Good! Guard it with your life while I come to fetch it."
906                [/message]
907            [/else]
908        [/if]
909    [/event]
910
911    [event]
912        # Malin gets the book
913        name=moveto
914        [filter]
915            id=Malin Keshar
916            [filter_location]
917                location_id=book_start
918            [/filter_location]
919        [/filter]
920        [filter_condition]
921            [variable]
922                name=hasBook
923                equals=none
924            [/variable]
925        [/filter_condition]
926
927        [remove_item]
928            location_id=book_start
929        [/remove_item]
930
931        {VARIABLE hasBook Malin}
932
933        [message]
934            speaker=Malin Keshar
935            message= _ "Such an old, worn book. It does not seem like much, but at least we’ve got it now."
936        [/message]
937
938        [message]
939            speaker=Malin Keshar
940            message= _ "... So... how do we get out of here?"
941        [/message]
942
943        [message]
944            speaker=Darken Volk
945            message= _ "There is a small tunnel in the cellar to the northeast. It will lead us far enough out of the city that we can escape pursuit."
946        [/message]
947
948        [objectives]
949            side=1
950            [objective]
951                condition=win
952                description= _ "Escape via the tunnel in the northeast cellar"
953            [/objective]
954            [objective]
955                condition=lose
956                description= _ "Death of Malin Keshar"
957            [/objective]
958            [objective]
959                condition=lose
960                description= _ "Death of Darken Volk"
961            [/objective]
962
963            {TURNS_RUN_OUT}
964
965            [gold_carryover]
966                bonus=no
967                carryover_percentage=100
968            [/gold_carryover]
969        [/objectives]
970
971        [event]
972            name=moveto
973            [filter]
974                id=Malin Keshar
975                x,y=29-32,1-3
976            [/filter]
977
978            [message]
979                speaker=Malin Keshar
980                message= _ "Let’s get out of here."
981            [/message]
982
983            [endlevel]
984                result=victory
985                bonus=no
986                {NEW_GOLD_CARRYOVER 100}
987                carryover_report=no
988            [/endlevel]
989        [/event]
990    [/event]
991
992    [event]
993        # DV gets the book
994        name=moveto
995        [filter]
996            id=Darken Volk
997            [filter_location]
998                location_id=book_start
999            [/filter_location]
1000        [/filter]
1001        [filter_condition]
1002            [variable]
1003                name=hasBook
1004                equals=none
1005            [/variable]
1006        [/filter_condition]
1007
1008        [remove_item]
1009            location_id=book_start
1010        [/remove_item]
1011
1012        {VARIABLE hasBook Darken}
1013
1014        # A second, non-silent, update triggers when DV moves again (next turn, he's still set to go to the book_start hex this turn).
1015        [objectives]
1016            side=1
1017            silent=yes
1018            [objective]
1019                condition=win
1020                description= _ "Escape via the tunnel in the northeast cellar"
1021            [/objective]
1022            [objective]
1023                condition=lose
1024                description= _ "Death of Malin Keshar"
1025            [/objective]
1026            [objective]
1027                condition=lose
1028                description= _ "Death of Darken Volk"
1029            [/objective]
1030
1031            {TURNS_RUN_OUT}
1032        [/objectives]
1033
1034        [event]
1035            name=moveto
1036            [filter]
1037                id=Darken Volk
1038                side=3
1039            [/filter]
1040
1041            [message]
1042                speaker=Malin Keshar
1043                message= _ "We’ve got the book, but how do we get out of here?"
1044            [/message]
1045
1046            [scroll_to_unit]
1047                id=Darken Volk
1048            [/scroll_to_unit]
1049
1050            [delay]
1051                time=500
1052            [/delay]
1053
1054            [message]
1055                speaker=Malin Keshar
1056                message= _ "Wait, you aren’t leaving me behind, are you?"
1057            [/message]
1058
1059            [objectives]
1060                side=1
1061                [objective]
1062                    condition=win
1063                    description= _ "Escape the manor (Malin reaches the tunnel in the northeast cellar before Darken Volk)"
1064                [/objective]
1065                [objective]
1066                    condition=lose
1067                    description= _ "Darken Volk reaches the tunnel before Malin does"
1068                [/objective]
1069                [objective]
1070                    condition=lose
1071                    description= _ "Death of Malin Keshar"
1072                [/objective]
1073                [objective]
1074                    condition=lose
1075                    description= _ "Death of Darken Volk"
1076                [/objective]
1077
1078                {TURNS_RUN_OUT}
1079            [/objectives]
1080        [/event]
1081
1082        [event]
1083            name=moveto
1084            [filter]
1085                id=Darken Volk
1086                x,y=30-31,1
1087            [/filter]
1088
1089            [message]
1090                speaker=Darken Volk
1091                message= _ "You have served me well, boy."
1092            [/message]
1093
1094            [message]
1095                speaker=narrator
1096                image=wesnoth-icon.png
1097                message= _ "As he heads into the tunnel, Darken Volk collapses the entrance, leaving Malin to be captured and executed by the city guards."
1098            [/message]
1099
1100            [endlevel]
1101                result=defeat
1102            [/endlevel]
1103        [/event]
1104
1105        [event]
1106            name=moveto
1107            [filter]
1108                id=Malin Keshar
1109                x,y=29-32,1-3
1110            [/filter]
1111
1112            [message]
1113                speaker=Malin Keshar
1114                message= _ "Let’s get out of here."
1115            [/message]
1116
1117            [endlevel]
1118                result=victory
1119                bonus=no
1120                {NEW_GOLD_CARRYOVER 100}
1121                carryover_report=no
1122            [/endlevel]
1123        [/event]
1124    [/event]
1125
1126    [event]
1127        name=time over
1128
1129        [remove_shroud]
1130            side=1
1131            x=29-33
1132            y=0-4
1133        [/remove_shroud]
1134
1135        [unit]
1136            type=Royal Guard
1137            side=4
1138            x,y=32,2
1139            id=RGuard
1140            canrecruit=yes
1141            animate=yes
1142            facing=sw
1143        [/unit]
1144        {GENERIC_UNIT 4 (Pikeman) 30 2} {FACING sw}
1145        {GENERIC_UNIT 4 (Longbowman) 30 1} {FACING sw}
1146        {GENERIC_UNIT 4 (Swordsman) 31 2} {FACING sw}
1147        {GENERIC_UNIT 4 (Mage of Light) 31 1} {FACING sw}
1148
1149        [message]
1150            speaker=RGuard
1151            message= _ "Surround those necromancers! They cannot escape now!"
1152        [/message]
1153
1154        [endlevel]
1155            result=defeat
1156        [/endlevel]
1157    [/event]
1158
1159    [event]
1160        name=victory
1161
1162        {CLEAR_VARIABLE guardtypetable}
1163        {CLEAR_VARIABLE magetypetable}
1164        {CLEAR_VARIABLE random}
1165        {MODIFY_UNIT (id=Darken Volk) side 1}
1166    [/event]
1167
1168    {HERODEATH_MALIN}
1169    {HERODEATH_VOLK_B}
1170[/scenario]
1171
1172#undef SPAWN_GUARD
1173#undef SPAWN_MAGE
1174