summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-13 14:46:23 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-13 14:46:23 +0000
commit74114bc4feef8e1edcea61cc836b9f4946b17223 (patch)
tree9e09f207b2bc2782a8950a5e469f5cd032292de9 /crawl-ref/source/player.cc
parent42fe04c5774e1abb0c25de0aed269f0f5546e9d9 (diff)
downloadcrawl-ref-74114bc4feef8e1edcea61cc836b9f4946b17223.tar.gz
crawl-ref-74114bc4feef8e1edcea61cc836b9f4946b17223.zip
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
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc52
1 files changed, 34 insertions, 18 deletions
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);
+ }
}
}