diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-11-20 12:36:35 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-11-20 12:36:35 +0000 |
commit | e3e729a0259c4c89296ac368556563ca096cd3e9 (patch) | |
tree | f039ef6171cc4d0d6b8c744db35a69c939fd7667 /crawl-ref/source | |
parent | eddd2e4d44b41d3bdd3283c6887104603a33bf3f (diff) | |
download | crawl-ref-e3e729a0259c4c89296ac368556563ca096cd3e9.tar.gz crawl-ref-e3e729a0259c4c89296ac368556563ca096cd3e9.zip |
A few changes to shafts:
* shafts cannot be created above level 3 in the main dungeon
* intelligent fleeing monsters will jump into shafts
-> this will reveal the shaft to the player
* rename "shaft trap" to "shaft"
* ask for confirmation before stepping into a shaft
Also finally fix colour from post-death inventory bleeding into
the highscore and prompt. (This has always bugged me.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2884 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/direct.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/misc.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 24 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/mstuff2.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/ouch.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/player.cc | 12 | ||||
-rw-r--r-- | crawl-ref/source/traps.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/tutorial.cc | 7 |
9 files changed, 42 insertions, 28 deletions
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 6bdd6f3200..b634c01bb7 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -1514,7 +1514,7 @@ std::string raw_feature_description(dungeon_feature_type grid, case TRAP_NEEDLE: return ("needle trap"); case TRAP_SHAFT: - return ("shaft trap"); + return ("shaft"); default: error_message_to_player(); return ("undefined trap"); diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 7734e87d04..2335c74b42 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -871,7 +871,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, return; } shaft_level = absdungeon_depth(shaft_dest.branch, - shaft_dest.depth); + shaft_dest.depth); if (you.flight_mode() != FL_FLY || force_stair) mpr("You fall through a shaft!"); diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index b2cf201708..28b6f87135 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -4972,14 +4972,12 @@ void monsters::apply_location_effects() } } +// returns true if the trap should be revealed to the player bool monsters::do_shaft() { if (!is_valid_shaft_level()) return (false); - bool nearby = mons_near(this); - bool vis = player_monster_visible(this); - // Handle instances of do_shaft() being invoked magically when // the monster isn't standing over a shaft. if (trap_type_at_xy(x, y) != TRAP_SHAFT) @@ -5001,15 +4999,15 @@ bool monsters::do_shaft() if (airborne() || total_weight() == 0) { - if (nearby) + if (mons_near(this)) { - if (vis) + if (player_monster_visible(this)) mprf("A shaft briefly opens up underneath %s!", name(DESC_NOCAP_THE).c_str()); else mpr("A shaft briefly opens up in the floor!"); } - return (true); + return (false); } } @@ -5019,21 +5017,15 @@ bool monsters::do_shaft() return (false); set_transit(lev); - - if (nearby) - { - if (vis) - mprf("%s falls through a shaft!", - name(DESC_CAP_THE).c_str()); - else - mpr("A shaft briefly opens up in the floor!"); - } + bool reveal = false; + if (simple_monster_message(this, " falls through a shaft!")) + reveal = true;; // Monster is no longer on this level destroy_inventory(); monster_cleanup(this); - return true; + return (reveal); } void monsters::put_to_sleep(int) diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 7e57b7433b..43e69cbf96 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -4968,7 +4968,11 @@ static bool is_trap_safe(const monsters *monster, const int trap_x, const trap_struct &trap = env.trap[trap_at_xy(trap_x,trap_y)]; if (trap.type == TRAP_SHAFT && monster->will_trigger_shaft()) + { + if (mons_is_fleeing(monster) && intel >= I_NORMAL) + return (true); return (false); + } // Monsters are not afraid of non-mechanical traps. XXX: If we add // any non-mechanical traps that can damage monsters, must add diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index e2cd4e7828..18bcc1b325 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -326,7 +326,6 @@ void mons_trap(struct monsters *monster) break; case TRAP_SHAFT: - { // Paranoia if (!is_valid_shaft_level()) { @@ -344,13 +343,12 @@ void mons_trap(struct monsters *monster) if (trapKnown && !monster->airborne()) simple_monster_message(monster, " doesn't fall through the shaft."); - return; } - revealTrap = monster->do_shaft(); + if (monster->do_shaft()) + revealTrap = true; break; - } default: break; @@ -412,7 +410,8 @@ void mons_trap(struct monsters *monster) // reveal undiscovered traps, where appropriate: {dlb} if (monsterNearby && !trapKnown && revealTrap) { - grd[monster->x][monster->y] = trap_category(env.trap[which_trap].type); + grd[env.trap[which_trap].x][env.trap[which_trap].y] + = trap_category(env.trap[which_trap].type); } // apply damage and handle death, where appropriate: {dlb} diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index a58b4dc0f5..19403209ec 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -1025,6 +1025,7 @@ void end_game( struct scorefile_entry &se ) } invent( -1, true ); + textcolor( LIGHTGREY ); clrscr(); if (!dump_char( morgue_name(se.death_time), !dead, true, &se )) diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 399f5a8c7b..07b04ebd06 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -155,11 +155,15 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift, return (false); } } // unknown trap - else if (new_grid == DNGN_TRAP_MAGICAL) + else if (new_grid == DNGN_TRAP_MAGICAL + || new_grid == DNGN_TRAP_NATURAL) { - std::string prompt = "Really step onto that "; // preposition? + std::string prompt = "Really step "; + prompt += (trap_type_at_xy(x,y) == TRAP_ALARM ? + "onto" : "into"); + prompt += " that "; prompt += feature_description(new_grid, trap_type_at_xy(x,y), - DESC_PLAIN, false); + DESC_BASENAME, false); prompt += '?'; // Zot traps require capital confirmation @@ -5158,7 +5162,7 @@ level_id actor::shaft_dest() const if (lev.depth == curr_depth) return lev; - // Only shafts on the level immediately above a dangeorus branch + // Only shafts on the level immediately above a dangerous branch // bottom will take you to that dangerous bottom, and shafts can't // be created during level generation time. if (your_branch().dangerous_bottom_level diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index b44543425f..7b22ca0f52 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -420,7 +420,7 @@ void handle_traps(trap_type trt, int i, bool trap_known) // Paranoia if (!is_valid_shaft_level()) { - if (trap_known); + if (trap_known) mpr("The shaft disappears in a puff of logic!"); grd[env.trap[i].x][env.trap[i].y] = DNGN_FLOOR; @@ -932,6 +932,13 @@ bool is_valid_shaft_level(const level_id &place) if (place.level_type != LEVEL_DUNGEON) return (false); + // disallow shafts on the first two levels + if (place.branch == BRANCH_MAIN_DUNGEON + && you.your_level < 2) + { + return (false); + } + // Don't generate shafts in branches where teleport control // is prevented. Prevents player from going down levels without // reaching stairs, and also keeps player from getting stuck diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index c83906e634..60cbe65b79 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -1953,6 +1953,7 @@ bool tutorial_feat_interesting(dungeon_feature_type feat) case DNGN_GRANITE_STATUE: case DNGN_TRAP_MAGICAL: case DNGN_TRAP_MECHANICAL: + case DNGN_TRAP_NATURAL: case DNGN_STONE_STAIRS_DOWN_I: case DNGN_STONE_STAIRS_DOWN_II: case DNGN_STONE_STAIRS_DOWN_III: @@ -1997,6 +1998,12 @@ void tutorial_describe_feature(dungeon_feature_type feat) Options.tutorial_events[TUT_SEEN_TRAP] = 0; break; + case DNGN_TRAP_NATURAL: // only shafts for now + ostr << "The dungeon contains a number of natural obstacles such " + "as shafts, which lead one or two levels down."; + Options.tutorial_events[TUT_SEEN_TRAP] = 0; + break; + case DNGN_STONE_STAIRS_DOWN_I: case DNGN_STONE_STAIRS_DOWN_II: case DNGN_STONE_STAIRS_DOWN_III: |