git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7657 c06c8d41-db1a-0410-9941-cceddc491573
NCKCO6W5HW7C6OPJG4EVHKQCDX6AL7S4ACORY45STKQTNPMAJ7IQC
IHV7JHD4E67NEGLZEO3FPQGJPJF3IAV6QV5A63FPG4SU2VRFV47QC
C3IXVWASG4ZZNG72FVRIT45VQHLBSP4YW5RE2JTJOQ3RAFRH5OUQC
66PPHRP2IW7VAVENBJ4KRO6MEF2HKYZHO4RWCISXC2ZXM6CK2XEAC
FKRLQJYHK3GB6HHSNNFQ7L57ZAR52LSTBG5B6SNJBYZ2LQ36P67AC
NKONHW4JNY6HP2M63MNPM3H64ZWSUNUT5FX2STW4KTS4AMXJXXVQC
X7MFMKQTNZ2IWBFVGS6WQV7NRNKJ3DWQAW2X7IQMFQQXW24AHPZQC
CM2YC5KBTUB4JFT3CL3NRS7V5X76M7RI7SNT4XK6IOVBZA2URRKAC
Y4WCLUMXXAYCZK4QMOEFK6JACNGO7RDASZ2GZWBYLJFQVWGFJE4QC
MT3256427VMCV4JUFWCN7ULY4KXSND5ZL5THDKYNWWYOXXR5DLIQC
4N5PW5S3OV25HFN634NNWMMYX26NA2TB6TVFG4UMYSZ2VBJWKE4QC
CPBVQFT7NWEYLYD34D5VYZIEOZ32YADXYTSFMS635YNXX4OFIZVAC
KTRWLM6WDL4GAAJZNLQEEA3TGY2OKYZZUAAT4TCAVKRTR2NQBWUQC
CI2RMLJLIAZMEGNN6LJN6PSHXHLPG7PXFIDYRGFPVMDPJ2R4S4NQC
5DECJIOSMFWX7DMDTGVNPNV6QQP6O34F3XHFHRXGCTJUZMVIXT7QC
BEJPFLSQYOLJETSLYRTROTRPJZEJDROGDX7MLBCWJLMIRZQBLEYQC
-- Any given ziggurat will use the same builder for all its levels.
z.builder = ziggurat_choose_builder()
-- Any given ziggurat will use the same builder for all its levels,
-- and the same colours for outer walls. Before choosing the builder,
-- we specify a global excentricity. If zig_exc=0, then the ellipses
-- will be circles etc. It is not the actual excentricity but some
-- value between 0 and 100. For deformed ellipses and rectangles, make
-- sure that the map is wider than it is high for the sake of ASCII.
-- 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 is the local eccentricity for the two rectangles
-- exc grows with depth as 0-1, 1, 1-2, 2, 2-3 ...
local exc = math.floor(zig().depth / 2)
if ((zig().depth-1) % 2) == 0 and crawl.coinflip() then
local b = math.floor(math.sqrt(area+12*exc*exc)) - 4*exc
if b <= 0 then
b = 1
end
local a = math.floor((area + b - 1) / b)
local b = math.floor(math.sqrt(area+4*exc*exc))
local a = b-2*exc
end
end
local function ziggurat_stairs(entry, exit)
zigstair(entry.x, entry.y, "stone_arch", "stone_stairs_up_i")
if zig().depth < ZIGGURAT_MAX then
zigstair(exit.x, exit.y, "stone_stairs_down_i", zig_go_deeper)
end
zigstair(exit.x, exit.y + 1, "exit_portal_vault", cleanup_ziggurat())
zigstair(exit.x, exit.y - 1, "exit_portal_vault", cleanup_ziggurat())
end
local function ziggurat_furnish(centre, entry, exit)
local monster_generation = choose_monster_set()
-- If we're going to spawn jellies, do our loot protection thing.
if monster_generation.jelly_protect then
zig().level.jelly_protect = true
end
ziggurat_create_loot(entry, exit)
if not zig().level.loot_chamber then
-- Place pillars if we did not create a loot chamber.
ziggurat_place_pillars(centre)
end
ziggurat_create_monsters(exit, monster_generation.fn)
local function needs_colour(p)
return not dgn.in_vault(p.x, p.y)
and dgn.grid(p.x, p.y) == dgn.fnum("stone_wall")
if zig().depth < ZIGGURAT_MAX then
zigstair(exit.x, exit.y, "stone_stairs_down_i", zig_go_deeper)
end
-- builds elliptic ziggurat maps
-- given the area, half axes a and b are determined by:
-- pi*a*b=area,
-- a=b for zig_exc=0,
-- a=b*3/2 for zig_exc=100
local function ziggurat_ellipse_builder(e)
local grid = dgn.grid
-- If we're going to spawn jellies, do our loot protection thing.
if monster_generation.jelly_protect then
zig().level.jelly_protect = true
end
local area = map_area()
local b = math.floor(math.sqrt(200*area/(200+zig_exc) * 100/314))
local a = math.floor(b * (200+zig_exc) / 200)
local cx, cy = dgn.GXM / 2, dgn.GYM / 2
end
-- Returns a list of the keys in the given map.
function util.keys(map)
local keys = { }
for key, _ in pairs(ziggurat_builder_map) do
table.insert(keys, key)
end
return keys
end
-- Returns a list of the values in the given map.
function util.values(map)
local values = { }
for _, value in pairs(ziggurat_builder_map) do
table.insert(values, value)
end
return values