From 42d0d63ae25d7ec3e5ded02ae77489cc5e8371f9 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Sat, 13 Dec 2008 01:00:01 +0000 Subject: Breaks savefile compatibility. Allow Shadow Creatures spell (along with anything that uses create_monster(), mons_place(), place_monster() or pick_random_monster()) to work in portal vaults; only fixed ziggurats to use it. Must be done by manually calling dgn.set_random_mon_list(); can't automatically set it from MONS since the actual frequency of the monster specified that way is controlled by the number of 1/2/3/etc symbols that are in the map combined with symbol shufflings and substitutions. Can add an RMONS keyword to handle it if needed. Limitations: can only use level id or monster type + base type. Monster number (specific number of hydra heads), colour, items, band, and patrolling are all discarded/ignored. This can be improved if it's too limiting. New per-level env.properties CrawlHashTable stores the information. env.properties can be used to store new per-level data without breaking savefile compatibility (though changing the handling of old data in env.properties can still break compatibility). Random monster spawn rate is now controlled by the per-level env.spawn_random_rate (though the default rates are all the same as before), in case any weird portal vaults want to turn on random monster spawning. Could also be used to alter the random spawn rate for places like Vault:8 Prevented Shadow Creatues from working in the Temple. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7816 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/dungeon.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'crawl-ref/source/dungeon.cc') diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 335aba7330..3a43bfe349 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -883,6 +883,9 @@ static void _reset_level() dgn_check_connectivity = false; dgn_zones = 0; + // Forget level properties. + env.properties.clear(); + // Blank level with DNGN_ROCK_WALL. grd.init(DNGN_ROCK_WALL); env.grid_colours.init(BLACK); @@ -924,6 +927,26 @@ static void _reset_level() else env.level_flags = 0; + // Set default random monster generation rate (smaller is more often, + // except that 0 == no random monsters). + if (you.level_type == LEVEL_DUNGEON) + { + if (you.where_are_you == BRANCH_ECUMENICAL_TEMPLE) + env.spawn_random_rate = 0; + else + env.spawn_random_rate = 240; + } + else if (you.level_type == LEVEL_ABYSS + || you.level_type == LEVEL_PANDEMONIUM) + { + // Abyss spawn rate is set for those characters that start out in the + // Abyss; otherwise the number is ignored in the Abyss. + env.spawn_random_rate = 50; + } + else + // No random monsters in Labyrinths and portal vaualts. + env.spawn_random_rate = 0; + env.floor_colour = BLACK; env.rock_colour = BLACK; -- cgit v1.2.3-54-g00ecf