From 64d3aa1ab69cf5269b19d2c695a659a3bfc3efd9 Mon Sep 17 00:00:00 2001 From: sigurdfdragon Date: Wed, 22 Nov 2017 17:36:04 -0500 Subject: [PATCH] SotA: Fix and improve freeze/thaw unit implementation Bug was that when a unit was thawed, mouse over in unit sidebar would show incorrect movement costs (all 1's). New implementation properly uses {UNREACHABLE} and makes use of the now available [remove_object] tag. --- .../utils/sota-utils.cfg | 74 ++++++------------- 1 file changed, 21 insertions(+), 53 deletions(-) diff --git a/data/campaigns/Secrets_of_the_Ancients/utils/sota-utils.cfg b/data/campaigns/Secrets_of_the_Ancients/utils/sota-utils.cfg index 90fbf869238c..67de70fa614b 100644 --- a/data/campaigns/Secrets_of_the_Ancients/utils/sota-utils.cfg +++ b/data/campaigns/Secrets_of_the_Ancients/utils/sota-utils.cfg @@ -552,6 +552,8 @@ #define FREEZE_UNIT ID [object] + id=freeze_unit + take_only_once=no silent=yes duration=scenario # So this object will not be in the save files forever. [filter] @@ -559,66 +561,32 @@ [/filter] [effect] apply_to=movement_costs - replace=no # So this amount is added to the current number. + replace=yes [movement_costs] - shallow_water=100 - reef=100 - swamp_water=100 - flat=100 - sand=100 - forest=100 - hills=100 - mountains=100 - village=100 - castle=100 - cave=100 - frozen=100 - unwalkable=100 - fungus=100 + shallow_water={UNREACHABLE} + reef={UNREACHABLE} + swamp_water={UNREACHABLE} + flat={UNREACHABLE} + sand={UNREACHABLE} + forest={UNREACHABLE} + hills={UNREACHABLE} + mountains={UNREACHABLE} + village={UNREACHABLE} + castle={UNREACHABLE} + cave={UNREACHABLE} + frozen={UNREACHABLE} + unwalkable={UNREACHABLE} + fungus={UNREACHABLE} [/movement_costs] [/effect] [/object] #enddef #define THAW_UNIT ID - [store_unit] - [filter] - id={ID} - # This prevents a unit from being thawed that was not frozen first: - movement_cost=100-120 - [/filter] - variable=stored_unit - [/store_unit] - [object] - silent=yes - duration=scenario - [filter] - id={ID} - [/filter] - [effect] - apply_to=movement_costs - replace=no # This amount is added to the current number. - [movement_costs] - shallow_water=-100 - reef=-100 - swamp_water=-100 - flat=-100 - sand=-100 - forest=-100 - hills=-100 - mountains=-100 - village=-100 - castle=-100 - cave=-100 - frozen=-100 - unwalkable=-100 - fungus=-100 - [/movement_costs] - [/effect] - [/object] - [clear_variable] - name=stored_unit - [/clear_variable] + [remove_object] + id={ID} + object_id=freeze_unit + [/remove_object] #enddef # Finds the nearest hex to (X,Y) within MAX_DISTANCE that matches the FILTER, and stores