|
From: <gi...@cr...> - 2011-08-31 21:40:45
|
via c8826eb8e39f8c39599ebc297961409043b53007 (commit)
via 49ea4c671f2a0ba8c507fc5828e569ac425bea61 (commit)
from bce3ac8d5bab1cc6fac91f0f85b1bc6563d1b7b0 (commit)
-----------------------------------------------------------------------
commit c8826eb8e39f8c39599ebc297961409043b53007
Author: Raphael Langella <rap...@gm...>
Date: Wed Aug 31 23:36:54 2011 +0200
Tweak the staircase mimic generation to be less predictable.
commit 49ea4c671f2a0ba8c507fc5828e569ac425bea61
Author: Raphael Langella <rap...@gm...>
Date: Wed Aug 31 22:18:20 2011 +0200
Fix branch entries placed for mimicing at a depth too shallow for mimics.
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/dungeon.cc | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 951744b..b9f0b06 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -100,6 +100,7 @@ static void _builder_normal(int level_number);
static void _builder_items(int level_number, int items_wanted);
static void _builder_monsters(int level_number, level_area_type level_type,
int mon_wanted);
+static coord_def _place_specific_feature(dungeon_feature_type feat);
static void _place_specific_stair(dungeon_feature_type stair,
const std::string &tag = "",
int dl = 0);
@@ -2032,8 +2033,10 @@ static void _ruin_level(Iterator ri,
// Missing stairs are replaced in fixup_branch_stairs, but replacing
// too many breaks interlevel connectivity, so we don't use a chance of 1.
#define FEATURE_MIMIC_CHANCE 2
+ #define FEATURE_MIMIC_DEPTH 1
#else
#define FEATURE_MIMIC_CHANCE 100
+ #define FEATURE_MIMIC_DEPTH 10
#endif
static void _place_feature_mimics(int level_number,
dungeon_feature_type dest_stairs_type)
@@ -2044,10 +2047,8 @@ static void _place_feature_mimics(int level_number,
return;
}
-#ifndef DEBUG_MIMIC
- if (level_number < 10)
+ if (level_number < FEATURE_MIMIC_DEPTH)
return;
-#endif
for (rectangle_iterator ri(1); ri; ++ri)
{
@@ -2092,6 +2093,19 @@ static void _place_feature_mimics(int level_number,
// If it is a branch entry, it's been put there for mimicing.
if (feat_is_branch_stairs(feat) || one_chance_in(FEATURE_MIMIC_CHANCE))
{
+ // For normal stairs, there is a chance to create another mimics
+ // elsewhere instead of turning this one. That way, when the 3
+ // stairs are grouped and there is another isolated one, any of
+ // the 4 staircase can be the mimic.
+ if (feat_is_stone_stair(feat) && one_chance_in(4))
+ {
+ const coord_def new_pos = _place_specific_feature(feat);
+ dprf("Placed %s mimic at (%d,%d).",
+ feat_type_name(feat), new_pos.x, new_pos.y);
+ env.level_map_mask(new_pos) |= MMT_MIMIC;
+ continue;
+ }
+
dprf("Placed %s mimic at (%d,%d).",
feat_type_name(feat), ri->x, ri->y);
env.level_map_mask(*ri) |= MMT_MIMIC;
@@ -3188,7 +3202,7 @@ static coord_def _dgn_random_point_in_bounds(dungeon_feature_type searchfeat,
}
}
-static void _place_specific_feature(dungeon_feature_type feat)
+static coord_def _place_specific_feature(dungeon_feature_type feat)
{
/* Only overwrite vaults when absolutely necessary. */
coord_def c = _dgn_random_point_in_bounds(DNGN_FLOOR, MMT_VAULT, DNGN_UNSEEN, true);
@@ -3199,6 +3213,8 @@ static void _place_specific_feature(dungeon_feature_type feat)
env.grid(c) = feat;
else
throw dgn_veto_exception("Cannot place specific feature.");
+
+ return c;
}
static bool _place_vault_by_tag(const std::string &tag, int dlevel)
@@ -3235,6 +3251,7 @@ static void _place_branch_entrances(int dlevel, level_area_type level_type)
const bool mimic = !branch_is_unfinished(b->id)
&& !is_hell_subbranch(b->id)
+ && dlevel >= FEATURE_MIMIC_DEPTH
&& player_branch_depth() >= b->mindepth
&& player_branch_depth() <= b->maxdepth
&& one_chance_in(FEATURE_MIMIC_CHANCE);
--
Dungeon Crawl Stone Soup
|