From a8f057d5be765194c47b86efcfd74943ea879fe0 Mon Sep 17 00:00:00 2001 From: Lukas Jox Date: Fri, 13 Nov 2020 00:12:05 +0100 Subject: [PATCH] SoF S4: prevent resource spawn on strange locations; fixes #5278 --- .../scenarios/4_Gathering_Materials.cfg | 148 ++++++++++-------- 1 file changed, 86 insertions(+), 62 deletions(-) diff --git a/data/campaigns/Sceptre_of_Fire/scenarios/4_Gathering_Materials.cfg b/data/campaigns/Sceptre_of_Fire/scenarios/4_Gathering_Materials.cfg index 16d36eb809c0..c1faca99b11f 100644 --- a/data/campaigns/Sceptre_of_Fire/scenarios/4_Gathering_Materials.cfg +++ b/data/campaigns/Sceptre_of_Fire/scenarios/4_Gathering_Materials.cfg @@ -391,6 +391,68 @@ variable=resource_return_locations [/store_locations] + # Here we overlay a mask containing a rather random pattern of + # suitable terrains on the map, because the map generator itself + # only places the very basic terrains (floor, walls, etc) + # also, include tracks overlay in mask + + [terrain_mask] + x,y=1,1 + mask="{campaigns/Sceptre_of_Fire/maps/4_Gathering_Materials-random.mask}" + + [rule] + old=Uu + new=Uu^Ii,Uu^Tf,Tb^Tf,Uh,Ww,Cud + [/rule] + + [rule] + old=Xu + new=*^Br\ + terrain=Uh^Br\ + [/rule] + + [rule] + old=Xu + new=*^Br| + terrain=Uh^Br| + [/rule] + + [rule] + old=Xu + new=*^Br/ + terrain=Uh^Br/ + [/rule] + + [rule] + old=Xu,Cud,Kud + use_old=yes + [/rule] + + [rule] + new=*^Br\ + use_old=no + layer=both + replace_if_failed=yes + terrain=Uu^Br\ + [/rule] + + [rule] + new=*^Br| + use_old=no + layer=both + replace_if_failed=yes + terrain=Uu^Br| + [/rule] + + [rule] + new=*^Br/ + use_old=no + layer=both + replace_if_failed=yes + terrain=Uu^Br/ + [/rule] + [/terrain_mask] + # Here we need to randomize the coal and gold locations by # hand, because the map generator can otherwise sometimes place # them inside cavewall. @@ -412,6 +474,14 @@ variable=possible_coal_1_locations [/store_locations] + [store_locations] + find_in=possible_coal_1_locations + [not] + terrain=Kud,Cud,Re,*^Br* + [/not] + variable=possible_coal_1_locations + [/store_locations] + {RANDOM 1..$possible_coal_1_locations.length} {VARIABLE_OP random sub 1} @@ -435,6 +505,14 @@ variable=possible_coal_2_locations [/store_locations] + [store_locations] + find_in=possible_coal_2_locations + [not] + terrain=Kud,Cud,Re,*^Br* + [/not] + variable=possible_coal_2_locations + [/store_locations] + {RANDOM 1..$possible_coal_2_locations.length} {VARIABLE_OP random sub 1} @@ -474,6 +552,14 @@ variable=possible_gold_locations [/store_locations] + [store_locations] + find_in=possible_gold_locations + [not] + terrain=Kud,Cud,Re,*^Br* + [/not] + variable=possible_gold_locations + [/store_locations] + {RANDOM 1..$possible_gold_locations.length} {VARIABLE_OP random sub 1} @@ -502,68 +588,6 @@ {CLEAR_VARIABLE possible_coal_2_locations} {CLEAR_VARIABLE possible_gold_locations} - # Here we overlay a mask containing a rather random pattern of - # suitable terrains on the map, because the map generator itself - # only places the very basic terrains (floor, walls, etc) - # also, include tracks overlay in mask - - [terrain_mask] - x,y=1,1 - mask="{campaigns/Sceptre_of_Fire/maps/4_Gathering_Materials-random.mask}" - - [rule] - old=Uu - new=Uu^Ii,Uu^Tf,Tb^Tf,Uh,Ww,Cud - [/rule] - - [rule] - old=Xu - new=*^Br\ - terrain=Uh^Br\ - [/rule] - - [rule] - old=Xu - new=*^Br| - terrain=Uh^Br| - [/rule] - - [rule] - old=Xu - new=*^Br/ - terrain=Uh^Br/ - [/rule] - - [rule] - old=Xu,Cud,Kud - use_old=yes - [/rule] - - [rule] - new=*^Br\ - use_old=no - layer=both - replace_if_failed=yes - terrain=Uu^Br\ - [/rule] - - [rule] - new=*^Br| - use_old=no - layer=both - replace_if_failed=yes - terrain=Uu^Br| - [/rule] - - [rule] - new=*^Br/ - use_old=no - layer=both - replace_if_failed=yes - terrain=Uu^Br/ - [/rule] - [/terrain_mask] - # one cart near the player, another cart randomly further out # can probably be better optimized [store_locations]