diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-27 19:48:06 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-27 20:15:38 +0100 |
commit | 43ecefb893fbcaf68ba39807507d0dffdfd659d4 (patch) | |
tree | 0b011dc04fc0351a10c77e45c3036786f7e3e3fa | |
parent | 9c0902acd3e145f71eceb785cf3b035a13460914 (diff) | |
download | crawl-ref-43ecefb893fbcaf68ba39807507d0dffdfd659d4.tar.gz crawl-ref-43ecefb893fbcaf68ba39807507d0dffdfd659d4.zip |
Give shafts in corridor ends a good chance of being preknown.
-rw-r--r-- | crawl-ref/source/dungeon.cc | 11 | ||||
-rw-r--r-- | crawl-ref/source/traps.cc | 13 | ||||
-rw-r--r-- | crawl-ref/source/traps.h | 1 |
3 files changed, 18 insertions, 7 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 05bd1b9fdd..153091bbf6 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -2989,6 +2989,8 @@ static builder_rc_type _builder_basic(int level_number) ts.pos.x = xend; ts.pos.y = yend; grd[xend][yend] = DNGN_UNDISCOVERED_TRAP; + if (shaft_known(level_number, false)) + ts.reveal(); #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Trail ends in shaft."); #endif @@ -3173,14 +3175,9 @@ static void _place_traps(int level_number) } } - if (ts.type == TRAP_SHAFT && // Shafts can be generated visible - coinflip() && // Starts about 50% of the time - random2(level_number) < 3) // And gets less frequent - { + grd(ts.pos) = DNGN_UNDISCOVERED_TRAP; + if (ts.type == TRAP_SHAFT && shaft_known(level_number, true)) ts.reveal(); - } else { - grd(ts.pos) = DNGN_UNDISCOVERED_TRAP; - } ts.prepare_ammo(); } } diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index 824f6fc4bd..e3d1c0ddc7 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -1315,6 +1315,19 @@ bool is_valid_shaft_level(const level_id &place) return ((branch.depth - place.depth) >= min_delta); } +// Shafts can be generated visible. +// +// Starts about 50% of the time and approaches 0% for randomly +// placed traps, and starts at 100% and approaches 50% for +// others (e.g. at end of corridor). +bool shaft_known(int depth, bool randomly_placed) +{ + if (randomly_placed) + return (coinflip() && x_chance_in_y(3, depth)); + else + return (coinflip() || x_chance_in_y(3, depth)); +} + level_id generic_shaft_dest(level_pos lpos, bool known = false) { level_id lid = lpos.id; diff --git a/crawl-ref/source/traps.h b/crawl-ref/source/traps.h index 7d761e85d2..c39b70482c 100644 --- a/crawl-ref/source/traps.h +++ b/crawl-ref/source/traps.h @@ -34,6 +34,7 @@ trap_def* find_trap(const coord_def& where); trap_type get_trap_type(const coord_def& where); bool is_valid_shaft_level(const level_id &place = level_id::current()); +bool shaft_known(int depth, bool randomly_placed); level_id generic_shaft_dest(coord_def pos, bool known); void handle_items_on_shaft(const coord_def& where, bool open_shaft); |