From b81f40c68c5ede137cd966e332d1cb7315ceff5a Mon Sep 17 00:00:00 2001 From: dshaligram Date: Wed, 26 Nov 2008 18:59:26 +0000 Subject: Ziggurat tweaks (dpeg). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7642 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/dat/clua/ziggurat.lua | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/crawl-ref/source/dat/clua/ziggurat.lua b/crawl-ref/source/dat/clua/ziggurat.lua index 13e8c5436e..f769882015 100644 --- a/crawl-ref/source/dat/clua/ziggurat.lua +++ b/crawl-ref/source/dat/clua/ziggurat.lua @@ -136,8 +136,8 @@ local function zig_go_deeper() end local function map_area() - local base_area = 20 + 8 * zig_depth() - return 2 * base_area + crawl.random2(base_area) + local base_area = 5 + 2 * zig_depth() + return 4 * base_area + crawl.random2(base_area) end local function clamp_in(val, low, high) @@ -159,8 +159,18 @@ local function rectangle_dimensions() local cx, cy = dgn.GXM / 2, dgn.GYM / 2 - local asqrt = math.sqrt(area) - local b = crawl.random_range(1 + asqrt / 2, asqrt + 1) + local function rectangle_eccentricity() + -- exc is the excentrity for the two rectangle, it grows with depth as + -- 0, 0-1, 1, 1-2, 2, ... + local exc = math.floor((zig().depth-1) / 2) + if ((zig().depth-1) % 2) ~= 0 and crawl.coinflip() then + exc = exc + 1 + end + return exc + end + + local exc = rectangle_eccentricity() + local b = math.floor(math.sqrt(area+12*exc*exc)) - 4*exc local a = math.floor((area + b - 1) / b) local a2 = math.floor(a / 2) + (a % 2) -- cgit v1.2.3-54-g00ecf