diff options
author | Jesse Luehrs <doy@tozt.net> | 2010-01-09 18:39:58 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2010-01-09 18:41:22 -0600 |
commit | ca5fe3a360d00305050f189d17a1ca208923a258 (patch) | |
tree | b9076602166ac8c3a6bfa4f8d078ccd04061c00a /crawl-ref/source/dungeon.cc | |
parent | f9fdd3ccb28e13868787c3794df8c338ad44bdcb (diff) | |
download | crawl-ref-ca5fe3a360d00305050f189d17a1ca208923a258.tar.gz crawl-ref-ca5fe3a360d00305050f189d17a1ca208923a258.zip |
implement 'ruined level' idea for lair layouts
each wall tile has a x/10 chance of being replaced by floor, where x is
the number of adjacent floor tiles. each wall replaced in this way has a
20% chance of being replaced by a plant or a fungus.
Diffstat (limited to 'crawl-ref/source/dungeon.cc')
-rw-r--r-- | crawl-ref/source/dungeon.cc | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index dc371ba174..cc3e884478 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -155,6 +155,7 @@ static bool _join_the_dots_rigorous(const coord_def &from, static void _build_river(dungeon_feature_type river_type); //mv static void _build_lake(dungeon_feature_type lake_type); //mv +static void _ruin_level(); static void _bigger_room(); static void _plan_main(int level_number, int force_plan); @@ -1134,6 +1135,11 @@ static void _build_layout_skeleton(int level_number, int level_type, _builder_extras(level_number, level_type); } } + + if (player_in_branch(BRANCH_LAIR)) + { + _ruin_level(); + } } static int _num_items_wanted(int level_number) @@ -2444,9 +2450,6 @@ static builder_rc_type _builder_by_branch(int level_number) switch (you.where_are_you) { - case BRANCH_LAIR: - if (!one_chance_in(3)) - break; case BRANCH_HIVE: case BRANCH_SLIME_PITS: case BRANCH_ORCISH_MINES: @@ -7733,6 +7736,50 @@ static void _build_lake(dungeon_feature_type lake_type) //mv } } +static void _ruin_level() +{ + std::vector<coord_def> to_replace; + + for (rectangle_iterator ri(1); ri; ++ri) + { + /* only try to replace wall tiles */ + if (!feat_is_wall(grd(*ri))) + { + continue; + } + + int floor_count = 0; + for (adjacent_iterator ai(*ri); ai; ++ai) + { + if (!feat_is_wall(grd(*ai))) + { + floor_count++; + } + } + + /* chance of removing the tile is dependent on the number of adjacent + * floor tiles */ + if (x_chance_in_y(floor_count, 10)) + { + to_replace.push_back(*ri); + } + } + + for (std::vector<coord_def>::const_iterator it = to_replace.begin(); + it != to_replace.end(); + ++it) + { + /* XXX: should this pick a random adjacent floor type, rather than + * just hardcoding DNGN_FLOOR? */ + grd(*it) = DNGN_FLOOR; + + /* replace some ruined walls with plants/fungi */ + if (one_chance_in(5)) { + mons_place(mgen_data(coinflip() ? MONS_PLANT : MONS_FUNGUS)); + } + } +} + struct nearest_point { coord_def target; |