-
-
Notifications
You must be signed in to change notification settings - Fork 988
/
simple_attack.cfg
235 lines (198 loc) · 7.22 KB
/
simple_attack.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
#textdomain wesnoth-ai
[test]
id=simple_attack
name= _ "Simple Attack"
next_scenario=micro_ai_test
map_data="{multiplayer/maps/Dark_Forecast.map}"
{DEFAULT_SCHEDULE}
turns=-1
[side]
side=1
controller=human
id=Grospur
name= _ "Grospur"
type=General
x,y=15,14
persistent=no
canrecruit=yes
recruit=Swordsman,Longbowman,Spearman,Bowman
gold=100
[/side]
[side]
side=2
controller=ai
type=Ancient Lich
id=Uralt
name= _ "Uralt"
x,y=8,6
persistent=no
canrecruit=yes
gold=10000
[/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]
[event]
name=preload
first_time_only=no
[lua]
code=<<
function close_to_advancing(unit)
if (unit.experience >= unit.max_experience-1) then
return true
else
return false
end
end
>>
[/lua]
[/event]
[event]
name=prestart
{VARIABLE scenario_name simple_attack}
{UNIT 1 Longbowman 11 14 random_traits,experience=no,67}
{UNIT 1 Longbowman 15 12 random_traits,experience=no,67}
{UNIT 1 Longbowman 13 17 random_traits,experience=no,67}
{UNIT 1 (Master Bowman) 13 13 random_traits,experience=no,149}
{UNIT 1 (Master Bowman) 11 16 random_traits,experience=no,149}
{UNIT 1 (Master Bowman) 15 18 random_traits,experience=no,149}
{UNIT 1 Sergeant 14 14 id=sergeant}
{GENERIC_UNIT 1 Javelineer 15 13}
{GENERIC_UNIT 1 (Iron Mauler) 15 17}
{SCATTER_UNITS 12 "Soulless" 1 (x,y=5-9,8-22) (side=2)}
{SCATTER_UNITS 6 "Skeleton,Skeleton Archer" 1 (x,y=5-9,8-22) (side=2)}
[micro_ai]
side=2
ai_type=simple_attack
action=add
ca_score=110001
[filter]
type=Soulless # No Walking Corpses; L0 units don't advance enemy
[/filter]
[filter_second]
lua_function = "close_to_advancing"
[/filter_second]
[/micro_ai]
[micro_ai]
side=2
ai_type=simple_attack
action=add
ca_score=110000
[filter]
type=Soulless,Walking Corpse
[/filter]
[/micro_ai]
[modify_side]
side=2
[ai]
aggression=1.0
caution=-9999
[/ai]
[/modify_side]
[/event]
[event]
name=start
{SCROLL_TO 11 16}
{MESSAGE sergeant "" "" _"General Grospur, what do we do? These undead will surely wipe us out."}
{MESSAGE Grospur "" "" _"Don't be such a chicken, Sergeant! I have placed units with lots of experience around the perimeter. The undead will not dare to attack them. And those few that sneak through... we can easily dispose of them once they make it inside.
<i>In other words, the Wesnoth AI does generally not attack units one XP from leveling if there is no chance of killing the unit with a single attack. However, some of the attacks by the undead are handled by the Simple Attack Micro AI in this scenario. General Grospur might be in for a surprise.</i>"}
[objectives]
summary= _ "Watch the undead take care of business"
[objective]
description= _ "Don't even try. You can't reach the Lich."
condition=win
[/objective]
[objective]
description= _ "Death of the last of Grospur's units"
condition=lose
[/objective]
[note]
description= _ "When your leader dies, side leadership passes on to another unit"
[/note]
[/objectives]
[/event]
# Guards don't get moves on Turn 1
[event]
name=turn refresh
[modify_unit]
[filter]
side=1
type=Longbowman,Swordsman
[/filter]
moves=0
[/modify_unit]
[/event]
[event]
name=attack
[filter_second]
side=1
lua_function = "close_to_advancing"
[/filter_second]
{MESSAGE $second_unit.id "" "" _"What the ... ?!? They are not supposed to attack me. That just doesn't happen in Wesnoth!"}
{MESSAGE Uralt "" "" _"Hahahahaha !! I have given special instruction to my Soulless to attack all you almost-advanced units first. Also watch how those same Soulless will throw themselves mercilessly at your pitiful soldiers after that, saving my more valuable skeleton minions for later. I have taken the term 'disposable units' to a whole new level. Watch in awe !!
<i>Translation: The undead side includes two instances of the Simple Attack Micro AI. The first makes the Soulless attack all units 1 XP from leveling up, such that they can be eliminated afterward. The second executes all remaining attacks possible by Soulless (and Walking Corpses), without regard for their own safety. Only after that does the default Wesnoth attack mechanism kick in to attack with the remaining units (skeletons).</i>"}
[/event]
# Put more undead out there when less than 25 left
[event]
name=side 2 turn end
first_time_only=no
[if]
[have_unit]
side=2
count=0-24
[/have_unit]
[then]
{MESSAGE Uralt "" "" _"Rise, minions!"}
{SCATTER_UNITS 6 "Soulless" 1 (x,y=5-9,8-22) (side=2)}
{SCATTER_UNITS 3 "Skeleton,Skeleton Archer" 1 (x,y=5-9,8-22) (side=2)}
[/then]
[/if]
[/event]
# When the leader dies, transfer leadership to another unit.
# If this was the last unit, end scenario.
[event]
name=die
first_time_only=no
[filter]
side=1
canrecruit=yes
[/filter]
[if]
[have_unit]
side=1
[/have_unit]
[then]
[store_unit]
[filter]
side=1
[/filter]
variable=tmp_units
[/store_unit]
{MODIFY_UNIT id=$tmp_units[1].id canrecruit yes}
{CLEAR_VARIABLE tmp_units}
[/then]
[else]
[kill]
id=$unit.id
[/kill]
# So that game goes on to next scenario
[modify_side]
side=3
controller=human
[/modify_side]
{MESSAGE Uralt "" "" _"And that's how the undead AI executes total annihilation ..."}
[endlevel]
result=victory
bonus=no
carryover_percentage=0
carryover_report=no
linger_mode=no
[/endlevel]
[/else]
[/if]
[/event]
[/test]