diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-05-02 19:59:20 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-05-02 19:59:20 +0000 |
commit | 57c4e4771db2f6926941df4210af1a3bef8887b6 (patch) | |
tree | aa87b913d7e0f827d2190fd0ab7049b79c233fbb /crawl-ref/source/dat/clua | |
parent | 77799c38dcd4bb865be01a93a76344162c043245 (diff) | |
download | crawl-ref-57c4e4771db2f6926941df4210af1a3bef8887b6.tar.gz crawl-ref-57c4e4771db2f6926941df4210af1a3bef8887b6.zip |
Allow ziggurat levels to generate all monsters awake
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9720 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/dat/clua')
-rw-r--r-- | crawl-ref/source/dat/clua/ziggurat.lua | 76 |
1 files changed, 52 insertions, 24 deletions
diff --git a/crawl-ref/source/dat/clua/ziggurat.lua b/crawl-ref/source/dat/clua/ziggurat.lua index 400ccbc1e9..c1d0898fa0 100644 --- a/crawl-ref/source/dat/clua/ziggurat.lua +++ b/crawl-ref/source/dat/clua/ziggurat.lua @@ -126,11 +126,24 @@ end ----------------------------------------------------------------------------- -- Ziggurat level builders. +beh_wander = mons.behaviour("wander") + +function ziggurat_awaken_all(mons) + mons.beh = beh_wander +end + function ziggurat_build_level(e) if zig().depth == 1 then e.welcome("You land on top of a ziggurat so tall you cannot make out the ground.") end local builder = zig().builder + + local depth = zig().depth + + -- XXX: This is a placeholder! + local generate_awake = depth > 9 and crawl.random2(30) < depth + zig().monster_hook = generate_awake and ziggurat_awaken_all + if builder then return ziggurat_builder_map[builder](e) end @@ -221,12 +234,27 @@ local function depth_lt(lev) end end +local function zig_monster_fn(spec) + local mfn = dgn.monster_fn(spec) + return function (x, y) + local mons = mfn(x, y) + if mons then + local monster_hook = zig().monster_hook + if monster_hook then + monster_hook(mons) + end + end + return mons + end +end + local function monster_creator_fn(arg) local atyp = type(arg) if atyp == "string" then local _, _, branch = string.find(arg, "^place:(%w+):") local _, _, place = string.find(arg, "^place:(%w+):?") - local mcreator = dgn.monster_fn(arg) + local mcreator = zig_monster_fn(arg) + local function mspec(x, y, nth) if branch then set_floor_colour(dgn.br_floorcol(branch)) @@ -277,37 +305,37 @@ mset(with_props("place:Slime:$", { jelly_protect = true }), -- returned by this function will also be used to init the monster -- population (with dgn.set_random_mon_list). As an example: mset(spec_fn(function () - local d = math.max(0, zig().depth - 12) - return "place:Vault:$ w:60 / ancient lich w:" .. d - end)) + local d = math.max(0, zig().depth - 12) + return "place:Vault:$ w:60 / ancient lich w:" .. d + end)) mset(spec_fn(function () - local d = math.max(0, zig().depth - 5) - return "place:Pan w:40 / pandemonium lord w:" .. d - end)) + local d = math.max(0, zig().depth - 5) + return "place:Pan w:40 / pandemonium lord w:" .. d + end)) mset(spec_fn(function () - local d = zig().depth + 5 - return "place:Tomb:$ w:200 / greater mummy w:" .. d - end)) + local d = zig().depth + 5 + return "place:Tomb:$ w:200 / greater mummy w:" .. d + end)) mset(spec_fn(function () - local d = 300 - 10 * zig().depth - return "place:Elf:$ w:" .. d .. " / deep elf sorcerer / " .. - "deep elf blademaster / deep elf master archer / " .. - "deep elf annihilator / deep elf demonologist" - end)) + local d = 300 - 10 * zig().depth + return "place:Elf:$ w:" .. d .. " / deep elf sorcerer / " .. + "deep elf blademaster / deep elf master archer / " .. + "deep elf annihilator / deep elf demonologist" + end)) mset(spec_fn(function () - local d = 310 - 10 * zig().depth - local e = math.max(0, zig().depth - 20) - return "place:Orc:$ w:" .. d .. " / orc warlord / orc knight / " .. - "orc high priest w:5 / orc sorcerer w:5 / stone giant / " .. - "moth of wrath w:" .. e - end)) + local d = 310 - 10 * zig().depth + local e = math.max(0, zig().depth - 20) + return "place:Orc:$ w:" .. d .. " / orc warlord / orc knight / " .. + "orc high priest w:5 / orc sorcerer w:5 / stone giant / " .. + "moth of wrath w:" .. e + end)) -local drac_creator = dgn.monster_fn("random draconian") +local drac_creator = zig_monster_fn("random draconian") local function mons_drac_gen(x, y, nth) if nth == 1 then dgn.set_random_mon_list("random draconian") @@ -316,8 +344,8 @@ local function mons_drac_gen(x, y, nth) return drac_creator(x, y) end -local pan_lord_fn = dgn.monster_fn("pandemonium lord") -local pan_critter_fn = dgn.monster_fn("place:Pan") +local pan_lord_fn = zig_monster_fn("pandemonium lord") +local pan_critter_fn = zig_monster_fn("place:Pan") local function mons_panlord_gen(x, y, nth) set_random_floor_colour() |