1#textdomain wesnoth-sotbe
2[scenario]
3    id=11_Clash_of_Armies
4    name= _ "Clash of Armies"
5    map_data="{campaigns/Son_Of_The_Black_Eye/maps/11_Clash_of_Armies.map}"
6    turns=24
7
8    {DEFAULT_SCHEDULE_SECOND_WATCH}
9
10    next_scenario=12_Giving_Some_Back
11
12    {SCENARIO_MUSIC "battle.ogg"}
13    {EXTRA_SCENARIO_MUSIC "the_city_falls.ogg"}
14
15    [event]
16        name=prestart
17        [objectives]
18            side=1
19            [objective]
20                description= _ "Defend Prestim successfully for four days"
21                condition=win
22                show_turn_counter=yes
23            [/objective]
24            [objective]
25                description= _ "You don't control all villages on the north side of the river when turns run out"
26                condition=lose
27            [/objective]
28            [objective]
29                description= _ "Death of Kapou’e"
30                condition=lose
31            [/objective]
32            [objective]
33                description= _ "Death of Grüü"
34                condition=lose
35            [/objective]
36
37            [gold_carryover]
38                bonus=no
39                carryover_percentage=40
40            [/gold_carryover]
41        [/objectives]
42    [/event]
43
44    [side]
45        side=1
46        id="Kapou'e"
47        type=Orcish Leader
48        controller=human
49        team_name=Kapoue
50        user_team_name=_ "Kapou’e"
51        gold=200
52        {BLACK_FLAG}
53    [/side]
54
55    {STARTING_VILLAGES 1 10}
56    {STARTING_VILLAGES_AREA 1 5 5 6}
57    {STARTING_VILLAGES_AREA 1 35 5 6}
58
59    [side]
60        type=Elvish Champion
61        id=Thelarion
62        name= _ "Thelarion"
63        side=2
64        canrecruit=yes
65        facing=sw
66        [ai]
67            aggression=1.0
68            grouping=no
69            village_value=0.0
70            leader_value=50.0
71        [/ai]
72        recruit=Elvish Captain, Elvish Fighter, Elvish Archer, Elvish Marksman, Elvish Druid, Elvish Scout
73        team_name=villains
74        user_team_name=_"Villains"
75        {GOLD 200 200 250}
76        {FLAG_VARIANT wood-elvish}
77    [/side]
78
79    {STARTING_VILLAGES 2 10}
80
81    [side]
82        type=Dwarvish Steelclad
83        id=Darstang
84        name= _ "Darstang"
85        side=3
86        canrecruit=yes
87        [ai]
88            aggression=1.0
89            caution=0.0
90            villages_per_scout=0
91            grouping=no
92            village_value=20
93
94            [aspect]
95                id=recruitment_instructions
96                [facet]
97                    turns=1-2
98                    [value]
99                        [recruit]
100                            type=Gryphon Rider
101                            number=1
102                            importance=1
103                        [/recruit]
104                        [recruit]
105                            importance=0
106                            type=Dwarvish Fighter, Dwarvish Thunderer, Dwarvish Scout, Bandit
107                        [/recruit]
108                    [/value]
109                [/facet]
110                [facet]
111                    turns=3-24
112                    [value]
113                        [recruit]
114                            type=Gryphon Rider
115#ifdef HARD
116                            number=3
117#else
118                            number=2
119#endif
120                            total=yes
121                            importance=1
122                        [/recruit]
123                        [recruit]
124                            importance=0
125                            type=Dwarvish Fighter, Dwarvish Thunderer, Dwarvish Scout, Bandit
126                        [/recruit]
127                    [/value]
128                [/facet]
129            [/aspect]
130        [/ai]
131        recruit=Dwarvish Fighter, Dwarvish Thunderer, Dwarvish Scout, Bandit, Gryphon Rider
132        user_team_name=_"Villains"
133        team_name=villains
134        {GOLD 200 250 300}
135        {FLAG_VARIANT knalgan}
136    [/side]
137
138    {STARTING_VILLAGES 3 11}
139
140    [side]
141        type=General
142        id="Earl Lanbec'h"
143        name= _ "Earl Lanbec’h"
144        profile=portraits/lanbech.png
145        side=4
146        canrecruit=yes
147        facing=sw
148        [ai]
149            aggression=1.0
150            grouping=no
151            leader_value=20
152            village_value=20
153        [/ai]
154        recruit=Swordsman, Red Mage, Pikeman, Heavy Infantryman, Fencer, Bowman
155        team_name=villains
156        user_team_name=_"Villains"
157        {GOLD 200 400 600}
158        {FLAG_VARIANT loyalist}
159    [/side]
160
161    {STARTING_VILLAGES 4 8}
162    {STARTING_VILLAGES_AREA 4 19 31 6}
163
164    [side]
165        side=5
166        [ai]
167            aggression=1.0
168            caution=0.25
169            village_value=10
170        [/ai]
171        team_name=villains
172        user_team_name=_"Villains"
173        no_leader=yes
174    [/side]
175
176    {SOTBE_TRACK {JOURNEY_11_NEW} }
177
178    [event]
179        name=prestart
180
181#define HUMAN_SHIP X Y FACING_VALUE ID_VALUE
182    {GENERIC_UNIT 4 "Transport Galleon" {X} {Y}}
183    [+unit]
184        facing={FACING_VALUE}
185        upkeep=free
186        role="docked transport"
187
188        [variables]
189            transport_num={ID_VALUE}
190            dock_x={X}
191            dock_y={Y}
192        [/variables]
193
194        # Let's make the transports slightly more durable than usual so they're
195        # not as easy to destroy...
196        [modifications]
197            [object]
198                [effect]
199                    apply_to=hitpoints
200                    increase_total=20
201                [/effect]
202            [/object]
203        [/modifications]
204    [/unit]
205#enddef
206
207        {HUMAN_SHIP 24 16 sw 1}
208        {HUMAN_SHIP 14 16 se 2}
209        {HUMAN_SHIP 26 17 sw 3}
210        {HUMAN_SHIP 12 17 se 4}
211
212        [fire_event]
213            name=start_boarding_next_transport
214        [/fire_event]
215
216        [role]
217            type=Orcish Warlord,Troll Warrior,Orcish Warrior,Troll,Orcish Grunt
218            role=cannonfodder
219            [auto_recall]
220                x,y=18,11
221            [/auto_recall]
222        [/role]
223
224        [role]
225            role=cannonfodder2
226            type=Orcish Crossbowman,Orcish Slayer,Orcish Archer,Orcish Assassin
227            [auto_recall]
228                x,y=20,11
229            [/auto_recall]
230        [/role]
231
232        {RENAME_IF_DEAD thelarion_dead Thelarion (_"Telamir")}
233        {RENAME_IF_DEAD darstang_dead Darstang (_"Angthur")}
234    [/event]
235
236    [event]
237        name=start
238
239        [recall]
240            id=Grüü
241        [/recall]
242        [recall]
243            id=Jetto
244        [/recall]
245        [recall]
246            id=Inarix
247        [/recall]
248        [recall]
249            id=Plonk
250        [/recall]
251
252        [message]
253            role=cannonfodder
254            message= _ "So here we are, and they are preparing to assault."
255        [/message]
256
257        [message]
258            speaker="Grüü"
259            message= _ "Prestim’s walls are rock-hard, they’ll waste themselves on them."
260        [/message]
261
262        [message]
263            speaker="Kapou'e"
264            message= _ "I’m not that sure. Every fortress has its own weakness. Prestim’s walls are strong but long and it is difficult to defend them from many directions at once. This Earl Lanbec’h must know they can’t break through by only fording the river where the bridge previously stood so he must have a better plan than that."
265        [/message]
266
267        [message]
268            role=cannonfodder
269            message= _ "We’ve received messengers from the Council, saying that they are gathering tribes into the Great Horde."
270        [/message]
271
272        [message]
273            speaker="Grüü"
274            message= _ "Great! When do they arrive?"
275        [/message]
276
277        [message]
278            role=cannonfodder
279            message= _ "In four days. I fear it will be too late."
280        [/message]
281
282        [message]
283            speaker="Kapou'e"
284            message= _ "Fool! We can hold that long. But we have to have Prestim firmly in control when the shamans arrive with the Great Horde. We can’t let the humans establish a foothold on this side of the river."
285        [/message]
286
287        [message]
288            role=cannonfodder
289            message= _ "Why?"
290        [/message]
291
292        [message]
293            speaker="Kapou'e"
294            message= _ "Because if we cannot decisively beat these humans, the other tribes won’t think us strong enough to lead them. Each chieftain will try to claim the leadership of the horde for themselves and the humans will be able to break through our defenses."
295        [/message]
296
297        [message]
298            role=cannonfodder
299            message= _ "Great."
300        [/message]
301    [/event]
302
303    # If a transport which is in the process of being boarded dies, free the
304    # would-be-boarders and start boarding the next transport instead. This is
305    # probably unnecessary as killing a transport which is about to be boarded
306    # would require the player to reach the boarding areas, but better safe than
307    # sorry...
308    [event]
309        name=die
310        first_time_only=no
311
312        [filter]
313            type=Transport Galleon
314
315            [filter_wml]
316                [variables]
317                    transport_num=$transport_to_board
318                [/variables]
319            [/filter_wml]
320        [/filter]
321
322        {MODIFY_UNIT (
323            [filter_wml]
324                [variables]
325                    boarding_transport=yes
326                [/variables]
327            [/filter_wml]
328
329            [filter_adjacent]
330                x,y=$x1,$y1
331            [/filter_adjacent]
332        ) variables.boarding_transport no}
333
334        [fire_event]
335            name=start_boarding_next_transport
336        [/fire_event]
337    [/event]
338
339    # This event triggers when the current transport to board has three adjacent
340    # units ready to board it. Then it shows all three units board the
341    # transport, stores those units in the transport's variables so they can be
342    # unstored when the transport unloads.
343    [event]
344        name=side 4 turn refresh
345        first_time_only=no
346
347        [filter_condition]
348            [have_unit]
349                type=Transport Galleon
350
351                [filter_wml]
352                    [variables]
353                        transport_num=$transport_to_board
354                    [/variables]
355                [/filter_wml]
356
357                [filter_adjacent]
358                    [filter_wml]
359                        [variables]
360                            boarding_transport=yes
361                        [/variables]
362                    [/filter_wml]
363
364                    count=3
365                [/filter_adjacent]
366            [/have_unit]
367        [/filter_condition]
368
369        {VARIABLE_OP ships_boarded add 1}
370        [switch]
371            variable=ships_boarded
372
373            [case]
374                value=1
375
376                [message]
377                    speaker=Grüü
378                    message= _ "Look, the humans are boarding a ship!"
379                [/message]
380            [/case]
381        [/switch]
382
383        [store_unit]
384            [filter]
385                type=Transport Galleon
386
387                [filter_wml]
388                    [variables]
389                        transport_num=$transport_to_board
390                    [/variables]
391                [/filter_wml]
392            [/filter]
393
394            kill=no
395            variable=transport
396        [/store_unit]
397
398        [store_unit]
399            [filter]
400                [filter_wml]
401                    [variables]
402                        boarding_transport=yes
403                    [/variables]
404                [/filter_wml]
405            [/filter]
406
407            kill=no
408            variable=transport.variables.landing_party
409        [/store_unit]
410
411        [foreach]
412            array=transport.variables.landing_party
413            [do]
414                [kill]
415                    x=$this_item.x
416                    y=$this_item.y
417                    fire_event=no
418                [/kill]
419
420                [move_unit_fake]
421                    x=$this_item.x,$transport.x
422                    y=$this_item.y,$transport.y
423                    type=$this_item.type
424                    gender=$this_item.gender
425                    side=4
426                [/move_unit_fake]
427
428                {VARIABLE this_item.moves 0}
429                {VARIABLE this_item.attacks_left 0}
430                {CLEAR_VARIABLE this_item.variables.boarding_transport}
431            [/do]
432        [/foreach]
433
434        [unstore_unit]
435            variable=transport
436            find_vacant=no
437        [/unstore_unit]
438
439        [fire_event]
440            name=start_boarding_next_transport
441        [/fire_event]
442
443        {CLEAR_VARIABLE transport}
444    [/event]
445
446    # This makes each transport which has a landing party to move towards a
447    # randomly selected landing spot.
448    [event]
449        name=side 4 turn refresh
450        first_time_only=no
451
452        [store_unit]
453            [filter]
454                type=Transport Galleon
455
456                [filter_wml]
457                    [variables]
458                        [landing_party]
459                        [/landing_party]
460                    [/variables]
461                [/filter_wml]
462            [/filter]
463
464            kill=no
465            variable=moving_transports
466        [/store_unit]
467
468        [foreach]
469            array=moving_transports
470            [do]
471                [if]
472                    [variable]
473                        name=this_item.x
474                        less_than=19
475                    [/variable]
476
477                    [then]
478                        {VARIABLE x "1-17"}
479                    [/then]
480
481                    [else]
482                        {VARIABLE x "21-38"}
483                    [/else]
484                [/if]
485
486                [store_locations]
487                    x=$x
488                    y=7-11
489                    terrain=W*
490
491                    [filter_adjacent_location]
492                        terrain=!,W*
493                        count=2-6
494                    [/filter_adjacent_location]
495
496                    [not]
497                        [filter]
498                        [/filter]
499
500                        radius=1
501                    [/not]
502
503                    variable=landing_sites
504                [/store_locations]
505
506                #{DEBUG_MSG "Found $landing_sites.length possible landing sites for transport $this_item.variables.transport_num"}
507
508                [if]
509                    [variable]
510                        name=landing_sites.length
511                        greater_than_equal_to=1
512                    [/variable]
513
514                    [then]
515                        {RANDOM "0..$($landing_sites.length - 1)"}
516
517                        {VARIABLE goto_x $landing_sites[$random].x}
518                        {VARIABLE goto_y $landing_sites[$random].y}
519
520                        {VARIABLE this_item.goto_x $goto_x}
521                        {VARIABLE this_item.goto_y $goto_y}
522
523                        #{DEBUG_MSG "Setting transport $this_item.variables.transport_num to goto $goto_x|,$goto_y"}
524
525                        [unstore_unit]
526                            variable=this_item
527                            find_vacant=no
528                        [/unstore_unit]
529                    [/then]
530                [/if]
531            [/do]
532        [/foreach]
533
534        {CLEAR_VARIABLE moving_transports,landing_sites,x,goto_x,goto_y,random}
535    [/event]
536
537    # This picks a nearby side 4 unit and flags it as one which should move
538    # towards the transport. First looks for a unit which is within one turn's
539    # movement, then for units within one turn's movement + 1 hex, then for
540    # units within one turn's movement + 2 hex, etc, but doesn't pick units
541    # which are more than 2 turns away and gives up when +6 is reached.
542    [event]
543        name=side 4 turn refresh
544        first_time_only=no
545
546        [filter_condition]
547            [have_unit]
548                [filter_wml]
549                    [variables]
550                        boarding_transport=yes
551                    [/variables]
552                [/filter_wml]
553
554                count=0-2
555            [/have_unit]
556        [/filter_condition]
557
558        {VARIABLE i 0}
559        [while]
560            [variable]
561                name=possible_boarders.length
562                less_than=1
563            [/variable]
564
565            [variable]
566                name=i
567                less_than=6
568            [/variable]
569
570            [do]
571                [store_unit]
572                    [filter]
573                        side=4
574                        canrecruit=no
575
576                        [not]
577                            type=Transport Galleon
578                        [/not]
579
580                        [filter_wml]
581                            hitpoints=$this_unit.max_hitpoints
582                        [/filter_wml]
583
584                        [not]
585                            [filter_wml]
586                                [variables]
587                                    boarding_transport=yes
588                                [/variables]
589                            [/filter_wml]
590                        [/not]
591
592                        [and]
593                            [filter_location]
594                                [filter]
595                                    type=Transport Galleon
596
597                                    [filter_wml]
598                                        [variables]
599                                            transport_num=$transport_to_board
600                                        [/variables]
601                                    [/filter_wml]
602                                [/filter]
603
604                                radius="$($this_unit.moves + min($i,$this_unit.moves))"
605
606                                [filter_radius]
607                                    terrain=G*,R*,C*,K*,*^V*,Wwf
608                                [/filter_radius]
609                            [/filter_location]
610                        [/and]
611                    [/filter]
612
613                    kill=no
614                    variable=possible_boarders
615                [/store_unit]
616
617                {VARIABLE_OP i add 1}
618            [/do]
619        [/while]
620
621        [if]
622            [variable]
623                name=possible_boarders.length
624                greater_than_equal_to=1
625            [/variable]
626
627            [then]
628                {RANDOM "0..$($possible_boarders.length - 1)"}
629
630                {VARIABLE possible_boarders[$random].variables.boarding_transport yes}
631
632                #{DEBUG_MSG "Setting $possible_boarders[$random].name the $possible_boarders[$random].language_name to board transport $transport_to_board"}
633
634                [unstore_unit]
635                    variable=possible_boarders[$random]
636                    find_vacant=no
637                [/unstore_unit]
638            [/then]
639
640            #[else]
641            #    {DEBUG_MSG "Found no one to go to board transport $transport_to_board|..."}
642            #[/else]
643        [/if]
644
645        {CLEAR_VARIABLE possible_boarders,random}
646    [/event]
647
648    # This makes units which have been designated to board a transport to move
649    # towards the current transport to board.
650    [event]
651        name=side 4 turn refresh
652        first_time_only=no
653
654        [store_unit]
655            [filter]
656                side=4
657
658                [filter_wml]
659                    [variables]
660                        boarding_transport=yes
661                    [/variables]
662                [/filter_wml]
663
664                [not]
665                    [filter_adjacent]
666                        [filter_wml]
667                            [variables]
668                                transport_num=$transport_to_board
669                            [/variables]
670                        [/filter_wml]
671                    [/filter_adjacent]
672                [/not]
673            [/filter]
674
675            kill=no
676            variable=moving_to_transport
677        [/store_unit]
678
679        [foreach]
680            array=moving_to_transport
681            [do]
682                # First we try to find a proper boarding location which the unit can
683                # reach in one turn...
684                [store_locations]
685                    terrain=!,W*
686
687                    [filter_adjacent_location]
688                        [filter]
689                            [filter_wml]
690                                [variables]
691                                    transport_num=$transport_to_board
692                                [/variables]
693                            [/filter_wml]
694                        [/filter]
695                    [/filter_adjacent_location]
696
697                    [not]
698                        [filter]
699                        [/filter]
700                    [/not]
701
702                    [and]
703                        [filter]
704                            x,y=$this_item.x,$this_item.y
705                        [/filter]
706
707                        radius=$this_item.moves
708
709                        [filter_radius]
710                            terrain=G*,R*,C*,K*,*^V*,Wwf
711                        [/filter_radius]
712                    [/and]
713
714                    variable=boarding_locs
715                [/store_locations]
716
717                # ...but if no such location was found, then we just make the unit
718                # head for the transport itself for now.
719                [if]
720                    [variable]
721                        name=boarding_locs.length
722                        less_than=1
723                    [/variable]
724
725                    [then]
726                        [store_locations]
727                            [filter]
728                                [filter_wml]
729                                    [variables]
730                                        transport_num=$transport_to_board
731                                    [/variables]
732                                [/filter_wml]
733                            [/filter]
734
735                            variable=boarding_locs
736                        [/store_locations]
737                    [/then]
738                [/if]
739
740                {RANDOM "0..$($boarding_locs.length - 1)"}
741
742                {VARIABLE this_item.goto_x $boarding_locs[$random].x}
743                {VARIABLE this_item.goto_y $boarding_locs[$random].y}
744
745                #{DEBUG_MSG "Setting $this_item.name the $this_item.language_name to go to $boarding_locs[$random].x|,$boarding_locs[$random].y"}
746
747                [unstore_unit]
748                    variable=this_item
749                    find_vacant=no
750                [/unstore_unit]
751            [/do]
752        [/foreach]
753
754        {CLEAR_VARIABLE moving_to_transport,boarding_locs,random}
755    [/event]
756
757    [event]
758        name=side 4 turn refresh
759        first_time_only=no
760
761        # Zero the movement of docked transports
762        {MODIFY_UNIT (
763            type=Transport Galleon
764            x,y=$this_unit.variables.dock_x,$this_unit.variables.dock_y
765
766            [not]
767                [filter_wml]
768                    [variables]
769                        [landing_party]
770                        [/landing_party]
771                    [/variables]
772                [/filter_wml]
773            [/not]
774        ) moves 0}
775
776        # Zero the movement of units waiting to board a transport
777        {MODIFY_UNIT (
778            side=4
779
780            [filter_wml]
781                [variables]
782                    boarding_transport=yes
783                [/variables]
784            [/filter_wml]
785            [filter_adjacent]
786                [filter_wml]
787                    [variables]
788                        transport_num=$transport_to_board
789                    [/variables]
790                [/filter_wml]
791            [/filter_adjacent]
792        ) moves 0}
793    [/event]
794
795    # When a transport reaches the northern shore in a spot which has at least 3
796    # adjacent free non-deep hexes, so that there's enough space to unload the
797    # whole landing party.
798    [event]
799        name=moveto
800        first_time_only=no
801
802        [filter]
803            type=Transport Galleon
804
805            [filter_location]
806                x=1-38
807                y=7-11
808
809                [filter_adjacent_location]
810                    [not]
811                        [filter]
812                        [/filter]
813                    [/not]
814
815                    terrain=!,W*
816                    count=1-6
817                [/filter_adjacent_location]
818
819                [and]
820                    [filter_adjacent_location]
821                        [not]
822                            [filter]
823                            [/filter]
824                        [/not]
825
826                        terrain=!,Wo
827                        count=3-6
828                    [/filter_adjacent_location]
829                [/and]
830            [/filter_location]
831        [/filter]
832
833        [foreach]
834            array=unit.variables.landing_party
835            [do]
836                [store_locations]
837                    terrain=!,W*
838
839                    [filter_adjacent_location]
840                        x,y=$x1,$y1
841                    [/filter_adjacent_location]
842
843                    [not]
844                        [filter]
845                        [/filter]
846                    [/not]
847
848                    variable=disembark_loc
849                [/store_locations]
850
851                [if]
852                    [variable]
853                        name=disembark_loc.length
854                        less_than=1
855                    [/variable]
856
857                    [then]
858                        [store_locations]
859                            terrain=!,Wo
860
861                            [filter_adjacent_location]
862                                x,y=$x1,$y1
863                            [/filter_adjacent_location]
864
865                            [not]
866                                [filter]
867                                [/filter]
868                            [/not]
869
870                            variable=disembark_loc
871                        [/store_locations]
872                    [/then]
873                [/if]
874
875                [move_unit_fake]
876                    x=$unit.x,$disembark_loc.x
877                    y=$unit.y,$disembark_loc.y
878                    type=$this_item.type
879                    gender=$this_item.gender
880                    side=4
881                [/move_unit_fake]
882
883                [unstore_unit]
884                    variable=this_item
885                    x,y=$disembark_loc.x,$disembark_loc.y
886                [/unstore_unit]
887            [/do]
888        [/foreach]
889
890        {VARIABLE_OP landing_parties_landed add 1}
891        [switch]
892            variable=landing_parties_landed
893
894            [case]
895                value=1
896
897                [message]
898                    x,y=$disembark_loc.x,$disembark_loc.y
899                    message= _ "Charge!"
900                [/message]
901            [/case]
902
903            [case]
904                value=2
905
906                [message]
907                    x,y=$disembark_loc.x,$disembark_loc.y
908                    message= _ "Get them!"
909                [/message]
910            [/case]
911        [/switch]
912
913        {CLEAR_VARIABLE unit.variables.landing_party,disembark_loc}
914
915        {VARIABLE unit.moves 0}
916
917        [unstore_unit]
918            variable=unit
919            find_vacant=no
920        [/unstore_unit]
921    [/event]
922
923    # This makes transports which have no landing party and aren't at their dock
924    # location to return to their dock. This should only be the case when a
925    # transport has unloaded their landing party but hasn't yet returned.
926    [event]
927        name=side 4 turn refresh
928        first_time_only=no
929
930        [store_unit]
931            [filter]
932                type=Transport Galleon
933
934                [not]
935                    x,y=$this_unit.variables.dock_x,$this_unit.variables.dock_y
936                [/not]
937
938                [not]
939                    [filter_wml]
940                        [variables]
941                            [landing_party]
942                            [/landing_party]
943                        [/variables]
944                    [/filter_wml]
945                [/not]
946            [/filter]
947
948            kill=yes
949            variable=returning_transports
950        [/store_unit]
951
952        [foreach]
953            array=returning_transports
954            [do]
955                {VARIABLE this_item.goto_x $this_item.variables.dock_x}
956                {VARIABLE this_item.goto_y $this_item.variables.dock_y}
957
958                #{DEBUG_MSG "Setting transport $this_item.variables.transport_num to return to $this_item.variables.dock_x|,$this_item.variables.dock_y"}
959
960                [unstore_unit]
961                    variable=this_item
962                [/unstore_unit]
963            [/do]
964        [/foreach]
965
966        {CLEAR_VARIABLE returning_transports}
967    [/event]
968
969    # This event simply cycles the variable $transport_to_board through values
970    # of 1,2,3,4,1,2,3,4,1,2,..., starting from whatever value it is originally
971    # set to (if not, then the first call to this sets it to 1).
972    [event]
973        name=start_boarding_next_transport
974        first_time_only=no
975
976        {VARIABLE i $transport_to_board}
977        [if]
978            [variable]
979                name=i
980                less_than=4
981            [/variable]
982
983            [then]
984                {VARIABLE_OP i add 1}
985            [/then]
986
987            [else]
988                {VARIABLE i 1}
989            [/else]
990        [/if]
991        [while]
992            [not]
993                [have_unit]
994                    type=Transport Galleon
995
996                    [filter_wml]
997                        [variables]
998                            transport_num=$i
999                        [/variables]
1000                    [/filter_wml]
1001                [/have_unit]
1002            [/not]
1003
1004            [not]
1005                [variable]
1006                    name=i
1007                    numerical_equals=$transport_to_board
1008                [/variable]
1009            [/not]
1010
1011            [do]
1012                [if]
1013                    [variable]
1014                        name=i
1015                        less_than=4
1016                    [/variable]
1017
1018                    [then]
1019                        {VARIABLE_OP i add 1}
1020                    [/then]
1021
1022                    [else]
1023                        {VARIABLE i 1}
1024                    [/else]
1025                [/if]
1026            [/do]
1027        [/while]
1028
1029        #{DEBUG_MSG "Next transport to board is transport $i"}
1030
1031        {VARIABLE transport_to_board $i}
1032    [/event]
1033
1034    [event]
1035        name=turn 2
1036
1037        [unit]
1038            side=5
1039            type=Merman Warrior
1040            id=Plouf
1041            name= _ "Plouf"
1042            x=1
1043            y=16
1044            random_traits=yes
1045        [/unit]
1046
1047        {GENERIC_UNIT 5 (Merman Fighter) 1 15}
1048        {GENERIC_UNIT 5 (Merman Fighter) 1 17}
1049
1050        [message]
1051            speaker="Plouf"
1052            message= _ "We arrive to honor our alliance, Earl Lanbec’h."
1053        [/message]
1054
1055        [message]
1056            speaker="Kapou'e"
1057            message= _ "Curses! They have fish-men on their side."
1058        [/message]
1059    [/event]
1060
1061    [event]
1062#ifdef EASY
1063        name=turn 6,turn 10,turn 14
1064#endif
1065#ifdef NORMAL
1066        name=turn 6,turn 10,turn 14, turn 18
1067#endif
1068#ifdef HARD
1069        name=turn 6,turn 10,turn 14, turn 18, turn 22
1070#endif
1071        first_time_only=no
1072
1073        [scroll_to]
1074            x,y=1,15
1075        [/scroll_to]
1076
1077        {GENERIC_UNIT 5 (Merman Fighter) 1 15}
1078        {GENERIC_UNIT 5 (Merman Fighter) 1 16}
1079#ifndef EASY
1080        {GENERIC_UNIT 5 (Merman Fighter) 1 17}
1081#endif
1082
1083        [delay]
1084            time=500
1085        [/delay]
1086    [/event]
1087
1088    [event]
1089#ifdef EASY
1090        name=turn 4,turn 8,turn 12
1091#endif
1092#ifdef NORMAL
1093        name=turn 4,turn 8,turn 12,turn 16
1094#endif
1095#ifdef HARD
1096        name=turn 4,turn 8,turn 12,turn 16,turn 20
1097#endif
1098        first_time_only=no
1099
1100        [scroll_to]
1101            x,y=38,14
1102        [/scroll_to]
1103
1104        {GENERIC_UNIT 5 (Merman Fighter) 38 14}
1105        [+unit]
1106            facing=sw
1107        [/unit]
1108        {GENERIC_UNIT 5 (Merman Fighter) 38 13}
1109        [+unit]
1110            facing=sw
1111        [/unit]
1112#ifndef EASY
1113        {GENERIC_UNIT 5 (Merman Fighter) 38 12}
1114        [+unit]
1115            facing=sw
1116        [/unit]
1117#endif
1118
1119        [delay]
1120            time=500
1121        [/delay]
1122    [/event]
1123
1124    [event]
1125        name=turn 24
1126
1127        [filter_condition]
1128            [have_location]
1129                terrain=*^V*
1130                y=1-11
1131
1132                [not]
1133                    owner_side=1
1134                [/not]
1135            [/have_location]
1136        [/filter_condition]
1137
1138        [message]
1139            speaker="Kapou'e"
1140            message= _ "The Great Horde is almost here! Drive them out of our villages <b>now</b>!"
1141        [/message]
1142    [/event]
1143
1144    [event]
1145        name=time over
1146
1147        {ORCISH_SHAMAN 1 11 1 Pirk _"Pirk"}
1148        {OLD_ORCISH_SHAMAN 1 11 1 Gork _"Gork"}
1149        {NOVICE_ORCISH_SHAMAN 1 11 1 Vraurk _"Vraurk"}
1150        # wmllint: whofield clear
1151        {UNIT 1 "Orcish Warrior" 11 1 role=greathordeprops}
1152        {UNIT 1 "Orcish Warrior" 11 1 role=greathordeprops}
1153        {UNIT 1 "Orcish Crossbowman" 11 1 role=greathordeprops}
1154        {UNIT 1 "Orcish Crossbowman" 11 1 role=greathordeprops}
1155        {UNIT 1 "Orcish Slayer" 11 1 role=greathordeprops}
1156        {UNIT 1 "Orcish Slayer" 11 1 role=greathordeprops}
1157        {UNIT 1 "Orcish Warlord" 11 1 role=greathordewarlord1}
1158        {UNIT 1 "Orcish Crossbowman" 11 1 role=greathordeprops}
1159        {UNIT 1 "Goblin Pillager" 11 1 role=greathordeprops}
1160        {UNIT 1 "Goblin Pillager" 11 1 role=greathordeprops}
1161        {UNIT 1 "Orcish Warrior" 11 1 role=greathordeprops}
1162        {UNIT 1 "Orcish Warlord" 11 1 role=greathordewarlord2}
1163
1164        [if]
1165            [have_location]
1166                terrain=*^V*
1167                y=1-11
1168
1169                [not]
1170                    owner_side=1
1171                [/not]
1172            [/have_location]
1173
1174            [then]
1175                [message]
1176                    speaker="Gork"
1177                    message= _ "Here we are!"
1178                [/message]
1179
1180                [message]
1181                    role=greathordewarlord1
1182                    message= _ "What’s this? This weakling has let humans enter Prestim? I will lead the horde and push them to the river!"
1183                    image=portraits/orcs/grunt-6.png
1184                [/message]
1185
1186                [message]
1187                    role=greathordewarlord2
1188                    message= _ "Bah! I’m the only one strong enough to drive out the humans! The Great Horde follows me!"
1189                    image=portraits/orcs/grunt-5.png
1190                [/message]
1191
1192                [message]
1193                    speaker="Earl Lanbec'h"
1194                    message= _ "Look at that, the stupid orcs are starting to fight amongst themselves! Now’s our chance, everyone attack!"
1195                [/message]
1196
1197                [endlevel]
1198                    result=defeat
1199                [/endlevel]
1200            [/then]
1201
1202            [else]
1203                [message]
1204                    speaker="Gork"
1205                    message= _ "Here we are! Hold on Prestim, we arrive to push them to the river!"
1206                [/message]
1207
1208                [message]
1209                    speaker="Earl Lanbec'h"
1210                    message= _ "They are too numerous now, RETREAT!"
1211                [/message]
1212
1213                [kill]
1214                    side=5
1215                    animate=no
1216                [/kill]
1217                [kill]
1218                    side=2
1219                    animate=no
1220                [/kill]
1221                [kill]
1222                    side=3
1223                    animate=no
1224                [/kill]
1225                [kill]
1226                    side=4
1227                    animate=no
1228                [/kill]
1229
1230                [message]
1231                    speaker="Kapou'e"
1232                    message= _ "The Great Horde at last! I was beginning to think they would never come."
1233                [/message]
1234
1235                [message]
1236                    speaker="Gork"
1237                    message= _ "Your defense of Prestim was heroic, facing such opposition surely undermined the morale of the humans. Now they are retreating to their fortresses and will not venture out again anytime soon."
1238                [/message]
1239
1240                [message]
1241                    speaker="Pirk"
1242                    message= _ "It is now time to show them who we are and to lead the Great Horde in pursuit. We will not rest until we destroy Earl Lanbec’h. Smite, stab, slay!"
1243                [/message]
1244
1245                {CLEAR_VARIABLE transport_to_board,landing_parties_landed,landing_parties_landed,ships_boarded}
1246
1247                [endlevel]
1248                    result=victory
1249                    bonus=no
1250                    {NEW_GOLD_CARRYOVER 40}
1251                [/endlevel]
1252            [/else]
1253        [/if]
1254    [/event]
1255
1256    {HERO_DEATHS}
1257[/scenario]
1258