open/close/loot while confused or stunned (trunk only)

Fix a bug From a bug report:  while stunned he tried to close
an adjacent open door and when his choice of direction got changed to
some non-door spot, no time elapsed so he could just keep repeating the
attempt until eventually getting the correct direction.  Trying to open
an adjacent closed door and trying to remove the saddle from an adjacent
monster via #loot behaved similarly.  Applying keys and lock-picks also
did so in 3.4.3, but had already been changed to use up time in the dev
code.  There may be other actions which need fixing.
This commit is contained in:
nethack.rankin
2010-02-02 23:10:01 +00:00
parent 84dccb47cf
commit 97c2f8ef03
3 changed files with 20 additions and 6 deletions

View File

@@ -561,6 +561,10 @@ doopen() /* try to open a door */
return(1);
}
/* when choosing a direction is impaired, use a turn
regardless of whether a door is successfully targetted */
if (Confusion || Stunned) res = 1;
door = &levl[cc.x][cc.y];
portcullis = (is_drawbridge_wall(cc.x, cc.y) >= 0);
if (Blind) {
@@ -689,6 +693,10 @@ doclose() /* try to close a door */
return(1);
}
/* when choosing a direction is impaired, use a turn
regardless of whether a door is successfully targetted */
if (Confusion || Stunned) res = 1;
door = &levl[x][y];
portcullis = (is_drawbridge_wall(x, y) >= 0);
if (Blind) {

View File

@@ -1,5 +1,4 @@
/* NetHack 3.5 pickup.c $Date$ $Revision$ */
/* SCCS Id: @(#)pickup.c 3.5 2008/10/09 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1638,8 +1637,9 @@ lootcont:
* 3.3.1 introduced directional looting for some things.
*/
if (c != 'y' && mon_beside(u.ux, u.uy)) {
if (!get_adjacent_loc("Loot in what direction?", "Invalid loot location",
u.ux, u.uy, &cc)) return 0;
if (!get_adjacent_loc("Loot in what direction?",
"Invalid loot location",
u.ux, u.uy, &cc)) return 0;
if (cc.x == u.ux && cc.y == u.uy) {
underfoot = TRUE;
if (container_at(cc.x, cc.y, FALSE))
@@ -1654,6 +1654,10 @@ lootcont:
}
mtmp = m_at(cc.x, cc.y);
if (mtmp) timepassed = loot_mon(mtmp, &prev_inquiry, &prev_loot);
/* always use a turn when choosing a direction is impaired,
even if you've successfully targetted a saddled creature
and then answered "no" to the "remove its saddle?" prompt */
if (Confusion || Stunned) timepassed = 1;
/* Preserve pre-3.3.1 behaviour for containers.
* Adjust this if-block to allow container looting