diff --git a/data/campaigns/Eastern_Invasion/scenarios/17b_Weldyn_Besieged.cfg b/data/campaigns/Eastern_Invasion/scenarios/17b_Weldyn_Besieged.cfg index 03f4a72b52f0..d09fe21df554 100644 --- a/data/campaigns/Eastern_Invasion/scenarios/17b_Weldyn_Besieged.cfg +++ b/data/campaigns/Eastern_Invasion/scenarios/17b_Weldyn_Besieged.cfg @@ -44,6 +44,7 @@ name= _ "?" side=2 canrecruit=yes + facing=sw [variables] random_lich=yes [/variables] @@ -61,6 +62,7 @@ name= _ "?" side=3 canrecruit=yes + facing=sw [variables] random_lich=yes [/variables] @@ -78,6 +80,7 @@ name= _ "?" side=4 canrecruit=yes + facing=nw [variables] random_lich=yes [/variables] @@ -95,6 +98,7 @@ name= _ "?" side=5 canrecruit=yes + facing=nw [variables] random_lich=yes [/variables] @@ -112,6 +116,7 @@ name= _ "?" side=6 canrecruit=yes + facing=ne [variables] random_lich=yes [/variables] @@ -129,6 +134,7 @@ name= _ "?" side=7 canrecruit=yes + facing=se [variables] random_lich=yes [/variables] @@ -146,6 +152,7 @@ name= _ "?" side=8 canrecruit=yes + facing=se [variables] random_lich=yes [/variables] @@ -160,8 +167,15 @@ # wmllint: recognize Mal-Ravanal [event] name=prestart + + {VARIABLE liches_to_kill {ON_DIFFICULTY 2 3 4}} + [objectives] side=1 + [objective] + description= _ "Kill $liches_to_kill liches to reveal Mal-Ravanal" + condition=win + [/objective] [objective] description= _ "Defeat Mal-Ravanal while Dacyn is nearby" condition=win @@ -215,28 +229,153 @@ speaker=Dacyn message= _ "I can sense Mal-Ravanal is here somewhere... When we attack him I will need to be nearby with the Null Stone to prevent his teleportation. We cannot afford to let him escape." [/message] - {VARIABLE lich_death_bonus 25} - - {VARIABLE lich_name_0 _"Mal-Hadanak"} - {VARIABLE lich_name_1 _"Mal-Katklagad"} - {VARIABLE lich_name_2 _"Mal-Xaskanat"} - {VARIABLE lich_name_3 _"Mal-Akranbral"} - {VARIABLE lich_name_4 _"Mal-Larakan"} - {VARIABLE lich_name_5 _"Mal-Drakanal"} - {VARIABLE lich_name_6 _"Mal-Ravanal"} - - {VARIABLE lich_quote_0 _"You dare to attack me? Now you will pay!"} - {VARIABLE lich_quote_1 _"I will enjoy watching you suffer!"} - {VARIABLE lich_quote_2 _"Death will only be the beginning of your torment!"} - {VARIABLE lich_quote_3 _"You will serve me in death!"} - {VARIABLE lich_quote_4 _"Allow me to free you from your wretched existence!"} - {VARIABLE lich_quote_5 _"My master is merely toying with you!"} + + [scroll_to] + x,y=51,1 + [/scroll_to] + [delay] + time=100 + [/delay] + [scroll_to] + x,y=51,25 + [/scroll_to] + [delay] + time=100 + [/delay] + [scroll_to] + x,y=1,25 + [/scroll_to] + [delay] + time=100 + [/delay] + [scroll_to] + x,y=1,1 + [/scroll_to] + [delay] + time=100 + [/delay] + + [message] + speaker=Gweddry + message= _ "But how? We don't know which one of them he is." + [/message] + + [message] + speaker=Dacyn + message= _ "They are channeling some dark magic to hide themselves. We have to kill some of them to break the spell." + [/message] + + [set_variables] + name=random_liches + + [value] + name= _ "Mal-Hadanak" + quote= _ "You dare to attack me? Now you will pay!" + [/value] + [value] + name= _ "Mal-Katklagad" + quote= _ "I will enjoy watching you suffer!" + [/value] + [value] + name= _ "Mal-Xaskanat" + quote= _ "Death will only be the beginning of your torment!" + [/value] + [value] + name= _ "Mal-Akranbral" + quote= _ "You will serve me in death!" + [/value] + [value] + name= _ "Mal-Larakan" + quote= _ "Allow me to free you from your wretched existence!" + [/value] + [value] + name= _ "Mal-Drakanal" + quote= _ "My master is merely toying with you!" + [/value] + [/set_variables] + + [store_unit] + [filter] + type=Lich + canrecruit=yes + [/filter] + + kill=no + variable=liches + [/store_unit] + + [foreach] + array=liches + + [do] + [object] + silent=yes + + [filter] + x,y=$this_item.x,$this_item.y + [/filter] + + [effect] + apply_to=halo + halo="halo/holy/light-beam-5.png~CROP(0,0,150,500)~SCALE(108,144)~CS(-159,-255,-159)~MASK(terrain/misc/smoke-A[01~12].png~SCALE(108,144)):100" + [/effect] + [/object] + [/do] + [/foreach] + + {CLEAR_VARIABLE liches} [/event] - # The odds of Mal-Ravanal turning up are roughly - # 0%, 3%, 7%, 13%, 22%, 42%, 100% for each respective - # lich revealed (assuming he hasn't already). + # Reveals the primary unit as Mal-Ravanal + [event] + name=reveal ravanal + + [modify_unit] + [filter] + find_in=unit + [/filter] + type=Lich Lord + id=Mal-Ravanal + name= _ "Mal-Ravanal" + profile=portraits/mal-ravanal.png + hitpoints=80 + [variables] + random_lich=no + [/variables] + [/modify_unit] + + {TEAM_COLOR_OVERRIDE id=Mal-Ravanal blue} + + [object] + silent=yes + + [filter] + id=Mal-Ravanal + [/filter] + + [effect] + apply_to=halo + halo="" + [/effect] + [/object] + + [allow_recruit] + side=$unit.side + type="Bone Shooter,Revenant,Wraith,Shadow,Nightgaunt,Spectre,Draug,Banebow" + [/allow_recruit] + [gold] + amount=100 + side=$unit.side + [/gold] + + [message] + speaker=Mal-Ravanal + message=_"I shall destroy you personally!" + [/message] + [/event] + + # When attacking a random lich, reveal it (the last one will be Mal-Ravanal) [event] name=attack first_time_only=no @@ -253,122 +392,270 @@ [/filter_wml] [/filter_second] - {RANDOM 0..5} - - [while] - [variable] - name=lich_name_$random| - equals="used" - [/variable] + [filter_condition] + [have_unit] + [filter_wml] + [variables] + random_lich=yes + [/variables] + [/filter_wml] - [do] - {RANDOM 0..6} - [/do] - [/while] + [not] + x,y=$x2,$y2 + [/not] + [/have_unit] + [/filter_condition] - # According to the WML guide, there is a chance - # (Roughly 1e-81 at best) that we will exit the - # while loop without a lich name. In that very - # unlikely event, go ahead and spawn Mal-Ravanal + {RANDOM "0..$($random_liches.length - 1)"} - {VARIABLE second_unit.name $lich_name_$random||} + {VARIABLE second_unit.name $random_liches[$random].name} {VARIABLE second_unit.variables.random_lich no} - [if] - [variable] - name=lich_name_$random - equals= _ "Mal-Ravanal" # wmllint: ignore - [/variable] - [or] - [variable] - name=lich_name_$random - equals="used" # wmllint: ignore - [/variable] - [/or] - [then] - [modify_unit] - [filter] - x,y=$second_unit.x, $second_unit.y - [/filter] - type=Lich Lord - id=Mal-Ravanal - name= _ "Mal-Ravanal" - profile=portraits/mal-ravanal.png - hitpoints=80 - [variables] - random_lich=no - [/variables] - [/modify_unit] + [unstore_unit] + variable=second_unit + find_vacant=no + [/unstore_unit] - {TEAM_COLOR_OVERRIDE id=Mal-Ravanal blue} + [object] + silent=yes - [allow_recruit] - side=$second_unit.side - type="Bone Shooter,Revenant,Wraith,Shadow,Nightgaunt,Spectre,Draug,Banebow" - [/allow_recruit] + [filter] + find_in=second_unit + [/filter] - [gold] - amount=100 - side=$second_unit.side - [/gold] + [effect] + apply_to=halo + halo="" + [/effect] + [/object] - [message] - speaker=Mal-Ravanal - message=_"I shall destroy you personally!" - [/message] - [/then] + [message] + speaker=second_unit + message=$random_liches[$random].quote + [/message] - [else] - [unstore_unit] - variable=second_unit - find_vacant=no - [/unstore_unit] + {CLEAR_VARIABLE random_liches[$random]} + [/event] - [message] - speaker=second_unit - message=$lich_quote_$random|| - [/message] - [/else] - [/if] + # If only one random lich remains (all others have been attacked but not + # enough of them killed to break the spell), then just reveal Mal-Ravanal + # since the player already knows where he is + [event] + name=attack end - [gold] - amount=50 - side=$second_unit.side - [/gold] + [filter_condition] + [have_unit] + [filter_wml] + [variables] + random_lich=yes + [/variables] + [/filter_wml] + + count=1 + [/have_unit] + [/filter_condition] - {VARIABLE lich_name_$random| "used"} + [fire_event] + name=reveal ravanal + + [primary_unit] + [filter_wml] + [variables] + random_lich=yes + [/variables] + [/filter_wml] + [/primary_unit] + [/fire_event] [/event] - #make sure the undead leaders don't run out of troops too easily... + # Reveal remaining liches when X of them have been killed [event] name=die first_time_only=no [filter] - side=2,3,4,5,6,7,8 + canrecruit=yes + type_tree=Lich [/filter] - [gold] - side=$unit.side - amount=$unit.cost - [/gold] + {VARIABLE_OP liches_killed add 1} + + [if] + [variable] + name=liches_killed + greater_than_equal_to=$liches_to_kill + [/variable] + + [then] + [sound] + name=magic-dark-big-miss.ogg + [/sound] + + [color_adjust] + red,green,blue=127,64,127 + [/color_adjust] + [delay] + time=100 + [/delay] + [color_adjust] + red,green,blue=-127,-191,-127 + [/color_adjust] + [delay] + time=100 + [/delay] + [color_adjust] + red,green,blue=127,64,127 + [/color_adjust] + [delay] + time=100 + [/delay] + [color_adjust] + red,green,blue=0,0,0 + [/color_adjust] + + [message] + speaker=Owaec + message= _ "Their spell is broken! There he is!" + [/message] + + [store_unit] + [filter] + [filter_wml] + [variables] + random_lich=yes + [/variables] + [/filter_wml] + + [not] + x,y=$x2,$y2 + [/not] + [/filter] + + kill=no + variable=remaining_random_liches + [/store_unit] + + {VARIABLE longest_path_to_dacyn 0} + {VARIABLE farthest_lich_side ""} + + [foreach] + array=remaining_random_liches + + [do] + [find_path] + [traveler] + canrecruit=yes + side=$this_item.side + [/traveler] + + [destination] + [filter] + id=Dacyn + [/filter] + [/destination] + + allow_multiple_turns=yes + check_zoc=no + variable=path_to_dacyn + [/find_path] + + [if] + [variable] + name=longest_path_to_dacyn + less_than=$path_to_dacyn.hexes + [/variable] + + [then] + {VARIABLE longest_path_to_dacyn $path_to_dacyn.hexes} + {VARIABLE farthest_lich_side $this_item.side} + [/then] + [/if] + [/do] + [/foreach] + + [scroll_to_unit] + canrecruit=yes + side=$farthest_lich_side + [/scroll_to_unit] + + [fire_event] + name=reveal ravanal + + [primary_unit] + canrecruit=yes + side=$farthest_lich_side + [/primary_unit] + [/fire_event] + + [store_unit] + [filter] + find_in=remaining_random_liches + + [not] + side=$farthest_lich_side + [/not] + [/filter] + + kill=no + variable=remaining_random_liches + [/store_unit] + + [foreach] + array=remaining_random_liches + + [do] + {RANDOM "0..$($random_liches.length - 1)"} + + {VARIABLE this_item.name $random_liches[$random].name} + {VARIABLE this_item.variables.random_lich no} + + [unstore_unit] + variable=this_item + find_vacant=no + [/unstore_unit] + + [object] + silent=yes + + [filter] + x,y=$this_item.x,$this_item.y + [/filter] + + [effect] + apply_to=halo + halo="" + [/effect] + [/object] + + {CLEAR_VARIABLE random_liches[$random]} + [/do] + [/foreach] + + {CLEAR_VARIABLE longest_path_to_dacyn,farthest_lich_side,path_to_dacyn,liches_killed,remaining_random_liches} + [/then] + [/if] [/event] - #discourage players from just killing all the liches... + # Don't allow the liches to be baited out of their castles [event] - name=die + name=turn refresh first_time_only=no - [filter] - side=2,3,4,5,6,7,8 - type=Lich - [/filter] + [filter_condition] + [variable] + name=side_number + greater_than=1 + [/variable] + [/filter_condition] - [gold] - side=2,3,4,5,6,7,8 - amount=$lich_death_bonus - [/gold] - {VARIABLE_OP lich_death_bonus add 25} + [modify_unit] + [filter] + side=$side_number + canrecruit=yes + [/filter] + + moves=0 + [/modify_unit] [/event] # Enemy unit reaches the Weldyn keep