-
-
Notifications
You must be signed in to change notification settings - Fork 988
/
sides.cfg
623 lines (560 loc) · 16.8 KB
/
sides.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
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
#textdomain wesnoth-dm
# During the plot of this campaign Delfador changes recall lists more
# often than most Wesnoth characters change their underwear. This file
# exists to encapsulate all that machinery and the comments explaining
# what it does.
# That means: *ALL* recall list manipulation should be done *HERE*!
# The point is to have it in one place so the complexity can be audited.
#define MEMOIRS_STORE_MATCHING_UNITS WML VAR
# Store filtered units on Defador's side, except him, into an array variable
[store_unit]
kill=yes
variable={VAR}
[filter]
side=1
[and]
[not]
id=Delfador
[/not]
[/and]
{WML}
[/filter]
[/store_unit]
#enddef
#define MEMOIRS_STORE_UNITS VAR
# Store all units on Delfador's side, except him, into an array variable
{MEMOIRS_STORE_MATCHING_UNITS () {VAR}}
#enddef
#define MEMOIRS_UNSTORE_UNITS VAR
# Unstore units from an array back into existence
[foreach]
array={VAR}
[do]
[unstore_unit]
variable=this_item
find_vacant=yes
x=recall
y=recall
[/unstore_unit]
[heal_unit]
[filter]
id=$this_item.id
[/filter]
amount=999
[/heal_unit]
[/do]
[/foreach]
[clear_variable]
name={VAR}
[/clear_variable]
#enddef
#define SUBSUME_SIDE_AND_VILLAGES SIDE
# first change village ownership
[store_villages]
owner_side={SIDE}
variable=side_villages
[/store_villages]
[foreach]
array=side_villages
[do]
[capture_village]
side=1
x,y=$this_item.x,$this_item.y
[/capture_village]
[/do]
[/foreach]
{CLEAR_VARIABLE side_villages}
[modify_unit]
[filter]
side={SIDE}
[/filter]
moves=$this_unit.max_moves
[/modify_unit]
#next, turn off canrecruit for the leader and change all allegiances.
{MODIFY_UNIT (side={SIDE}
canrecruit=yes) canrecruit no}
{MODIFY_UNIT side={SIDE} side 1}
[modify_side]
side={SIDE}
hidden=yes
[/modify_side]
[redraw]
side=1
[/redraw]
#enddef
# At the end of Ur-Thorodur (8) Delf loses Lionel and his Wesnothian guards.
# In the otherworld scenarios Delf starts with an empty recall list
# and can only recruit undead.
#define SAVE_WESNOTH_VETERANS
[heal_unit]
[filter]
side=1
[/filter]
amount=full
animate=no
moves=full
restore_attacks=yes
restore_statuses=yes
[/heal_unit]
[store_unit]
# When next we meet, it will be in Garard's chambers
[filter]
id=Lionel
[/filter]
variable=Lionel
kill=yes
[/store_unit]
{MEMOIRS_STORE_UNITS delfador_lionels_guard}
#enddef
# At the beginning of Wasteland (11), Delf loses his undead veterans
# and gets to recruit elves. The undead will get one more chance to
# shine in Showdown in the Northern Swamp (20). Note: this macro needs
# to be called from a start or prestart event, before recruiting can
# occur.
#define SAVE_UNDEAD_VETERANS
{MEMOIRS_STORE_UNITS dead_recall}
#enddef
# At the end of Wasteland (11), Chantal's side 3 gets absorbed into Delfador's
# side 1.
#define CHANTAL_FOLLOWS_DELFADOR
{MODIFY_UNIT (id=Chantal) canrecruit no}
{MODIFY_UNIT (id=Chantal) overlays "misc/hero-icon.png"}
{MODIFY_UNIT (id=Chantal) ellipse "misc/ellipse-hero"}
{MODIFY_UNIT (side=3) side 1}
[modify_side]
side=3
hidden=yes
[/modify_side]
#enddef
# In Terror at the Ford of Parthyn (12), Delfador gets control of some
# loyalist troops and later some mages. We'll use SUBSUME_SIDE_AND_VILLAGES
# for these.
# At the end of Terror at the Ford of Parthyn (12), Chantal leaves to
# warn the North Elves; she won't be available until the Elves and
# Delfador meet again.
#define CHANTAL_DEPARTS
[store_unit]
variable=chantal_store
kill=yes
[filter]
id=Chantal
[/filter]
[/store_unit]
#enddef
# At the beginning of The Return of Trouble (13) Kalenz must temporarily
# become the leader of side 1, with an empty recall list. Kalenz will
# rejoin Delfador at the end of To Save The King (15).
#define KALENZ_TAKES_CONTROL
# Delfador departs the scene
[store_unit]
variable=delfador_store
kill=yes
[filter]
id=Delfador
[/filter]
[/store_unit]
# Survivors from Terror at the Ford of Parthyn will be conditionally
# available depending on which group Delfador is running with in
# the future. No need to filter out Chantal as she is already gone.
{MEMOIRS_STORE_MATCHING_UNITS race=human delfador_human_veterans}
{MEMOIRS_STORE_MATCHING_UNITS (race=elf
[not]
id=Kalenz
[/not]) delfador_elvish_veterans}
# Kalenz, the new protagonist, should have an empty recall list
[kill]
side=1
[not]
id=Kalenz
[/not]
[/kill]
# New recruit list for Kalenz
[set_recruit]
side=1
# Don't cut Kalenz back to recruiting L1s only, it's not survivable
# in the scenario where this is used.
recruit={ELVES},{ELVES2}
[/set_recruit]
#enddef
# At the end of The Return of Trouble (13), Chantal rejoins Kalenz.
#define CHANTAL_RETURNS X Y
[unstore_unit]
variable=chantal_store
find_vacant=yes
x={X}
y={Y}
[/unstore_unit]
{CLEAR_VARIABLE chantal_store}
[heal_unit]
[filter]
id=Chantal
[/filter]
amount=full
animate=no
moves=full
restore_attacks=yes
restore_statuses=yes
[/heal_unit]
#enddef
# In Shadows (14) Delfador reappears partway through the scenario,
# still attached to side 1 but not its leader (which is still Kalenz).
# He brings with him some Wesnothian troops; his recall list is
# otherwise empty, and he has no keep in this scenario.
#define DELFADOR_REAPPEARS X Y
[move_unit_fake]
type=$delfador_store.type
side=1
x={X}
y={Y}
[/move_unit_fake]
{VARIABLE delfador_store.facing nw}
[unstore_unit]
variable=delfador_store
find_vacant=yes
x={X}
y={Y}
[/unstore_unit]
# Force the fog to clear
[redraw]
clear_shroud=yes
side=1
[/redraw]
# He's making a dramatic entrance.
[scroll_to]
x,y = {X},{Y}
[/scroll_to]
# Delfador might have been wounded before he was stored. Full-heal him.
{FULL_HEAL id=Delfador}
{MODIFY_UNIT id=Delfador canrecruit no}
{MAKE_HERO Delfador}
{CLEAR_VARIABLE delfador_store}
# "n" tells us if {X} is even or odd. If it's even, "n" is equal to 1;
# otherwise, it's set to 0
{VARIABLE n "$(if(({X}/2.0 = {X}/2), 1, 0))"}
{NAMED_UNIT 1 (Royal Guard) "$({X}-1)" "$({Y}-(1-$n))" Clogrin _"Clogrin" (facing=nw)}
{NAMED_UNIT 1 (White Mage) "$({X}-1)" "$({Y}+$n)" Theorsten _"Theorsten" (facing=nw)}
{NAMED_UNIT 1 (White Mage) {X} "$({Y}-1)" Igler _"Igler" (facing=nw)}
{NAMED_UNIT 1 (White Mage) {X} "$({Y}+1)" Larsin _"Larsin" (facing=nw)}
{NAMED_UNIT 1 (White Mage) "$({X}+1)" "$({Y}-(1-$n))" Aldrin _"Aldrin" (facing=nw)}
{NAMED_UNIT 1 (Shock Trooper) "$({X}-2)" {Y} Gren _"Gren" (facing=nw)}
{NAMED_UNIT 1 (Shock Trooper) "$({X}-2)" "$({Y}-1)" Droni _"Droni" (facing=nw)}
{NAMED_UNIT 1 (Shock Trooper) "$({X}-1)" "$({Y}-(2-$n))" Artor _"Artor" (facing=nw)}
{CLEAR_VARIABLE n}
#enddef
# At the end of Shadows (14), control of side 1 needs to be handed
# back to Delfador. He gets his elvish veterans back, but he's not
# Kalenz (e.g current or former High Lord of the Elves) so he can't
# recruit L2s. This macro will be used in Prince of Wesnoth (20) as
# well.
#define DELFADOR_TAKES_CONTROL
{MODIFY_UNIT id=Kalenz canrecruit no }
{MAKE_HERO Kalenz}
{UNMAKE_HERO Delfador}
{MODIFY_UNIT id=Delfador canrecruit yes}
{MEMOIRS_UNSTORE_UNITS delfador_elvish_veterans}
[disallow_recruit]
side=1
type={ELVES2}
[/disallow_recruit]
#enddef
# At the end of Save the Prince (15), Delfador loses Kalenz, Chantal, his
# Elvish veterans, and the ability to recruit elves. This is as it
# should be; he's returning to human lands. He also loses his rescue
# force of Wesnothians.
#define ELVES_DEPART
#[kill]
# id=Delfador
#[/kill]
[kill]
id=Clogrin
[/kill]
[kill]
id=Aldrin
[/kill]
[kill]
id=Theorsten
[/kill]
[kill]
id=Igler
[/kill]
[kill]
id=Larsin
[/kill]
[kill]
id=Artos
[/kill]
[kill]
id=Droni
[/kill]
[kill]
id=Glen
[/kill]
# now store elvish NPCs
[store_unit]
variable=chantal_store
kill=yes
[filter]
id=Chantal
[/filter]
[/store_unit]
[store_unit]
variable=kalenz_store
kill=yes
[filter]
id=Kalenz
[/filter]
[/store_unit]
# store elves (to reappear later)
{MEMOIRS_STORE_UNITS delfador_elvish_veterans}
[disallow_recruit]
side=1
type={ELVES}
[/disallow_recruit]
#enddef
# Delfador returns to Weldyn in The King's Council (16). This is when he
# plugs back into the Wesnothian power structure, though the recruiting
# consequences are delayed because 16 is talk-only.
#
# At the beginning of A New Ally (17), Delfador gets back the
# Wesnothians (his original recruit list), plus the human survivors
# from Terror at the Ford of Parthyn (12). However we don't bring back
# Lionel, the cutscene in Dark Skies over Weldyn (16) has him
# commanding the defenses of Weldyn.
#
#define RESTORE_WESNOTHIAN_VETERANS
{MEMOIRS_UNSTORE_UNITS delfador_lionels_guard}
{MEMOIRS_UNSTORE_UNITS delfador_human_veterans}
#enddef
# At the end of A New Ally (17), the surviving Dwarvish units (and Ulrek)
# follow Delfador, going on his (human) recall list.
#define DWARVES_FOLLOW_DELFADOR
# Relgorn departs for Knalga
[kill]
id=Relgorn
fire_event=no
[/kill]
# Ulrek and the rest of the dwarves accompany Delfador
# Ulrek is made a hero for the rest of his appearance,
# as Relgorn (his son) won't think well of Delfador in
# HttT if Ulrek gets killed.
{MODIFY_UNIT (id=Ulrek) canrecruit no}
{MAKE_HERO Ulrek}
{MODIFY_UNIT (side=2) side 1}
[modify_side]
side=2
hidden=yes
[/modify_side]
#enddef
# At the beginning of Portal of Doom (18), Delf acquires the ability to
# recruit dwarves via Ulrek. (Should be called from the prestart event.)
#define DELFADOR_GETS_DWARVES
[allow_recruit]
side=1
type={DWARVES},{DWARVES2}
[/allow_recruit]
#enddef
# At the beginning of Showdown in the Northern Swamp (19), Kalenz
# rejoins Delfador. Chantal is not here for this one.
#define KALENZ_REJOINS_DELFADOR X Y
[unstore_unit]
variable=kalenz_store
find_vacant=yes
x={X}
y={Y}
[/unstore_unit]
{CLEAR_VARIABLE kalenz_store}
[heal_unit]
[filter]
id=Kalenz
[/filter]
amount=full
animate=no
moves=full
restore_attacks=yes
restore_statuses=yes
[/heal_unit]
# Delfador regains the ability to recruit L1 elves through Kalenz
# This is mostly for storyline purpose, as Delfador will almost
# certainly already have better units for this sort of battle.
[allow_recruit]
side=1
type={ELVES}
[/allow_recruit]
# FIXME: Should side 1 get Kalenz's veterans or ability to recruit L2s?
#enddef
# Also at the beginning of Showdown in the Northern Swamp (19),
# any undead veterans Delfador has left from the Houses of the Dead
# and The Gate Between Worlds scenarios return to fight for the living.
# They get finally dispelled at the end of the scenario.
#define UNDEAD_REJOIN_DELFADOR
{MEMOIRS_UNSTORE_UNITS dead_recall}
#enddef
# Shortly afterwards, Lionel puts his troops under Delfador's command.
# We'll use SUBSUME_SIDE_AND_VILLAGES for this.
# At the end of Showdown in the Northern Swamp (19), Delfador departs
# the scene: Kalenz will lead side 1 in the next scenario, 26 years
# later. This is preparation.
#define DELFADOR_DEPARTS_AGAIN
# He's not going to be where he can recruit dwarves again.
[disallow_recruit]
side=1
type={DWARVES},{DWARVES2}
[/disallow_recruit]
# Delfador goes away
[store_unit]
variable=delfador_store
kill=yes
[filter]
id=Delfador
[/filter]
[/store_unit]
# Delfador dismissed his undead veterans
{CLEAR_VARIABLE dead_recall}
# It would be nice to let Delfador keep his other veterans, but that
# would stretch the storyline a bit far. Human veterans will get
# old; dwarves have longer lifespans, but letting Delfador have
# them back would imply that dwarves had been following him around
# *in Wesnoth* for 26 years. Revisit this if we let Delfador
# have his elvish veterans for this battle.
# If the player has recruited any elves, store them
[store_unit]
variable=delfador_elvish_veterans
mode=append
[filter]
side=1
race=elf
[not]
id=Kalenz
[/not]
[/filter]
[/store_unit]
{MEMOIRS_STORE_MATCHING_UNITS (
[not]
id=Kalenz
[/not]
) wesnoth_victors}
{CLEAR_VARIABLE wesnoth_victors}
# Kalenz will lead in next scenario
{UNMAKE_HERO Kalenz}
{MODIFY_UNIT id=Kalenz canrecruit yes}
[modify_unit]
[filter]
id=Kalenz
[/filter]
x,y=recall,recall
[/modify_unit]
#enddef
# At the beginning of Prince of Wesnoth (20) Kalenz is running
# things again. Delfador will make another entrance, but without the ability
# to recruit loyalists and mages (he's going against Prince Eldred)
# and gets back the Elvish recall list. Chantal reappears as well.
# GL-2016JUL It's been 26 years. All the elves should be in perfect health,
# and have advanced a level from when last seen. Kalenz was recalled to
# (2,19) earlier.
#define DELFADOR_JOINS_ELVES
[unstore_unit]
variable=chantal_store
find_vacant=yes
x=4
y=18
[/unstore_unit]
{CLEAR_VARIABLE chantal_store}
[foreach]
array=delfador_elvish_veterans
[do]
[unstore_unit]
variable=this_item
find_vacant=yes
x,y=2,19
[/unstore_unit]
[/do]
[/foreach]
[clear_variable]
name=delfador_elvish_veterans
[/clear_variable]
[kill]
side=1
[not]
race=elf
[/not]
[/kill]
[modify_unit]
[filter]
side=1
[/filter]
type=""
[/modify_unit]
[heal_unit]
[filter]
side=1
[/filter]
amount=full
animate=no
moves=full
restore_attacks=yes
restore_statuses=yes
[/heal_unit]
[modify_unit]
[filter]
side=1
[not]
id=Kalenz,Chantal
[/not]
[/filter]
x,y=recall,recall
[/modify_unit]
#Lowel and Eldred are the enemy humans when this fires
[kill]
race=human
[not]
id=Lowel
[or]
id=Eldred
[/or]
[/not]
[/kill]
[disallow_recruit]
side=1
type={LOYALISTS}
[/disallow_recruit]
[disallow_recruit]
side=1
type=Mage, Arch Mage, Great Mage, Silver Mage, White Mage, Red Mage
[/disallow_recruit]
#enddef
# At the end of Prince of Wesnoth (20), Delfador intervenes.
#define DELFADOR_ARRIVES X Y
{CLEAR_VARIABLE delfador_store}
# recreate Delfador as he is now 54, 26 years older than last time.
[unit]
{OLD_DELFADOR}
x,y={X},{Y}
placement=map
passable=yes
overwrite=no
side=1
[/unit]
# clears any fog around his appearance
[redraw]
side=1
[/redraw]
#enddef
# At the end of Prince of Wesnoth (20), Delfador gets control of side 1 again.
# We reuse the macro from scenario 14.
# At the beginning of Clash at the Manor (21), our favorite Elvish NPCs
# reappear. From this point onward Delfador recruits only elves.
#define ELVISH_NPCS_REAPPEAR
#wmllint: validate-off
[unit]
id=Kalenz
type=Elvish High Lord
placement=leader
[/unit]
[unit]
id=Chantal
type=Elvish Shyde
placement=leader
[/unit]
#wmllint: validate-on
#enddef
# We're done.