More interesting Gehennom levels

Instead of just plain old boring mazes, spice up Gehennom by
occasionally adding lava, iron bars, or even mines-style levels
(with lava, of course).

Of the fixed Gehennom levels, only Asmodeus' lair has been changed
to add some random lava pools.

Also some lua fixes and changes:
- Fixed a selection negation bounding box being wrong.
- Fixed a selection negated and ORed returning wrong results.
- des.map now returns a selection of the map grids it touched.
- When using des.map contents-function the commands following the
  map are not relative to it.
This commit is contained in:
Pasi Kallinen
2023-01-09 22:25:23 +02:00
parent 7c72c1f141
commit 4af086be73
13 changed files with 310 additions and 65 deletions

View File

@@ -51,6 +51,58 @@ function monkfoodshop()
return "food shop";
end
-- tweaks to gehennom levels; might add random lava pools or
-- a lava river.
-- protected_area is a selection where no changes will be done.
function hell_tweaks(protected_area)
local liquid = "L";
local ground = ".";
local prot = protected_area:negate();
-- random pools
if (percent(20 + u.depth)) then
local pools = selection.new();
local maxpools = 5 + math.random(u.depth);
for i = 1, maxpools do
pools:set();
end
pools = pools | selection.grow(selection.set(selection.new()), "west")
pools = pools | selection.grow(selection.set(selection.new()), "north")
pools = pools | selection.grow(selection.set(selection.new()), "random")
pools = pools & prot;
if (percent(80)) then
local poolground = pools:clone():grow("all") & prot;
local pval = math.random(1, 8) * 10;
des.terrain(poolground:percentage(pval), ground)
end
des.terrain(pools, liquid)
end
-- river
if (percent(50)) then
local floor = selection.match(ground);
local a = selection.rndcoord(floor);
local b = selection.rndcoord(floor);
local lavariver = selection.randline(selection.new(), a.x, a.y, b.x, b.y, 10);
if (percent(50)) then
lavariver = selection.grow(lavariver, "north");
end
if (percent(50)) then
lavariver = selection.grow(lavariver, "west");
end
if (percent(25)) then
local riverbanks = selection.grow(lavariver);
riverbanks = riverbanks & prot;
des.terrain(selection.percentage(riverbanks, 50), ground);
end
lavariver = lavariver & prot;
des.terrain(lavariver, liquid);
end
end
-- pline with variable number of arguments
function pline(fmt, ...)
nh.pline(string.format(fmt, table.unpack({...})));