From 74114bc4feef8e1edcea61cc836b9f4946b17223 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 13 Sep 2007 14:46:23 +0000 Subject: Add confirmation before stepping on known magical traps. (part of FR 1793669). Added description for reaching ego (bug 1792851). Added sorting statement before showing item knowledge, so items of the same class now are sorted alphabetically. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2081 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/player.cc | 52 ++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 18 deletions(-) (limited to 'crawl-ref/source/player.cc') diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 7b2cab6c3a..7fd0040a06 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -170,31 +170,47 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift, // return (false); // if we're walking along, give a chance to avoid trap - if (stepped - && !force - && new_grid == DNGN_UNDISCOVERED_TRAP) + if (stepped && !force) { - const int skill = 4 + you.skills[SK_TRAPS_DOORS] - + you.mutation[MUT_ACUTE_VISION] - - 2 * you.mutation[MUT_BLURRY_VISION]; - - if (random2( skill ) > 6) + if (new_grid == DNGN_UNDISCOVERED_TRAP) { - mprf( MSGCH_WARN, - "Wait a moment, %s! Do you really want to step there?", - you.your_name ); + const int skill = 4 + you.skills[SK_TRAPS_DOORS] + + you.mutation[MUT_ACUTE_VISION] + - 2 * you.mutation[MUT_BLURRY_VISION]; - more(); + if (random2( skill ) > 6) + { + mprf( MSGCH_WARN, + "Wait a moment, %s! Do you really want to step there?", + you.your_name ); - exercise( SK_TRAPS_DOORS, 3 ); + more(); - you.turn_is_over = false; + exercise( SK_TRAPS_DOORS, 3 ); - id = trap_at_xy( x, y ); - if (id != -1) - grd[x][y] = trap_category( env.trap[id].type ); + you.turn_is_over = false; - return (false); + id = trap_at_xy( x, y ); + if (id != -1) + grd[x][y] = trap_category( env.trap[id].type ); + + return (false); + } + } // unknown trap + else if (new_grid == DNGN_TRAP_MAGICAL) + { + std::string prompt = "Really step onto that "; // preposition? + prompt += feature_description(new_grid, trap_type_at_xy(x,y), + DESC_PLAIN, false); + prompt += '?'; + + // Zot traps require capital confirmation + bool harmless = (trap_type_at_xy(x,y) != TRAP_ZOT); + if (!yesno(prompt.c_str(), harmless, 'n')) + { + you.turn_is_over = false; + return (false); + } } } -- cgit v1.2.3-54-g00ecf