-
Notifications
You must be signed in to change notification settings - Fork 1
/
relics.cfg
1232 lines (1204 loc) · 40.7 KB
/
relics.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
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Relic (item) macros for Cities of the Frontier
#define SET_UP_RELICS
# Called at the beginning of each scenario to (re)-create the events needed
# Also contains details about the types of relics and the conversation
# prior to/after picking them up. Almost all of the relic details are in
# this event. Also contain effect events that need to be re-generated at the
# start of each new scenario for item persistence.
{FOREACH relics i}
[if] # for some reason wesnoth changes my "false" to "no"
{VARIABLE_CONDITIONAL relics[$i].found boolean_equals no}
[then]
[switch]
variable=relics[$i].type
[case] # Ring of regeneration
value="ring_of_regeneration"
{PLACE_RELIC $i _"ring of regeneration"
{RING_DIALOGUE}
{RING_OPTION}
(_"This ring heals the wearer a little each turn") (
[effect]
apply_to=new_ability
[abilities]
{ABILITY_REGENERATES}
[/abilities]
[/effect] ) ( ) }
[/case]
[case] # Ring of regrowth
value="ring_of_regrowth"
{PLACE_RELIC $i _"ring of regrowth"
{RING_DIALOGUE}
{RING_OPTION}
(_"This ring heals the wearer as well as those nearby") (
[effect]
apply_to=new_ability
[abilities]
{ABILITY_REGENERATES}
{ABILITY_HEALS}
[/abilities]
[/effect] ) ( )}
[/case]
[case] # Ring of regrowth (cursed)
value="ring_of_regrowth_cursed"
{PLACE_RELIC $i _"ring of regrowth"
{RING_DIALOGUE}
{RING_OPTION}
(_"This ring heals the wearer as well as those nearby") (
[effect]
apply_to=new_ability
[abilities]
{ABILITY_REGENERATES}
{ABILITY_HEALS}
[/abilities]
[/effect] ) (
{ASSIGN_UNIT_VARIABLE $relics[$i].x $relics[$i].y curse "undead_generator"}
{CALL_FUNCTION curse curse="undead_generator"}
)}
[/case]
[case] # Ring of resistance (all)
value="ring_of_resistance_all"
{PLACE_RELIC $i _"ring of resistance"
{RING_DIALOGUE}
{RING_OPTION}
(_"This ring increases all of the wearer's resistance by 10%") (
[effect]
apply_to=new_ability
[abilities]
[dummy]
id=high_resistance
name=_"high resistance"
female_name= _ "female^high resistance"
description=_"This unit's resistances are all increased by 10% from their base values."
[/dummy]
[/abilities]
[/effect]
[effect]
apply_to=resistance
replace=no
[resistance]
blade=-10
pierce=-10
impact=-10
fire=-10
cold=-10
arcane=-10
[/resistance]
[/effect] ) ( ) }
[/case]
[case] # Ring of resistance (blade)
value="ring_of_resistance_blade"
{PLACE_RELIC $i _"ring of resistance"
{RING_DIALOGUE}
{RING_OPTION}
(_"This ring increases the wearer's blade resistance by 30%") (
[effect]
apply_to=new_ability
[abilities]
[dummy]
id=blade_resistance
name=_"blade resistance"
female_name= _ "female^blade resistance"
description=_"This unit's blade resistance is increased by 30% from the base value."
[/dummy]
[/abilities]
[/effect]
[effect]
apply_to=resistance
replace=no
[resistance]
blade=-30
[/resistance]
[/effect] ) ( ) }
[/case]
[case] # Ring of resistance (impact)
value="ring_of_resistance_impact"
{PLACE_RELIC $i _"ring of resistance"
{RING_DIALOGUE}
{RING_OPTION}
(_"This ring increases the wearer's impact resistance by 30%") (
[effect]
apply_to=new_ability
[abilities]
[dummy]
id=impact_resistance
name=_"impact resistance"
female_name=_"female^impact resistance"
description=_"This unit's impact resistance is increased by 30% from the base value."
[/dummy]
[/abilities]
[/effect]
[effect]
apply_to=resistance
replace=no
[resistance]
impact=-30
[/resistance]
[/effect] ) ( ) }
[/case]
[case] # Ring of resistance (pierce)
value="ring_of_resistance_pierce"
{PLACE_RELIC $i _"ring of resistance"
{RING_DIALOGUE}
{RING_OPTION}
(_"This ring increases the wearer's pierce resistance by 30%") (
[effect]
apply_to=new_ability
[abilities]
[dummy]
id=pierce_resistance
name=_"pierce resistance"
female_name= _ "female^pierce resistance"
description=_"This unit's pierce resistance is increased by 30% from the base value."
[/dummy]
[/abilities]
[/effect]
[effect]
apply_to=resistance
replace=no
[resistance]
pierce=-30
[/resistance]
[/effect] ) ( ) }
[/case]
[case] # Ring of resistance (fire+cold)
value="ring_of_resistance_temperature"
{PLACE_RELIC $i _"ring of resistance"
{RING_DIALOGUE}
{RING_OPTION}
(_"This ring increases the wearer's fire and cold resistances by 30%") (
[effect]
apply_to=new_ability
[abilities]
[dummy]
id=temperature_resistance
name=_"temperature resistance"
female_name= _ "female^temperature resistance"
description=_"This unit's fire and cold resistances are increased by 30% from their base values."
[/dummy]
[/abilities]
[/effect]
[effect]
apply_to=resistance
replace=no
[resistance]
fire=-30
cold=-30
[/resistance]
[/effect] ) ( ) }
[/case]
[case] # Ring of resistance (arcane)
value="ring_of_resistance_arcane"
{PLACE_RELIC $i _"ring of resistance"
{RING_DIALOGUE}
{RING_OPTION}
(_"This ring increases the wearer's arcane resistance by 30%") (
[effect]
apply_to=new_ability
[abilities]
[dummy]
id=arcane_resistance
name=_"arcane resistance"
female_name= _ "female^arcane resistance"
description=_"This unit's arcane resistance is increased by 30% from the base value."
[/dummy]
[/abilities]
[/effect]
[effect]
apply_to=resistance
replace=no
[resistance]
arcane=-30
[/resistance]
[/effect] ) ( ) }
[/case]
[case] # Ring of magnetism
value="ring_of_magnetism"
{PLACE_RELIC $i _"ring of magnetism"
{RING_DIALOGUE}
{RING_OPTION}
(_"This ring greatly increases the wearer's accuracy") (
[effect] # remove existing weapon specials
apply_to=attack
remove_specials=magical,marksman
[/effect]
[effect]
apply_to=new_ability
[abilities]
[dummy]
id=magnetic
name=_"magnetic"
female_name=_"female^magnetic"
description=_"All of this unit's attacks have an extremely high chance to hit."
[/dummy]
[/abilities]
[/effect]
[effect]
apply_to=attack
# no filter keys -- I want to modify all attacks
[set_specials]
mode=append
[chance_to_hit]
value=90
[/chance_to_hit]
[/set_specials]
[/effect] ) (
{ASSIGN_UNIT_VARIABLE $relics[$i].x $relics[$i].y curse "magnetic"}
{CALL_FUNCTION curse curse="magnetism"} )}
[/case]
[case] # Potion of strength
value="potion_of_strength"
{PLACE_RELIC $i _"potion of strength"
{POTION_DIALOGUE}
{POTION_OPTION}
(_"This potion grants the drinker incredible strength") (
[effect]
apply_to=attack
range=melee
increase_damage=2
[/effect]
[effect]
apply_to=hitpoints
increase_total=5
heal_full=yes
[/effect] ) (
{UNIT_SAYS _"I feel incredibly powerful! Where is the nearest orc? I shall disembowel him!"} )}
[/case]
[case] # Potion of illumination
value="potion_of_illumination"
{PLACE_RELIC $i _"potion of illumination"
{POTION_DIALOGUE}
{POTION_OPTION}
(_"This potion causes drinker to glow with a warm inner light") (
[effect]
apply_to=new_ability
[abilities]
{ABILITY_ILLUMINATES}
[/abilities]
[/effect]
[effect]
apply_to=halo
halo=halo/illuminates-aura.png
[/effect] ) (
{UNIT_SAYS _"I'm. . . I'm. . . I'm glowing!"}
{UNIT_SAYS _"Hmmm. . . I guess this means no more covert nighttime rendezvous for me."} )}
[/case]
[case] # Potion of stoneskin
value="potion_of_stoneskin"
{PLACE_RELIC $i _"potion of stoneskin"
{POTION_DIALOGUE}
{POTION_OPTION}
(_"This potion hardens the drinker's skin, but greatly reduces movement") (
[effect]
apply_to=new_ability
[abilities]
[dummy]
id=stoneskin
name=_"stoneskin"
female_name= _ "female^stoneskin"
description=_"This unit is highly resistant to all forms of attack, but its hardened skin makes movement difficult."
[/dummy]
[/abilities]
[/effect]
[effect]
apply_to=resistance
replace=yes
[resistance]
blade=20
pierce=20
impact=20
fire=20
cold=20
arcane=80
[/resistance]
[/effect]
[effect]
apply_to=movement
set=2
[/effect]
[effect]
apply_to=movement_costs
replace=yes
[movement_costs]
shallow_water=2
reef=2
swamp_water=2
flat=1
sand=2
forest=2
hills=2
mountains=1
village=1
castle=1
cave=2
frozen=2
fungus=2
[/movement_costs]
[/effect]
[effect]
apply_to=defense
replace=yes
[defense]
shallow_water=90
reef=90
swamp_water=90
flat=80
sand=80
forest=70
hills=70
mountains=70
village=60
castle=60
cave=70
frozen=90
fungus=80
[/defense]
[/effect] ) ( )}
[/case]
[case] # Potion of flight
value="potion_of_flight"
{PLACE_RELIC $i _"potion of flight"
{POTION_DIALOGUE}
{POTION_OPTION}
(_"This potion causes the drinker to levitate a cubit or so above the ground") (
[effect]
apply_to=new_ability
[abilities]
[dummy]
id=levitates
name=_"levitates"
female_name=_"female^levitates"
description=_"This unit can levitate, greatly reducing its movement costs over rough terrain."
[/dummy]
[/abilities]
[/effect]
[effect]
apply_to=movement_costs
replace=yes
[movement_costs]
shallow_water=1
reef=1
swamp_water=1
flat=1
sand=1
forest=1
hills=1
mountains=1
village=1
castle=1
cave=1
frozen=1
fungus=1
[/movement_costs]
[/effect] ) (
[store_unit]
variable=unit_to_levitate
[filter]
x,y=$relics[$i].x,$relics[$i].y
[/filter]
[/store_unit]
{VARIABLE unit_to_levitate.flying yes}
[unstore_unit]
variable=unit_to_levitate
[/unstore_unit]
{CLEAR_VARIABLE unit_to_levitate} )}
[/case]
[case] # Potion of animal nature
value="potion_of_animal_nature"
{PLACE_RELIC $i _"potion of animal nature"
{POTION_DIALOGUE}
{POTION_OPTION}
(_"This potion reveals the drinker's hidden animal nature") (
[effect]
apply_to=new_ability
[abilities]
[dummy]
id=feral
name=_"feral"
female_name=_"female^feral"
description=_"This unit gains several powerful attacks, at the cost of his or her humanity."
[/dummy]
[/abilities]
[/effect]
[effect]
apply_to=new_attack
name=claws
description=_"claws"
type=blade
range=melee
damage=30
number=2
icon="attacks/claws-animal.png"
[/effect]
[effect]
apply_to=new_attack
name=fangs
description=_"fangs"
type=blade
range=melee
damage=14
number=2
icon="attacks/fangs-animal.png"
[specials]
{WEAPON_SPECIAL_BERSERK}
[/specials]
[/effect] )
( {NARRATOR_SAYS _"The soldier's shoulders and chest begin to swell. Dark fur sprouts and teeth grown into razor-sharp fangs."}
{UNIT_SAYS _"Raaaawwwwwwwrrrrrrrr!"}
{HERO_SAYS ( {WHISPER _"trembles"} _"Is that still you in there?")}
{UNIT_SAYS _"Aye, it is still me, milord, just a bit stronger than I used to be!"}
{ASSIGN_UNIT_VARIABLE $relics[$i].x $relics[$i].y curse "feral"} )}
# Note: don't need to call_function curse here, animal_goal already defined
[/case]
[case] # Sword of flame
value="sword_of_flame"
{PLACE_RELIC $i _"sword of flame"
({UNIT_SAYS _"There is a beautifully-crafted blade here. It must be magical - I can feel heat radiating from it."} )
(_"Take the sword?")
(_"A blade constructed from pure fire") (
[effect]
apply_to=new_attack
name=sword_of_flame
description=_"sword of flame"
type=fire
range=melee
damage=10
number=4
icon="attacks/longsword.png"
[/effect] ) ( ) }
[/case]
[case] # Sword of flame (cursed)
value="sword_of_flame_cursed"
{PLACE_RELIC $i _"sword of flame"
({UNIT_SAYS _"There is a beautifully-crafted blade here. It must be magical - I can feel heat radiating from it."} )
(_"Take the sword?")
(_"A blade constructed from pure fire") (
[effect]
apply_to=new_attack
name=sword_of_flame_cursed
description=_"sword of flame"
type=fire
range=melee
damage=12
number=4
icon="attacks/longsword.png"
[/effect] ) (
{ASSIGN_UNIT_VARIABLE $relics[$i].x $relics[$i].y curse "feisty_weapon"}
{CALL_FUNCTION curse curse="feisty_weapon"} )}
[/case]
[case] # Axe of ice
value="axe_of_ice"
{PLACE_RELIC $i _"axe of ice"
({UNIT_SAYS _"There is a beautifully-crafted axe here. It must be magical - it seems to suck all the heat out of this place."} )
(_"Take the axe?")
(_"A short-handled axe crafted from enchanted ice") (
[effect]
apply_to=new_attack
name=axe_of_ice
description=_"axe of ice"
type=cold
range=melee
damage=14
number=3
icon="attacks/battleaxe.png"
[/effect] ) ( ) }
[/case]
[case] # Axe of ice (cursed)
value="axe_of_ice_cursed"
{PLACE_RELIC $i _"axe of ice"
({UNIT_SAYS _"There is a beautifully-crafted axe here. It must be magical - it seems to suck all the heat out of this place."} )
(_"Take the axe?")
(_"A short-handled axe crafted from enchanted ice") (
[effect]
apply_to=new_attack
name=axe_of_ice_cursed
description=_"axe of ice"
type=cold
range=melee
damage=16
number=3
icon="attacks/battleaxe.png"
[/effect] ) (
{ASSIGN_UNIT_VARIABLE $relics[$i].x $relics[$i].y curse "feisty_weapon"}
{CALL_FUNCTION curse curse="feisty_weapon"} )}
[/case]
[case] # Arcane bow
value="arcane_bow"
{PLACE_RELIC $i "arcane bow"
({UNIT_SAYS _"There is a fine bow here, in perfect condition, but no arrows or quivers to be found. I cannot identify its origin, but it does not look to be of elven make."} )
(_"Take the bow?")
(_"A bow that fires bolts of magical energy") (
[effect]
apply_to=new_attack
name=arcane_bow
description=_"arcane bow"
type=arcane
range=ranged
damage=9
number=3
[specials]
{WEAPON_SPECIAL_MAGICAL}
[/specials]
icon="attacks/bow-elven-magic.png"
[/effect] ) ( ) }
[/case]
[else]
{DEBUG_MSG _"Unrecognized relic named $relics[$i].type . Please report this error in the forums."}
[/else]
[/switch]
[/then]
# ----- Now the effect events for particular items that have been found -----
# These are required for item/curse continuity into new seasons
[else]
[switch]
variable=relics[$i].type
[case] # Ring of regrowth (cursed)
value="ring_of_regrowth_cursed"
{CURSE_OF_UNDEAD}
[/case]
[case] # Ring of magnetism
value="ring_of_magnetism"
{CURSE_OF_MAGNETISM}
[/case]
[case]
value="sword_of_flame_cursed","axe_of_ice_cursed"
{CURSE_OF_FEISTY_WEAPON}
[/case]
[/switch]
[/else]
[/if]
{NEXT i}
# An event to fire other events. Events fail oddly inside the [object]
# tag -- I think something to do with non-delayed variable substitution
[event]
name=curse
first_time_only=no
[switch]
variable=param.curse
[case]
value="undead_generator"
{VARIABLE count_down_undead 4}
[event]
name=new turn
first_time_only=no
id=undead_curse_countdown
{VARIABLE_OP count_down_undead sub 1}
[if]
{VARIABLE_CONDITIONAL count_down_undead less_than 1}
[then]
{CURSE_OF_UNDEAD}
{CLEAR_VARIABLE count_down_undead}
[event]
id=undead_curse_countdown
remove=yes
[/event]
[/then]
[/if]
[/event]
[/case]
[case]
value="magnetism"
{CURSE_OF_MAGNETISM}
[/case]
[case]
value="feisty_weapon"
{CURSE_OF_FEISTY_WEAPON}
[/case]
[else]
{DEBUG_MSG _"Unknown curse $param.curse called. Please report this error in the forums."}
[/else]
[/switch]
[/event]
#enddef
# ----- Initial selection of relics --------------------------------------
#define SELECT_RELICS
# Used to choose and place the relics at the beginning of the first scenario
# Placed in this file at least temporarily so I don't have to hunt it down
# to work on it. Should be placed in a prestart event
[set_variables]
name=relics
mode=replace
[/set_variables]
[set_variables] # Note that frequency of appearance in this list determines
name=relic_list # the likelihood of appearance in the game
mode=replace
{VALUE1 type "ring_of_regeneration"} # some doubled to increase frequency
{VALUE1 type "ring_of_regeneration"}
{VALUE1 type "ring_of_regrowth"}
{VALUE1 type "ring_of_regrowth"}
{VALUE1 type "ring_of_regrowth_cursed"}
{VALUE1 type "ring_of_magnetism"}
{VALUE1 type "ring_of_resistance_all"}
{VALUE1 type "ring_of_resistance_blade"}
{VALUE1 type "ring_of_resistance_pierce"}
{VALUE1 type "ring_of_resistance_impact"}
{VALUE1 type "ring_of_resistance_temperature"}
{VALUE1 type "ring_of_resistance_arcane"}
{VALUE1 type "potion_of_strength"}
{VALUE1 type "potion_of_stoneskin"}
{VALUE1 type "potion_of_illumination"}
{VALUE1 type "potion_of_flight"}
{VALUE1 type "potion_of_animal_nature"}
{VALUE1 type "sword_of_flame"}
{VALUE1 type "sword_of_flame_cursed"}
{VALUE1 type "axe_of_ice"}
{VALUE1 type "axe_of_ice_cursed"}
{VALUE1 type "arcane_bow"}
# maybe some other bows - a marksman one?
# arcane sword
# potion that appears to do nothing, but makes you come back as a shadow or something
# {VALUE1 type "speed"}
# {VALUE1 type "marksman"}
# {VALUE1 type "holy water"}
# -give steadfast
# Mixed / cursed:
# increase blade resistance a lot, decrease impact (or vice versa)
# -minus 1 or 2 health per turn, possibly with flame/ice sword (wait a few turns first), or injure on attack
# -teleport (ability), with random teleporting occurring every 15-20 turns or so
# chameleon - resistances or maybe defense is set randomly every turn or two
# books? or maybe magic balls
[/set_variables]
{RANDOM_VAR i_max "$({NUM_RELICS}-1)".."$({NUM_RELICS}+1)"}
{VARIABLE i 0}
[while]
{VARIABLE_CONDITIONAL i less_than $i_max}
[do]
# Find a suitable location and change the map as needed.
# The cave terrain requires some handling to place walls and
# ensure it's accessible
# Terrain checking always occurs in the spring
# No swamp castles, as swamp terrain is rare and I don't want
# two relics next to each other
# I'm also avoiding the map edges, as this seems to lead to odd behavior
{RANDOM_VAR terrain_new ("Chr","Chr","Chr","Gg","Gg","Gg","Chw")}
# Maybe add hills and/or mountains at some point
[switch]
variable=terrain_new
[case]
value="Uu"
# TODO: deal with cave stuff here
[store_locations]
variable=loc_store
x=2-"$({MAP_WIDTH}-1)"
y=2-"$({MAP_HEIGHT}-1)"
[/store_locations]
[/case]
[case] # Ruined castles go pretty much anywhere
value="Chr"
[store_locations]
variable=loc_store
terrain=Gg,*^F*,H*,M*
x=2-"$({MAP_WIDTH}-1)"
y=2-"$({MAP_HEIGHT}-1)"
[/store_locations]
[/case]
[case] # Water castles go in the water, near shore
value="Chw"
[store_locations]
variable=loc_store
terrain=Ww,Ss
x=2-"$({MAP_WIDTH}-1)"
y=2-"$({MAP_HEIGHT}-1)"
[filter_adjacent_location]
terrain=W*,Ss
count=1-3
[/filter_adjacent_location]
[/store_locations]
[/case]
[case] # Plains cannot be placed on hills or mountains
value="Gg"
[store_locations]
variable=loc_store
terrain=Gg,G*^F*
x=2-"$({MAP_WIDTH}-1)"
y=2-"$({MAP_HEIGHT}-1)"
[/store_locations]
[/case]
[/switch]
{RANDOM_VAR i_loc 1..$loc_store.length}
{VARIABLE_OP i_loc sub 1}
{VARIABLE x1 $loc_store[$i_loc].x}
{VARIABLE y1 $loc_store[$i_loc].y}
{MODIFY_TERRAIN $terrain_new $x1 $y1}
# Choose relic types and set variables
{RANDOM_VAR i_relic 1..$relic_list.length}
{VARIABLE_OP i_relic sub 1}
# Each [case] block should Set the relics variable so moveto events
# can be created: set values .name, .description, .image1 (ground),
# image2 (item)
[switch]
variable=relic_list[$i_relic].type
[case]
value="ring_of_regeneration","ring_of_regrowth","ring_of_regrowth_cursed","ring_of_resistance_all","ring_of_resistance_blade","ring_of_resistance_impact","ring_of_resistance_pierce","ring_of_resistance_temperature","ring_of_resistance_arcane","ring_of_magnetism"
{PICK_RANDOM_IMAGES ("items/ring-brown.png","items/ring-gold.png","items/ring-red.png","items/ring-silver.png","items/ring-white.png") "ring"}
{ASSIGN_RELIC $image1 $image2}
[/case]
[case]
value="potion_of_strength","potion_of_stoneskin","potion_of_flight","potion_of_illumination","potion_of_animal_nature"
{PICK_RANDOM_IMAGES ("items/potion-blue.png","items/potion-green.png","items/potion-grey.png","items/potion-poison.png","items/potion-red.png","items/potion-yellow.png") "potion"}
[if] # Potions just laying around don't make much sense
{VARIABLE_CONDITIONAL terrain_new equals "Gg"}
[then]
{VARIABLE image1 "items/leather-pack.png"}
[/then]
[else]
[if] # Potions on skeletons don't make much sense
{VARIABLE_CONDITIONAL image1 equals "items/bones.png"}
[then]
{VARIABLE image1 $image2}
[/then]
[/if]
[/else]
[/if]
{ASSIGN_RELIC $image1 $image2}
[/case]
[case]
value="sword_of_flame","sword_of_flame_cursed"
{PICK_RANDOM_IMAGES ("items/flame-sword.png","items/sword.png") "sword"}
{VARIABLE image2 "items/flame-sword.png"} # always use this one
{ASSIGN_RELIC $image1 $image2}
[/case]
[case]
value="axe_of_ice","axe_of_ice_cursed"
{PICK_RANDOM_IMAGES ("items/axe.png") "axe"}
{ASSIGN_RELIC $image1 $image2}
[/case]
[case]
value="arcane_bow"
{PICK_RANDOM_IMAGES ("items/bow.png","items/bow-crystal.png","items/bow-elven.png") "bow"}
{ASSIGN_RELIC $image1 $image2}
[/case]
[/switch]
# Ensure no duplicates by deleting the chosen relic type
{CLEAR_VARIABLE relic_list[$i_relic]}
{VARIABLE_OP i add 1}
[/do]
[/while]
{CLEAR_VARIABLE relic_list}
{CLEAR_VARIABLE i_relic}
{CLEAR_VARIABLE loc_store}
{CLEAR_VARIABLE i_loc}
{CLEAR_VARIABLE image1}
{CLEAR_VARIABLE image2}
{CLEAR_VARIABLE terrain_orig}
{CLEAR_VARIABLE terrain_new}
{CLEAR_VARIABLE i}
{CLEAR_VARIABLE i_max}
#enddef
#define ASSIGN_RELIC IMAGE_GND IMAGE_ITEM
# This should ONLY be called from inside a [case] in the SELECT_RELIC
# macro. It will fail hard elsewhere.
{RANDOM_VAR str_i 0..2} # pick between description strings
[set_variables]
name=relics
mode=append
[value]
found=no
type=$relic_list[$i_relic].type
x,y=$x1,$y1
image_gnd={IMAGE_GND}
image_item={IMAGE_ITEM}
str_i=$str_i
[/value]
[/set_variables]
{CLEAR_VARIABLE str_i}
#enddef
# ----- Item-type specific stuff -------------------------------------
# ----- Specific (but repeated) item events -----
#define CURSE_OF_UNDEAD
# Undead / regeneration curse:
[event]
name=side 2 turn end
first_time_only=no
[if]
[have_unit]
{FILTER_FOR_CURSE "undead_generator"}
[/have_unit]
[then]
{VARIABLE turn_test "$($turn_number%3)"} # this sets the frequency
[if]
{VARIABLE_CONDITIONAL turn_test equals 1}
[then]
[store_unit]
variable=curse_store
[filter]
{FILTER_FOR_CURSE "undead_generator"}
[/filter]
[/store_unit]
{RANDOM_VAR curse_type ("Walking Corpse","Walking Corpse","Ghost","Skeleton","Skeleton Archer","Soulless")}
[unit]
type=$curse_type
side=2
x,y=$curse_store.x,$curse_store.y # actually will just place near here, as this is occupied
animate=yes
[/unit]
[fire_event]
name=undead_curse_commentary
[primary_unit]
x,y=$curse_store.x,$curse_store.y
[/primary_unit]
[/fire_event]
{CLEAR_VARIABLE curse_type}
{CLEAR_VARIABLE curse_store}
[/then]
[/if]
{CLEAR_VARIABLE turn_test}
[/then]
[/if]
[/event]
[event]
name=undead_curse_commentary
first_time_only=yes # this gets re-instated each season, so need to check the history
{DIALOGUE undead_curse (
{UNIT_SAYS _"Aaah! Where did that thing come from?"}
# the second sentence here might be untrue in very specific instances, but I don't care
{ADVISOR_SAYS _"It looked as if it 'twas pulled from the earth itself, but I see no sign of a necromancer nearby."}
{UNIT_SAYS _"I would not decline some help making sure it is put back in the earth, where it belongs!"} )}
[/event]
#enddef
#define CURSE_OF_MAGNETISM
{FORCE_CHANCE_TO_HIT (side=2,3,4,5,6,7,8) ({FILTER_FOR_CURSE "magnetic"}) 90 ()}
#enddef
#define CURSE_OF_FEISTY_WEAPON
[event]
name=attacker_hits
first_time_only=no
[filter]
{FILTER_FOR_CURSE "feisty_weapon"}
[/filter]
[filter_attack]
name=sword_of_flame_cursed,axe_of_ice_cursed
[/filter_attack]
[harm_unit]
[filter]
x,y=$x1,$y1
[/filter]
amount=1
kill=no
[/harm_unit]
[floating_text]
x,y=$x1,$y1
text="<span color='#ff0000'>1</span>"
[/floating_text]
[/event]
#enddef
# ----- Dialogue for different item types ------
# Dialogue macros should have two parts: discussion and option
#define RING_DIALOGUE
{UNIT_SAYS _"I have found a small glowing ring. What should I do with it, milord?"}
{HERO_SAYS _"Well, put it on and see if it does anything!"}
#enddef
#define RING_OPTION
_"Put on the ring?"
#enddef
#define POTION_DIALOGUE
{UNIT_SAYS _"There are a few broken bottles here, but one small vial remains intact and has some sort of liquid inside."}
{HERO_SAYS _"Well, aren't you going to drink it?"}
#enddef
#define POTION_OPTION
_"Drink the potion?"
#enddef
# ----- Random image picking -----------------------------------------
#define PICK_RANDOM_IMAGES LIST KEYWORD
[if]
{VARIABLE_CONDITIONAL terrain_new equals "Gg"}
[then] # on the plains or in the forest
[set_variable]
name=image1
rand="items/bones.png,items/leather-pack.png"
[/set_variable]
{RANDOM_VAR image2 {LIST}}
[/then]
[else] # in a run-down castle or cave
[set_variable]
name=image1
rand="items/chest.png","items/bones.png",{LIST}
[/set_variable]
[if]
{VARIABLE_CONDITIONAL image1 contains {KEYWORD}}
[then]
{VARIABLE image2 $image1}
[/then]
[else]
{RANDOM_VAR image2 {LIST}}
[/else]
[/if]
[/else]
[/if]
#enddef
# ----- Utility macros ---------------------------------------------------
#define FILTER_FOR_CURSE CURSE
[filter_wml]
[variables]
curse={CURSE}
[/variables]
[/filter_wml]
#enddef
#define PLACE_RELIC INDEX NAME TALK_WML OPTION_STRING DESCRIPTION EFFECT_WML POST_WML
# I've modified the "pickuppable_item" macro here to make to use the existing
# variable and allow multiple lines of dialog. Additional dialog can be added
# after the effect has been applied
# INDEX = index # of relics where info is stored
# TALK_WML = all pre-pickup messages between various units
# OPTION_STRING = question unit asks, e.g. "Should I put on the ring, milord?"
# EFFECT_WML = effects of the item on the unit
[item]
x,y=$relics[{INDEX}].x,$relics[{INDEX}].y
image=$relics[{INDEX}].image_gnd
[/item]
[event] # Dialogue for your cowardly leader
name=moveto
first_time_only=no
delayed_variable_substitution=no # this is necessary to get event to fire at all
[filter]
side=1
canrecruit=yes
x,y=$relics[{INDEX}].x,$relics[{INDEX}].y
[/filter]
[if]
{HAVE_ADVISOR}
[then]
[store_unit]
variable=advisor_unit
[filter]
role=advisor
[/filter]
[/store_unit]
{HERO_SAYS _"There is something peculiar about this area. $|advisor_unit.name, you should investigate it further."}
{ADVISOR_SAYS _"Me, milord?"}
{HERO_SAYS _"Well, we cannnot just have one of the peasants mucking about with something potentially dangerous, now can we?"}
{CLEAR_VARIABLE advisor_unit}
[/then]
[else] # no advisor, unlikely to be other roles
{HERO_SAYS _"There is something peculiar about this area. I shall send someone to investigate it later."}
[/else]
[/if]
[/event]
[event]
name=moveto