-
-
Notifications
You must be signed in to change notification settings - Fork 991
/
protect_unit.cfg
272 lines (239 loc) · 7.92 KB
/
protect_unit.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
#textdomain wesnoth-ai
[test]
id=protect_unit
name= _ "Protect Unit"
next_scenario=micro_ai_test
map_data="{ai/micro_ais/maps/protect_unit.map}"
{DEFAULT_SCHEDULE}
turns=unlimited
victory_when_enemies_defeated=no
[side]
side=1
controller=ai
suppress_end_turn_confirmation=yes
name= _ "Langzhar"
id=Langzhar
type=Lieutenant
persistent=no
team_name=Langzhar
user_team_name= _ "team_name^Langzhar"
recruit=Spearman,Bowman
gold=200
[/side]
[side]
side=2
controller=ai
suppress_end_turn_confirmation=yes
name= _ "Koorzhar"
id=Koorzhar
type=Lieutenant
persistent=no
defeat_condition=no_units_left
team_name=Koorzhar
user_team_name= _ "team_name^Koorzhar"
recruit=Spearman,Bowman
gold=175
[ai]
[goal]
[criteria]
id=Rossauba
[/criteria]
value=100
[/goal]
[/ai]
[ai]
[engine]
name="lua"
code= <<
return wesnoth.require("ai/micro_ais/engines/priority_target_engine.lua").init()
>>
[/engine]
[modify_ai]
side=2
action=add
# wmllint: unbalanced-on
path=stage[main_loop].candidate_action[]
# wmllint: unbalanced-off
[candidate_action]
engine=lua
name=change_attacks_aspect
id=change_attacks_aspect
max_score=999999
evaluation="return (...):change_attacks_aspect('Rossauba')"
execution="(...):change_attacks_aspect()"
[/candidate_action]
[/modify_ai]
[/ai]
[/side]
[side] # This side is only here because we need one persistent side for the game to go on
side=3
controller=null
persistent=yes
save_id=Grnk
hidden=yes
[/side]
# Prestart actions
[event]
name=prestart
{VARIABLE scenario_name protect_unit}
[micro_ai]
# Required keys of [micro_ai] tag
side=1
ai_type=protect_unit
action=add
[unit]
id=Rossauba
goal_x,goal_y=1,1
[/unit]
[/micro_ai]
# Put the mage out there
[unit]
type=Elder Mage
id=Rossauba
name=Rossauba
side=1
x,y=20,9
upkeep=loyal
overlays=misc/hero-icon.png
[/unit]
# Goal signpost for Rossauba
{PLACE_IMAGE "scenery/signpost.png" 1 1}
{SET_LABEL 1 1 _"Move Rossauba here"}
[/event]
[event]
name=start
{STORE_UNIT_VAR id=Koorzhar profile profile}
[message]
speaker=Koorzhar
image="$profile~FL()~RIGHT()"
message= _ "There's that traitor wizard. Let's get him."
[/message]
{CLEAR_VARIABLE profile}
[message]
speaker=Langzhar
message= _ "Men, you know the deal. We must protect Rossauba under all circumstances. Even my survival is not as important."
[/message]
[message]
speaker=Rossauba
message= _ "That's very kind of you, but ..."
[/message]
[message]
speaker=Langzhar
message= _ "No buts! You stay behind the lines and do not engage in battle unless there is no risk to your life, is that understood? And get to that signpost in the northwest if it is safe."
[/message]
[message]
speaker=narrator
caption= _ "Question for the Player"
image=wesnoth-icon.png
# wmllint: unbalanced-on
message= _ "In this scenario, the AI playing the humans in the east (Langzhar) is instructed to protect the wizard Rossauba, while moving him safely to the signpost. On the other side, Koorzhar's units (in the west) will primarily attack Rossauba, even if a better target is available. Do you want to play either of the sides or let the AIs battle it out among themselves?
Note: The Protect Unit AI is coded as a Micro AI. 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 https://wiki.wesnoth.org/Micro_AIs for more information." # wmllint: no spellcheck
# wmllint: unbalanced-off
[option]
label= _ "<span font='16'>I'll watch the two AIs fight it out</span>" # wmllint: no spellcheck
[/option]
[option]
label= _ "<span font='16'>I'll play Langzhar's side (to see how Koorzhar's units target Rossauba)</span>"
[command]
[modify_side]
side=1
controller=human
[/modify_side]
[/command]
[/option]
[option]
label= _ "<span font='16'>I'll play Koorzhar's side (to see how Langzhar's units protect Rossauba)</span>"
[command]
[modify_side]
side=2
controller=human
[/modify_side]
[/command]
[/option]
[/message]
[objectives]
side=1
summary= _ "Protect Rossauba while moving him to the signpost"
[objective]
description= _ "Rossauba makes it to the signpost"
condition=win
[/objective]
[objective]
description= _ "Death of Rossauba"
condition=lose
[/objective]
[objective]
description= _ "Death of Langzhar"
condition=lose
[/objective]
[/objectives]
[objectives]
side=2
summary= _ "Get rid of that traitor wizard Rossauba"
[objective]
description= _ "Defeat Rossauba"
condition=win
[/objective]
[objective]
description= _ "Rossauba makes it to the signpost"
condition=lose
[/objective]
[objective]
description= _ "Death of Koorzhar"
condition=lose
[/objective]
[/objectives]
[/event]
# Delay Rossauba by one turn
[event]
name=side 1 turn 1 refresh
{MODIFY_UNIT id=Rossauba moves 0}
[/event]
# All the end scenario events involving Rossauba are treated as victories
# (since the player could play either side)
# -> only defeat: when side leaders die in human-controlled mode
# When Rossauba dies:
[event]
name=last breath
[filter]
id=Rossauba
[/filter]
[message]
speaker=Rossauba
message= _ "I held out for as long as I could."
[/message]
[fire_event]
name=end_scenario
[/fire_event]
[/event]
# When Rossauba makes it to the signpost:
[event]
name=moveto
[filter]
id=Rossauba
x,y=1,1
[/filter]
[message]
speaker=Rossauba
message= _ "I made it"
[/message]
[fire_event]
name=end_scenario
[/fire_event]
[/event]
[event]
name=end_scenario
# So that game goes on to next scenario
[modify_side]
side=3
controller=human
[/modify_side]
[endlevel]
result=victory
bonus=no
carryover_percentage=0
carryover_report=no
linger_mode=no
[/endlevel]
[/event]
[/test]