frost module: during winter, some oceans freeze over

This commit is contained in:
Enno Rehling 2010-09-11 18:48:08 -07:00
parent 6551236544
commit be2d7d203d
3 changed files with 54 additions and 0 deletions

View File

@ -22,6 +22,8 @@
<coast terrain="plain"/> <coast terrain="plain"/>
<coast terrain="swamp"/> <coast terrain="swamp"/>
<coast terrain="desert"/> <coast terrain="desert"/>
<coast terrain="iceberg_sleep"/>
<coast terrain="iceberg"/>
<construction skill="shipcraft" minskill="1" maxsize="10" reqsize="1"> <construction skill="shipcraft" minskill="1" maxsize="10" reqsize="1">
<requirement type="log" quantity="1"/> <requirement type="log" quantity="1"/>
</construction> </construction>
@ -83,6 +85,8 @@
<ship name="catamaran" range="7" storm="0.25" damage="1.00" cabins="22" cargo="10000" cptskill="7" minskill="1" sumskill="20" opensea="yes"> <ship name="catamaran" range="7" storm="0.25" damage="1.00" cabins="22" cargo="10000" cptskill="7" minskill="1" sumskill="20" opensea="yes">
<coast terrain="ocean"/> <coast terrain="ocean"/>
<coast terrain="plain"/> <coast terrain="plain"/>
<coast terrain="iceberg_sleep"/>
<coast terrain="iceberg"/>
<construction skill="shipcraft" minskill="8" maxsize="30" reqsize="1"> <construction skill="shipcraft" minskill="8" maxsize="30" reqsize="1">
<requirement type="mallorn" quantity="1"/> <requirement type="mallorn" quantity="1"/>
<requirement type="money" quantity="100"/> <requirement type="money" quantity="100"/>
@ -93,6 +97,8 @@
<ship name="cog" range="4" storm="0.50" damage="1.00" cabins="50" cargo="200000" cptskill="4" minskill="1" sumskill="20" opensea="yes"> <ship name="cog" range="4" storm="0.50" damage="1.00" cabins="50" cargo="200000" cptskill="4" minskill="1" sumskill="20" opensea="yes">
<coast terrain="ocean"/> <coast terrain="ocean"/>
<coast terrain="plain"/> <coast terrain="plain"/>
<coast terrain="iceberg_sleep"/>
<coast terrain="iceberg"/>
<construction skill="shipcraft" minskill="4" maxsize="100" reqsize="1"> <construction skill="shipcraft" minskill="4" maxsize="100" reqsize="1">
<requirement type="log" quantity="1"/> <requirement type="log" quantity="1"/>
</construction> </construction>
@ -101,6 +107,8 @@
<ship name="caravel" range="4" storm="0.50" damage="1.00" cabins="150" cargo="600000" cptskill="6" minskill="1" sumskill="30" opensea="yes"> <ship name="caravel" range="4" storm="0.50" damage="1.00" cabins="150" cargo="600000" cptskill="6" minskill="1" sumskill="30" opensea="yes">
<coast terrain="ocean"/> <coast terrain="ocean"/>
<coast terrain="plain"/> <coast terrain="plain"/>
<coast terrain="iceberg_sleep"/>
<coast terrain="iceberg"/>
<construction skill="shipcraft" minskill="6" maxsize="300" reqsize="1"> <construction skill="shipcraft" minskill="6" maxsize="300" reqsize="1">
<requirement type="log" quantity="1"/> <requirement type="log" quantity="1"/>
</construction> </construction>
@ -111,6 +119,8 @@
<modifier type="defense" value="+2"/> <modifier type="defense" value="+2"/>
<coast terrain="ocean"/> <coast terrain="ocean"/>
<coast terrain="plain"/> <coast terrain="plain"/>
<coast terrain="iceberg_sleep"/>
<coast terrain="iceberg"/>
<construction skill="shipcraft" minskill="5" maxsize="100" reqsize="1"> <construction skill="shipcraft" minskill="5" maxsize="100" reqsize="1">
<requirement type="log" quantity="1"/> <requirement type="log" quantity="1"/>
<requirement type="money" quantity="10"/> <requirement type="money" quantity="10"/>
@ -121,6 +131,8 @@
<modifier type="defense" value="+2"/> <modifier type="defense" value="+2"/>
<coast terrain="ocean"/> <coast terrain="ocean"/>
<coast terrain="plain"/> <coast terrain="plain"/>
<coast terrain="iceberg_sleep"/>
<coast terrain="iceberg"/>
<construction skill="shipcraft" minskill="7" maxsize="300" reqsize="1"> <construction skill="shipcraft" minskill="7" maxsize="300" reqsize="1">
<requirement type="log" quantity="1"/> <requirement type="log" quantity="1"/>
<requirement type="money" quantity="10"/> <requirement type="money" quantity="10"/>
@ -133,6 +145,8 @@
<modifier type="tactics" factor="2.00"/> <modifier type="tactics" factor="2.00"/>
<coast terrain="ocean"/> <coast terrain="ocean"/>
<coast terrain="plain"/> <coast terrain="plain"/>
<coast terrain="iceberg_sleep"/>
<coast terrain="iceberg"/>
<construction skill="shipcraft" minskill="5" maxsize="100" reqsize="1"> <construction skill="shipcraft" minskill="5" maxsize="100" reqsize="1">
<requirement type="log" quantity="1"/> <requirement type="log" quantity="1"/>
<requirement type="money" quantity="10"/> <requirement type="money" quantity="10"/>
@ -144,6 +158,8 @@
<modifier type="tactics" factor="2.00"/> <modifier type="tactics" factor="2.00"/>
<coast terrain="ocean"/> <coast terrain="ocean"/>
<coast terrain="plain"/> <coast terrain="plain"/>
<coast terrain="iceberg_sleep"/>
<coast terrain="iceberg"/>
<construction skill="shipcraft" minskill="7" maxsize="300" reqsize="1"> <construction skill="shipcraft" minskill="7" maxsize="300" reqsize="1">
<requirement type="log" quantity="1"/> <requirement type="log" quantity="1"/>
<requirement type="money" quantity="10"/> <requirement type="money" quantity="10"/>

36
scripts/e3a/frost.lua Normal file
View File

@ -0,0 +1,36 @@
module('frost', package.seeall)
local function is_winter(turn)
local season = get_season(turn)
return season == "calendar::winter"
end
local function freeze(r)
for i, rn in ipairs(r.adj) do
-- each region has a chance to freeze
if rn.terrain=="ocean" and math.mod(rng_int(), 100)<20 then
rn.terrain = "iceberg_sleep"
end
end
end
local function thaw(r)
r.terrain = "ocean"
end
function update()
local turn = get_turn()
if is_winter(turn) then
for r in regions() do
if r.terrain=="glacier" then
freeze(r)
end
end
else if is_winter(turn-1) then
for r in regions() do
if r.terrain=="iceberg_sleep" then
thaw(r)
end
end
end
end

View File

@ -1,4 +1,5 @@
require "multis" require "multis"
require "e3a.frost"
function apply_fixes() function apply_fixes()
local turn = get_turn() local turn = get_turn()
@ -48,6 +49,7 @@ function process(orders)
update_embassies() update_embassies()
update_guards() update_guards()
update_scores() update_scores()
frost.update()
local localechange = { de = { "ii" } } local localechange = { de = { "ii" } }
change_locales(localechange) change_locales(localechange)