-
-
Notifications
You must be signed in to change notification settings - Fork 988
/
animals.cfg
454 lines (381 loc) · 15.4 KB
/
animals.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
#textdomain wesnoth-ai
#define ANIMAL_AI_DESCRIPTIONS1
_"<u>General</u>: These AIs are set up to simulate (to some extent) how these animals behave in real life. This includes that they are animals, meaning that they are not super smart. As an example, the wolves generally hunt in a pack, but are easily distracted by prey coming into range. They are also decent, but not great at cornering deer. For the most part, this is intentional.
<u>Bears (replaced by Ghasts), Spiders and Yetis</u> mostly just wander in their respective parts of the map. They stay out of each other's way (and out of the way of the dogs), but do attack each other if cornered. They attack the other, weaker animals (deer etc.) if those are within range.
<u>Wolves</u> hunt in a pack. They actively go after the closest deer (as long as it stays in the forest) and try to corner it (not always super successfully), but are easily distracted by other prey coming into range. The wolves try to avoid getting into the range of bears, spiders, dogs and the yeti, except when they are going in for an attack. If you let them move for long enough, they will also learn that it is not healthy to attack the tusklets. When no deer is left, they wander randomly. Note that, unlike the Wolves Multipack AI (used in a different scenario), this Wolves AI combines all wolves of the side in the same pack."
#enddef
#define ANIMAL_AI_DESCRIPTIONS2
_"Each <u>Deer (replaced by Vampire Bats)</u> wanders randomly on forest tiles, except when enemies get in its (the deer's) range, in which case it flees to the farthest point it can reach.
<u>Tuskers (replaced by Ogres)</u> exhibit the same behavior as deer, except when an enemy is next to one of the tusklets. This enemy will then experience the full wrath of an irate boar.
<u>Tusklets (replaced by Young Ogres)</u> blindly follow the closest adult tusker, except when there is no tusker left, in which case they behave the same as deer.
<u>Rabbits (replaced by Rats)</u> also wander randomly, but in addition disappear into their holes (replaced by straw bales; if any are within reach) when enemies are close. They reappear out of their holes at the beginning of the turn, if it is safe.
<u>Sheep dogs (replaced by Footpads)</u> try to keep their sheep safe. This involves keeping them inside the area outlined by the path the dogs have worn into the meadow, positioning themselves in between the sheep and approaching enemies, and attacking the enemies if those get too close. You might have to let the scenario play for quite some time before you get to see an interesting dog/wolf interaction. If no active herding or protecting move is needed, the dogs go to a random location on the path.
<u>Sheep (replaced by Troll Whelps)</u> wander aimlessly except when a sheep dog is next to them, in which case they run away from the dog. The dogs exploit this by positioning themselves on the outside of the sheep, if possible. Sheep also run away from approaching enemies. The sheep, dogs and forest creatures (deer, tuskers, rabbits) have learned that they are no threat to each other and leave each other alone, demonstrating the enormous self control of a well trained sheep dog."
#enddef
[test]
id=animals
name= _ "Animals"
next_scenario=micro_ai_test
map_data="{ai/micro_ais/maps/animals.map}"
{DEFAULT_SCHEDULE}
turns=-1
victory_when_enemies_defeated=no
[side]
side=1
controller=human
hidden=no
name= _ "Rutburt"
id=Rutburt
max_moves=99
type=Outlaw
persistent=no
team_name=humans
user_team_name= _ "Humans"
canrecruit=yes
recruit=Ruffian,Footpad,Thug,Poacher
gold=0
[/side]
[side]
side=2
controller=ai
no_leader=yes
defeat_condition=no_units_left
persistent=no
team_name=forest
user_team_name=_"Forest Creatures"
gold=0
income=-2
[/side]
[side]
side=3
controller=ai
no_leader=yes
defeat_condition=no_units_left
persistent=no
team_name=ghasts
user_team_name= _ "Ghasts" # wmllint: no spellcheck
gold=0
income=-2
[/side]
[side]
side=4
controller=ai
no_leader=yes
defeat_condition=no_units_left
persistent=no
team_name=spiders
user_team_name= _ "Spiders"
gold=0
income=-2
[/side]
[side]
side=5
controller=ai
no_leader=yes
defeat_condition=no_units_left
persistent=no
team_name=yetis
user_team_name= _ "Yetis"
gold=0
income=-2
[/side]
[side]
side=6
controller=ai
no_leader=yes
defeat_condition=no_units_left
persistent=no
team_name=wolves
user_team_name= _ "Wolves"
gold=0
income=-2
[/side]
[side]
side=7
controller=ai
no_leader=yes
defeat_condition=no_units_left
persistent=no
team_name=whelps,forest
user_team_name= _ "Whelps"
gold=0
income=-2
[/side]
[side] # This side is only here because we need one persistent side for the game to go on
side=8
controller=null
persistent=yes
save_id=Grnk
hidden=yes
[/side]
# Put all the units and markers out there
[event]
name=prestart
{VARIABLE scenario_name animals}
{SCATTER_UNITS 3 "Vampire Bat" 1 (x,y,terrain=6-99,12-99,G*^F*) (side,random_traits=2,no)}
{NOTRAIT_UNIT 2 "Ogre" 6 20}
{NOTRAIT_UNIT 2 "Ogre" 7 21}
{NOTRAIT_UNIT 2 "Young Ogre" 7 20}
{NOTRAIT_UNIT 2 "Young Ogre" 8 21}
# Do this separately, so that there will definitely be two
{SCATTER_UNITS 1 "Ghast" 1 (x,y,terrain=1-10,1-11,G*) (side,random_traits=3,no)}
{SCATTER_UNITS 1 "Ghast" 1 (x,y,terrain=11-20,1-11,G*) (side,random_traits=3,no)}
{SCATTER_UNITS 1 "Giant Spider" 1 (x,y=51-57,1-8) (side,random_traits=4,no)}
{SCATTER_UNITS 1 "Giant Spider" 1 (x,y=36-50,1-9) (side,random_traits=4,no)}
{SCATTER_UNITS 1 "Yeti" 1 (x,y,terrain=11-25,1-9,M*) (side,random_traits=5,no)}
{NOTRAIT_UNIT 6 "Wolf" 1 33}
{NOTRAIT_UNIT 6 "Wolf" 2 32}
{NOTRAIT_UNIT 6 "Wolf" 2 33}
{NOTRAIT_UNIT 7 "Footpad" 34 24}
{NOTRAIT_UNIT 7 "Footpad" 25 32}
{NOTRAIT_UNIT 7 "Footpad" 36 31}
{NOTRAIT_UNIT 7 "Troll Whelp" 35 27}
{NOTRAIT_UNIT 7 "Troll Whelp" 29 28}
{NOTRAIT_UNIT 7 "Troll Whelp" 30 29}
{NOTRAIT_UNIT 7 "Troll Whelp" 28 30}
# Need to make sure these won't be on the border !!!!
# Other dimension are carefully chosen to give good distribution on map
# and not inside th Troll Whelp herding area
{SCATTER_IMAGE (
terrain=Gg,Gs
x,y=19-39,17-32
[not]
x,y=26-38,25-32
[/not]
) 3 items/straw-bale1.png}
{SCATTER_IMAGE (
terrain=Gg,Gs
x,y=19-39,17-32
[not]
x,y=26-38,25-32
[/not]
) 3 "items/straw-bale1.png~FL()"}
{SCATTER_IMAGE (
terrain=Gg,Gs
x,y=40-57,17-29
) 2 items/straw-bale1.png}
{SCATTER_IMAGE (
terrain=Gg,Gs
x,y=40-57,17-29
) 2 "items/straw-bale1.png~FL()"}
# The right-click menu items
[set_menu_item]
id=m01_end_animals
description= _ "End Scenario"
image=items/ring-red.png~CROP(26,26,20,20)
[show_if]
{VARIABLE_CONDITIONAL scenario_name equals animals}
[/show_if]
[command]
# So that game goes on to next scenario
[modify_side]
side=8
controller=human
[/modify_side]
{MESSAGE narrator "wesnoth-icon.png" "" _"Well, that was that."}
[endlevel]
result=victory
bonus=no
carryover_percentage=0
carryover_report=no
linger_mode=no
[/endlevel]
[/command]
[/set_menu_item]
[micro_ai]
side=2
ai_type=forest_animals
action=add
deer_type=Vampire Bat
rabbit_type=Giant Rat
tusker_type=Ogre
tusklet_type=Young Ogre
[filter_location]
terrain=*^F*
[/filter_location]
[/micro_ai]
# Set up the big_animals micro AI for the Ghasts
[micro_ai]
side=3
ai_type=big_animals
action=add
[filter]
type=Ghast
[/filter]
[avoid_unit]
type=Yeti,Giant Spider,Ghast,Footpad
[/avoid_unit]
[filter_location]
x,y=1-40,1-18
[/filter_location]
[/micro_ai]
# Set up the big_animals micro AI for side 4 (the spiders)
[micro_ai]
side=4
ai_type=big_animals
action=add
[filter]
type=Giant Spider
[/filter]
[avoid_unit]
type=Yeti,Giant Spider,Ghast,Footpad
[/avoid_unit]
[filter_location]
terrain=H*
[/filter_location]
[/micro_ai]
# Set up the big_animals micro AI for the Yeti
[micro_ai]
side=5
ai_type=big_animals
action=add
[filter]
type=Yeti
[/filter]
[avoid_unit]
type=Yeti,Giant Spider,Ghast,Footpad
[/avoid_unit]
[filter_location]
terrain=M*
[/filter_location]
[filter_location_wander]
terrain=M*,M*^*,H*,H*^*
[/filter_location_wander]
[/micro_ai]
# Set up the wolves micro AI
[micro_ai]
side=6
ai_type=wolves
action=add
[filter]
type=Wolf
[/filter]
[filter_second]
type=Vampire Bat
[/filter_second]
avoid_type=Yeti,Giant Spider,Ghast,Footpad
[/micro_ai]
# Set up the Troll Whelp micro AI
[micro_ai]
side=7
ai_type=herding
action=add
[filter]
type=Footpad
[/filter]
[filter_second]
type=Troll Whelp
[/filter_second]
herd_x,herd_y=32,28
[filter_location]
terrain=Rb
[/filter_location]
[/micro_ai]
[/event]
[event]
name=start
{MESSAGE narrator "wesnoth-icon.png" "Important Note" _"<span color='#A00000'>Important:</span> The animal Micro AIs in this scenario are written for a number of animal unit types that do not exist in Wesnoth mainline, such as bears, sheep and sheep dogs, or deer. In this test scenario, these units have been replaced by mainline units."}
# wmlindent: start ignoring
{MESSAGE narrator "wesnoth-icon.png" "" _"This is a fun little scenario with a bunch of different animal AIs, mostly for watching only. The animal AIs behave as follows:
"+{ANIMAL_AI_DESCRIPTIONS1}}
# wmlindent: stop ignoring
{MESSAGE narrator "wesnoth-icon.png" "" {ANIMAL_AI_DESCRIPTIONS2}}
[message]
speaker=narrator
caption= _ "Question for the Player"
image=wesnoth-icon.png
# wmllint: unbalanced-on
# wmlindent: start ignoring
message= _ "It is possible to include a human-controlled Side 1, so that the action stops once every turn for looking around (or to mess with things in debug mode).
Note that there is no end to this scenario. For demonstration purposes, any unit that is killed is replaced by another unit of the same type at the beginning of the next turn. In order to end the scenario, there's a right-click option - but that only works in human-controlled mode. In AI-only mode, you have to press 'Esc' or reload a previous savefile.
Also note: The Animal AIs are coded as Micro AIs. A Micro AI can be added and adapted to the need of a scenario easily using only WML and the [micro_ai] tag. Check out the <span color='#00A000'>Micro AI wiki page</span> at http://wiki.wesnoth.org/Micro_AIs for more information." # wmllint: no spellcheck
# wmlindent: stop ignoring
# wmllint: unbalanced-off
[option]
label= _ "<span font='16'>I'll just watch the animals.</span>"
[command]
[modify_side]
side=1
controller=null
hidden=yes
[/modify_side]
[kill]
side=1
[/kill]
[/command]
[/option]
[option]
label= _ "<span font='16'>I want to have control of Side 1.</span>"
[/option]
[/message]
[objectives]
side=1
summary= _ "Watch the animals do their things"
[objective]
description= _ "Use right-click option"
condition=win
[/objective]
[objective]
description= _ "Death of Rutburt"
condition=lose
[/objective]
[note]
description= _ "Check out the right-click menu options for additional actions"
[/note]
[/objectives]
[/event]
# After first Ogre attack on wolves, wolves do not attack those any more
[event]
name=attack end
[filter]
side=2
type=Ogre
[/filter]
[filter_second]
side=6
type=Wolf
[/filter_second]
# wmlindent: start ignoring
{MESSAGE $second_unit.id "" "" _"Yowl!
Translation: Those Ogres are mean! We better stay away from them and their young."}
# wmlindent: stop ignoring
[micro_ai]
side=6
ai_type=wolves
action=change
[filter]
type=Wolf
[/filter]
[filter_second]
type=Vampire Bat
[/filter_second]
avoid_type=Yeti,Giant Spider,Ghast,Footpad,Ogre,Young Ogre
[/micro_ai]
[/event]
# At the beginning of each side turn, put another unit one out there, if it was lost
# This is just for the sake of keeping the scenario going indefinitely
#define NEW_UNIT_SIDE_TURN SIDE TYPE COUNT X Y
[event]
name=side {SIDE} turn
first_time_only=no
[if]
[have_unit]
type={TYPE}
count={COUNT}
[/have_unit]
[then]
{NOTRAIT_UNIT {SIDE} {TYPE} {X} {Y}}
[/then]
[/if]
[/event]
#enddef
{NEW_UNIT_SIDE_TURN 2 "Vampire Bat" "0-2" 18 33}
{NEW_UNIT_SIDE_TURN 2 "Ogre" "0-1" 1 20}
{NEW_UNIT_SIDE_TURN 2 "Young Ogre" "0-1" 1 21}
{NEW_UNIT_SIDE_TURN 3 Ghast "0-1" 1 1}
{NEW_UNIT_SIDE_TURN 4 "Giant Spider" "0-1" 57 1}
{NEW_UNIT_SIDE_TURN 5 Yeti 0 15 1}
{NEW_UNIT_SIDE_TURN 6 Wolf "0-2" 1 33}
{NEW_UNIT_SIDE_TURN 7 Footpad "0-2" 30 33}
{NEW_UNIT_SIDE_TURN 7 "Troll Whelp" "0-3" 34 33}
[/test]