From 442284de2a364d4f485469ca759f0183bf42981b Mon Sep 17 00:00:00 2001 From: Gregory A Lundberg Date: Sat, 24 Sep 2016 22:11:48 -0500 Subject: [PATCH] DiD S04 Todo: Add snow Lifted code from HttT to add snow coverage. --- .../scenarios/04_Beginning_of_the_Revenge.cfg | 48 ++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/data/campaigns/Descent_Into_Darkness/scenarios/04_Beginning_of_the_Revenge.cfg b/data/campaigns/Descent_Into_Darkness/scenarios/04_Beginning_of_the_Revenge.cfg index 7e0037ac955bf..eba3e86f1afdf 100644 --- a/data/campaigns/Descent_Into_Darkness/scenarios/04_Beginning_of_the_Revenge.cfg +++ b/data/campaigns/Descent_Into_Darkness/scenarios/04_Beginning_of_the_Revenge.cfg @@ -133,7 +133,53 @@ [/gold_carryover] [/objectives] - # TODO: manually add snow detritus + [lua] + code=<< +-- For prime-time use the filter terrain needs to come in and the convert +-- table needs to be VERY complete. Or, rename this to morph_terrain and +-- have the conversion table come in as an argument, too. + +local locations = wesnoth.get_locations{terrain = 'Ce,Chr,Co,Gg,Gg^Efm,Gg^Vc,Gg^Vo,Gs^Fds,Gs^Fms,Gs^Fmw,Gs^Fp,Hh,Hh^Vhh,Hh^Vo,Ke,Khr,Ko,Mm,Mm^Xm'} + +local coverage = 0.15 +-- Constant 15% random coverage. +-- Valid range is (0.0 .. 1.0) +-- Do not raise too high or player may not be able to make it in the time allotted. + +local snowNeeded = (#locations * coverage) + +local convert = { + ['Ce'] = 'Cea', + ['Chr'] = 'Cha', + ['Co'] = 'Coa', + ['Gg'] = 'Aa', + ['Gg^Efm'] = 'Aa', + ['Gg^Vc'] = 'Aa^Vca', + ['Gg^Vo'] = 'Aa^Voa', + ['Gs^Fds'] = 'Aa^Fda', + ['Gs^Fms'] = 'Aa^Fma', + ['Gs^Fmw'] = 'Aa^Fma', + ['Gs^Fp'] = 'Aa^Fpa', + ['Hh'] = 'Ha', + ['Hh^Vhh'] = 'Ha^Vha', + ['Hh^Vo'] = 'Ha^Voa', + ['Ke'] = 'Kea', + ['Khr'] = 'Kha', + ['Ko'] = 'Koa', + ['Mm'] = 'Ms', + ['Mm^Xm'] = 'Ms^Xm' +} + +local loopCounter +for loopCounter = 1, snowNeeded do + local locationsIndex = wesnoth.random(#locations) + local coordinate = locations[locationsIndex] + local terrainCode = wesnoth.get_terrain(coordinate[1], coordinate[2]) + wesnoth.set_terrain(coordinate[1], coordinate[2], (convert[terrainCode] or terrainCode)) + table.remove(locations, locationsIndex) +end + >> + [/lua] [recall] id=Darken Volk