1#textdomain wesnoth-ai
2
3[test]
4    id=micro_ai_test
5    name= _ "Micro AI Tests"
6    next_scenario=null
7
8    map_data="{multiplayer/maps/Dark_Forecast_basic.map}"
9
10    {DEFAULT_SCHEDULE}
11    turns=unlimited
12    victory_when_enemies_defeated=no
13
14    [side]
15        side=1
16        controller=human
17        suppress_end_turn_confirmation=yes
18        id=Grnk
19        name= _ "Grnk the Frail"
20        gender=male
21        unrenamable=yes
22        type=Goblin Spearman
23        max_moves=99
24        x,y=13,8
25
26        team_name=Grnk
27        user_team_name= _ "team_name^Grnk"
28        persistent=yes
29        save_id=Grnk
30
31        [modifications]
32            {TRAIT_QUICK}
33        [/modifications]
34
35        village_gold=0
36        {GOLD 24 22 19}
37        income=-2  # No income whatsoever
38    [/side]
39
40    # The labels and signposts to go on to the next scenario
41    [event]
42        name=prestart
43
44        {PLACE_IMAGE "scenery/signpost.png" 9 6}
45        {SET_LABEL 9 6 _"Animals"}
46
47        {PLACE_IMAGE "scenery/signpost.png" 10 5}
48        {SET_LABEL 10 5 _"Wolves"}
49
50        {PLACE_IMAGE "scenery/signpost.png" 11 5}
51        {SET_LABEL 11 5 _"Swarm"}
52
53        {PLACE_IMAGE "scenery/signpost.png" 12 4}
54        {SET_LABEL 12 4 _"Dragon"}
55
56        {PLACE_IMAGE "scenery/signpost.png" 13 4}
57        {SET_LABEL 13 4 _"Guardians"}
58
59        {PLACE_IMAGE "scenery/signpost.png" 14 3}
60        {SET_LABEL 14 3 _"Lurkers"}
61
62        {PLACE_IMAGE "scenery/signpost.png" 8 6}
63        {SET_LABEL 8 6 _"Protect Unit"}
64
65        {PLACE_IMAGE "scenery/signpost.png" 8 7}
66        {SET_LABEL 8 7 _"HttT: The Elves Besieged"}
67
68        {PLACE_IMAGE "scenery/signpost.png" 8 8}
69        {SET_LABEL 8 8 _"Bottleneck"}
70
71        {PLACE_IMAGE "scenery/signpost.png" 8 9}
72        {SET_LABEL 8 9 _"Messenger"}
73
74        {PLACE_IMAGE "scenery/signpost.png" 9 10}
75        {SET_LABEL 9 10 _"Patrols"}
76
77        {PLACE_IMAGE "scenery/signpost.png" 10 10}
78        {SET_LABEL 10 10 _"Recruiting"}
79
80        {PLACE_IMAGE "scenery/signpost.png" 11 11}
81        {SET_LABEL 11 11 _"Healers"}
82
83        {PLACE_IMAGE "scenery/signpost.png" 12 11}
84        {SET_LABEL 12 11 _"Goto"}
85
86        {PLACE_IMAGE "scenery/signpost.png" 13 12}
87        {SET_LABEL 13 12 _"Hang Out and Messenger"}
88
89        {PLACE_IMAGE "scenery/signpost.png" 14 12}
90        {SET_LABEL 14 12 _"Simple Attack"}
91
92        {PLACE_IMAGE "scenery/signpost.png" 15 13}
93        {SET_LABEL 15 13 _"Fast AI"}
94
95        {VARIABLE scenario_name micro_ai_test}
96
97        # Menu items explaining the different scenarios
98        [set_menu_item]
99            id=m01_menu_bottleneck_defense
100            description= _ "Bottleneck Defense Micro AI demo"
101            image=units/human-loyalists/lieutenant.png~CROP(16,7,36,36)~SCALE(24,24)
102            [filter_location]
103                x,y=8,8
104            [/filter_location]
105            [show_if]
106                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
107            [/show_if]
108            [command]
109                [message]
110                    speaker=Grnk
111                    caption= _ "Bottleneck Defense Micro AI Demo"
112                    message= _ "In the Bottleneck Defense Micro AI scenario, a small group of human soldiers is instructed to hold a pass against a large horde of orcs. You can either watch them fight it out against the standard RCA AI or take over the orc side."
113                [/message]
114            [/command]
115        [/set_menu_item]
116
117        [set_menu_item]
118            id=m02_swamp_lurkers
119            description= _ "Swamp Lurker Micro AI demo"
120            image=units/monsters/wolf.png~CROP(40,29,24,24)
121            [filter_location]
122                x,y=14,3
123            [/filter_location]
124            [show_if]
125                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
126            [/show_if]
127            [command]
128                [message]
129                    speaker=Grnk
130                    caption= _ "Swamp Lurker Micro AI demo"
131                    message= _ "Swamp lurkers are dumb, impulse-driven creatures which can move across most terrain, but only stop on swamp. They move individually without any strategy and always attack the weakest enemy within their reach. If no enemy is in reach, the lurker does a random move instead."
132                [/message]
133            [/command]
134        [/set_menu_item]
135
136        [set_menu_item]
137            id=m03_guardians
138            description= _ "Guardian Micro AI demo"
139            image=items/buckler.png~CROP(24,24,24,24)
140            [filter_location]
141                x,y=13,4
142            [/filter_location]
143            [show_if]
144                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
145            [/show_if]
146            [command]
147                [message]
148                    speaker=Grnk
149                    caption= _ "Guardian Micro AI demo"
150                    message= _ "In 'Guardians', several variations of the standard Wesnoth guardian are shown, including a ""coward"" unit that runs away from any approaching unit (an ""inverse guardian"", in a way)."
151                [/message]
152            [/command]
153        [/set_menu_item]
154
155        [set_menu_item]
156            id=m04_patrol
157            description= _ "Patrol Micro AI demo"
158            image=units/goblins/wolf-rider.png~CROP(22,11,42,42)~SCALE(24,24)
159            [filter_location]
160                x,y=9,10
161            [/filter_location]
162            [show_if]
163                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
164            [/show_if]
165            [command]
166                [message]
167                    speaker=Grnk
168                    caption= _ "Patrol Micro AI demo"
169                    message= _ "'Patrols' contains AI modifications for units following patrol routes."
170                [/message]
171            [/command]
172        [/set_menu_item]
173
174        [set_menu_item]
175            id=m05_recruiting
176            description= _ "Recruiting Tests Micro AI demo"
177            image=units/human-loyalists/lieutenant.png~CROP(16,7,36,36)~SCALE(24,24)
178            [filter_location]
179                x,y=10,10
180            [/filter_location]
181            [show_if]
182                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
183            [/show_if]
184            [command]
185                [message]
186                    speaker=Grnk
187                    caption= _ "Recruiting Tests Micro AI demo"
188                    message= _ "A simple scenario set up for the sole purpose of testing different recruiting patterns."
189                [/message]
190            [/command]
191        [/set_menu_item]
192
193        [set_menu_item]
194            id=m06_protect
195            description= _ "Protect Unit Micro AI demo"
196            image=units/human-magi/red-mage.png~CROP(22,12,24,24)
197            [filter_location]
198                x,y=8,6
199            [/filter_location]
200            [show_if]
201                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
202            [/show_if]
203            [command]
204                [message]
205                    speaker=Grnk
206                    caption= _ "Protect Unit Micro AI Demo"
207                    message= _ "This scenario demonstrates one side protecting a wizard while moving him to a goal location. At the same time, the other side is modified to do priority attacks on the wizard, even if a better target (by the default AI criteria) is available. You can watch the two AIs fight it out, or take control of either side to explore how the opposing AI behaves."
208                [/message]
209            [/command]
210        [/set_menu_item]
211
212        [set_menu_item]
213            id=m06a_protect
214            # wmllint: local spellings HttT
215            description= _ "HttT: The Elves Besieged Micro AI demo"
216            image=units/human-magi/red-mage.png~CROP(22,12,24,24)
217            [filter_location]
218                x,y=8,7
219            [/filter_location]
220            [show_if]
221                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
222            [/show_if]
223            [command]
224                [message]
225                    speaker=Grnk
226                    caption= _ "HttT: The Elves Besieged Micro AI demo"
227                    message= _ "This is a reenactment of scenario ""The Elves Besieged"" of the mainline campaign ""Heir to the Throne"", just that the AI is playing Konrad's side here. The same algorithm as for scenario ""Protect Unit"" is used."
228                [/message]
229            [/command]
230        [/set_menu_item]
231
232        [set_menu_item]
233            id=m07_messenger
234            description= _ "Messenger Escort Micro AI demo"
235            image=units/human-loyalists/cavalryman/cavalryman.png~CROP(33,27,24,24)
236            [filter_location]
237                x,y=8,9
238            [/filter_location]
239            [show_if]
240                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
241            [/show_if]
242            [command]
243                [message]
244                    speaker=Grnk
245                    caption= _ "Messenger Escort Micro AI demo"
246                    message= _ "'Messenger Escort' has the AI actively protect a messenger while he makes his way to the edge of the map. The escort will also try to open the path for the messenger if there are enemies in the way."
247                [/message]
248            [/command]
249        [/set_menu_item]
250
251        [set_menu_item]
252            id=m08_animals
253            description= _ "Animals Micro AI demo"
254            image=units/monsters/wolf.png~CROP(40,29,24,24)
255            [filter_location]
256                x,y=9,6
257            [/filter_location]
258            [show_if]
259                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
260            [/show_if]
261            [command]
262                [message]
263                    speaker=Grnk
264                    caption= _ "Animals Micro AI demo"
265                    message= _ "This scenario demonstrates a number of different animals following customized AI behavior, including wolves hunting deer in packs; dogs herding sheep; bears, spiders, yetis, boar and rabbits wandering and hunting/avoiding each other."
266                [/message]
267            [/command]
268        [/set_menu_item]
269
270        [set_menu_item]
271            id=m09_wolves
272            description= _ "Wolves Micro AI demo"
273            image=units/monsters/wolf.png~CROP(40,29,24,24)
274            [filter_location]
275                x,y=10,5
276            [/filter_location]
277            [show_if]
278                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
279            [/show_if]
280            [command]
281                [message]
282                    speaker=Grnk
283                    caption= _ "Wolves Micro AI demo"
284                    message= _ "Another demonstration of wolves wandering and attacking in packs, with a different behavior from that in 'Animals'."
285                [/message]
286            [/command]
287        [/set_menu_item]
288
289        [set_menu_item]
290            id=m10_swarm
291            description= _ "Swarm Micro AI demo"
292            image=units/undead/bat-se-4.png~CROP(24,16,24,24)
293            [filter_location]
294                x,y=11,5
295            [/filter_location]
296            [show_if]
297                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
298            [/show_if]
299            [command]
300                [message]
301                    speaker=Grnk
302                    caption= _ "Swarm Micro AI demo"
303                    message= _ "This scenario features bats moving around semi-randomly in a swarm."
304                [/message]
305            [/command]
306        [/set_menu_item]
307
308        [set_menu_item]
309            id=m11_dragon
310            description= _ "Dragon Micro AI demo"
311            image=units/monsters/fire-dragon.png~CROP(102,60,48,48)~SCALE(24,24)
312            [filter_location]
313                x,y=12,4
314            [/filter_location]
315            [show_if]
316                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
317            [/show_if]
318            [command]
319                [message]
320                    speaker=Grnk
321                    caption= _ "Dragon Micro AI demo"
322                    message= _ "This scenario features a fire dragon displaying a hunt-and-rest behavior."
323                [/message]
324            [/command]
325        [/set_menu_item]
326
327        [set_menu_item]
328            id=m12_healer_support
329            description= _ "Healer support Micro AI demo"
330            image=units/elves-wood/shaman.png~CROP(26,19,24,24)
331            [filter_location]
332                x,y=11,11
333            [/filter_location]
334            [show_if]
335                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
336            [/show_if]
337            [command]
338                [message]
339                    speaker=Grnk
340                    caption= _ "Healer Support Micro AI demo"
341                    message= _ "This scenario contains a simple demonstration of setting up the Healer Support Micro AI, which uses the healers of a side to back up injured or threatened units rather than having them participate in combat under all circumstances."
342                [/message]
343            [/command]
344        [/set_menu_item]
345
346        [set_menu_item]
347            id=m13_goto
348            description= _ "Goto Micro AI demo"
349            image=units/human-loyalists/spearman.png~CROP(21,16,24,24)
350            [filter_location]
351                x,y=12,11
352            [/filter_location]
353            [show_if]
354                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
355            [/show_if]
356            [command]
357                [message]
358                    speaker=Grnk
359                    caption= _ "Goto Micro AI demo"
360                    message= _ "This scenario contains several example usages of the Goto Micro AI, which is a highly configurable method of sending a unit (or units) to a location or set of locations. The units to be moved are defined using a Standard Unit Filter, while the goto locations are given in a Standard Location Filter."
361                [/message]
362            [/command]
363        [/set_menu_item]
364
365        [set_menu_item]
366            id=m14_hangout
367            description= _ "Hang Out Micro AI demo"
368            image=units/human-outlaws/bandit.png~CROP(22,14,24,24)
369            [filter_location]
370                x,y=13,12
371            [/filter_location]
372            [show_if]
373                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
374            [/show_if]
375            [command]
376                [message]
377                    speaker=Grnk
378                    caption= _ "Combined Hang Out and Messenger Escort Micro AI demo"
379                    message= _ "This scenario is a demonstration of the Hang Out Micro AI which keeps units around a (customizable) location until a (customizable) condition is met.  After that the units are released to follow other AI behavior.  The scenario also shows how to combine two Micro AIs on the same side by having the Messenger Escort Micro AI take over at that point."
380                [/message]
381            [/command]
382        [/set_menu_item]
383
384        [set_menu_item]
385            id=m15_simple_attack
386            description= _ "Simple Attack Micro AI demo"
387            image=units/undead/soulless.png~CROP(27,14,24,24)
388            [filter_location]
389                x,y=14,12
390            [/filter_location]
391            [show_if]
392                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
393            [/show_if]
394            [command]
395                [message]
396                    speaker=Grnk
397                    caption= _ "Simple Attack Micro AI demo"
398                    message= _ "This scenario demonstrates how certain attacks can be executed with higher priority than the standard Wesnoth attacks and how the AI can be forced to do attacks that it would otherwise avoid."
399                [/message]
400            [/command]
401        [/set_menu_item]
402
403        [set_menu_item]
404            id=m16_fast
405            description= _ "Fast Micro AI demo"
406            image=units/orcs/grunt.png~CROP(24,12,24,24)
407            [filter_location]
408                x,y=15,13
409            [/filter_location]
410            [show_if]
411                {VARIABLE_CONDITIONAL scenario_name equals micro_ai_test}
412            [/show_if]
413            [command]
414                [message]
415                    speaker=Grnk
416                    caption= _ "Fast Micro AI demo"
417                    message= _ "A simple demonstration of the calculation time advantage of the Fast Micro AI over the default AI in scenarios with many units."
418                [/message]
419            [/command]
420        [/set_menu_item]
421    [/event]
422
423    [event]
424        name=start
425
426        {SCROLL_TO 13 11}
427
428        [message]
429            speaker=Grnk
430            message= _ "Move me to any of the signposts to go to a Micro AI demonstration.
431
432Information about each demonstration can be accessed by right-clicking on the respective signpost."
433        [/message]
434
435        [objectives]
436            [objective]
437                description= _ "Move Grnk to one of the signposts"
438                condition=win
439            [/objective]
440            [note]
441                description= _ "Right-click on a signpost to get information about the scenario"
442            [/note]
443        [/objectives]
444    [/event]
445
446    # Events for going on to next scenarios, when Grnk goes to a signpost
447    [event]
448        name=moveto
449        [filter]
450            x,y=8,8
451        [/filter]
452
453        [endlevel]
454            result=victory
455            next_scenario=bottleneck_defense
456            bonus=no
457            carryover_percentage=0
458            carryover_report=no
459            linger_mode=no
460            replay_save=no
461        [/endlevel]
462    [/event]
463
464    [event]
465        name=moveto
466        [filter]
467            x,y=14,3
468        [/filter]
469
470        [endlevel]
471            result=victory
472            next_scenario=lurkers
473            bonus=no
474            carryover_percentage=0
475            carryover_report=no
476            linger_mode=no
477            replay_save=no
478        [/endlevel]
479    [/event]
480
481    [event]
482        name=moveto
483        [filter]
484            x,y=9,6
485        [/filter]
486
487        [endlevel]
488            result=victory
489            next_scenario=animals
490            bonus=no
491            carryover_percentage=0
492            carryover_report=no
493            linger_mode=no
494            replay_save=no
495        [/endlevel]
496    [/event]
497
498    [event]
499        name=moveto
500        [filter]
501            x,y=10,5
502        [/filter]
503
504        [endlevel]
505            result=victory
506            next_scenario=wolves
507            bonus=no
508            carryover_percentage=0
509            carryover_report=no
510            linger_mode=no
511            replay_save=no
512        [/endlevel]
513    [/event]
514
515    [event]
516        name=moveto
517        [filter]
518            x,y=11,5
519        [/filter]
520
521        [endlevel]
522            result=victory
523            next_scenario=swarm
524            bonus=no
525            carryover_percentage=0
526            carryover_report=no
527            linger_mode=no
528            replay_save=no
529        [/endlevel]
530    [/event]
531
532    [event]
533        name=moveto
534        [filter]
535            x,y=12,4
536        [/filter]
537
538        [endlevel]
539            result=victory
540            next_scenario=dragon
541            bonus=no
542            carryover_percentage=0
543            carryover_report=no
544            linger_mode=no
545            replay_save=no
546        [/endlevel]
547    [/event]
548
549    [event]
550        name=moveto
551        [filter]
552            x,y=13,4
553        [/filter]
554
555        [endlevel]
556            result=victory
557            next_scenario=guardians
558            bonus=no
559            carryover_percentage=0
560            carryover_report=no
561            linger_mode=no
562            replay_save=no
563        [/endlevel]
564    [/event]
565
566    [event]
567        name=moveto
568        [filter]
569            x,y=9,10
570        [/filter]
571
572        [endlevel]
573            result=victory
574            next_scenario=patrols
575            bonus=no
576            carryover_percentage=0
577            carryover_report=no
578            linger_mode=no
579            replay_save=no
580        [/endlevel]
581    [/event]
582
583    [event]
584        name=moveto
585        [filter]
586            x,y=10,10
587        [/filter]
588
589        [endlevel]
590            result=victory
591            next_scenario=recruiting
592            bonus=no
593            carryover_percentage=0
594            carryover_report=no
595            linger_mode=no
596            replay_save=no
597        [/endlevel]
598    [/event]
599
600    [event]
601        name=moveto
602        [filter]
603            x,y=8,6
604        [/filter]
605
606        [endlevel]
607            result=victory
608            next_scenario=protect_unit
609            bonus=no
610            carryover_percentage=0
611            carryover_report=no
612            linger_mode=no
613            replay_save=no
614        [/endlevel]
615    [/event]
616
617    [event]
618        name=moveto
619        [filter]
620            x,y=8,7
621        [/filter]
622
623        [endlevel]
624            result=victory
625            next_scenario=The_Elves_Besieged
626            bonus=no
627            carryover_percentage=0
628            carryover_report=no
629            linger_mode=no
630            replay_save=no
631        [/endlevel]
632    [/event]
633
634    [event]
635        name=moveto
636        [filter]
637            x,y=8,9
638        [/filter]
639
640        [endlevel]
641            result=victory
642            next_scenario=messenger_escort
643            bonus=no
644            carryover_percentage=0
645            carryover_report=no
646            linger_mode=no
647            replay_save=no
648        [/endlevel]
649    [/event]
650
651    [event]
652        name=moveto
653        [filter]
654            x,y=11,11
655        [/filter]
656
657        [endlevel]
658            result=victory
659            next_scenario=healer_support
660            bonus=no
661            carryover_percentage=0
662            carryover_report=no
663            linger_mode=no
664            replay_save=no
665        [/endlevel]
666    [/event]
667
668    [event]
669        name=moveto
670        [filter]
671            x,y=12,11
672        [/filter]
673
674        [endlevel]
675            result=victory
676            next_scenario=goto
677            bonus=no
678            carryover_percentage=0
679            carryover_report=no
680            linger_mode=no
681            replay_save=no
682        [/endlevel]
683    [/event]
684
685    [event]
686        name=moveto
687        [filter]
688            x,y=13,12
689        [/filter]
690
691        [endlevel]
692            result=victory
693            next_scenario=hang_out
694            bonus=no
695            carryover_percentage=0
696            carryover_report=no
697            linger_mode=no
698            replay_save=no
699        [/endlevel]
700    [/event]
701
702    [event]
703        name=moveto
704        [filter]
705            x,y=14,12
706        [/filter]
707
708        [endlevel]
709            result=victory
710            next_scenario=simple_attack
711            bonus=no
712            carryover_percentage=0
713            carryover_report=no
714            linger_mode=no
715            replay_save=no
716        [/endlevel]
717    [/event]
718
719    [event]
720        name=moveto
721        [filter]
722            x,y=15,13
723        [/filter]
724
725        [endlevel]
726            result=victory
727            next_scenario=fast
728            bonus=no
729            carryover_percentage=0
730            carryover_report=no
731            linger_mode=no
732            replay_save=no
733        [/endlevel]
734    [/event]
735[/test]
736