From 97c2f8ef03efad2ca41dd57f163da302a0159061 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Tue, 2 Feb 2010 23:10:01 +0000 Subject: [PATCH] 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. --- doc/fixes35.0 | 8 +++++--- src/lock.c | 8 ++++++++ src/pickup.c | 10 +++++++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 72ac336ce..d4ddd9979 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -201,9 +201,9 @@ stethoscope applied to hiding mimic will bring it out of hiding rephrase " evades your grasp" message if artifact is already held artifacts which subsequently evade your grasp/control after already being worn or wielded become unworn/unwielded -hero with lycanthropy is vulnerable to silver in human form as well as beast +hero with lycanthropy is vulnerable to silver in both human and beast form changing alignment or shape triggers a check for equipment evading hero's grasp -passive fire effects can damage attackers weapons +passive fire effects can damage attackers' weapons wielded bow shouldn't affect outcome of kicked arrows ranged polearm hit can divide puddings and can use confuse monster effect charge for kicked shop-owned food if it gets used up taming a monster @@ -283,7 +283,7 @@ wizard mode #monpolycontrol prompting asked about "it" when monster was unseen reprompt if player fails to make a menu choice during inventory identification seen eels who were stuck in isolated pools would never re-hide can no longer get both strength and resistance from eating one giant corpse -aborting key/lock pick usage via ESC at direction prompt no longer use a move +aborting key/lock pick usage via ESC at direction prompt no longer uses a move when probing from inside an engulfer, "not carrying anything" overlooked hero wearing or removing an amulet of restful sleep clobbered permanent sleepiness if attempt to select a co-aligned artifact for first divine gift fails because @@ -325,6 +325,8 @@ spell attack by low-Int hero could inflict negative damage some wand/spell/breath zaps that hit a secret door failed to reveal it wand explosion feedback about adjacent door was phrased as if for a wand zap improve the message sequencing when a thrown poisoned weapon loses is poison +attempting to open, close, or lock/unlock a door while confused or stunned + uses up a move regardless of whether direction choice finds a door Platform- and/or Interface-Specific Fixes diff --git a/src/lock.c b/src/lock.c index ee269726b..037253d0c 100644 --- a/src/lock.c +++ b/src/lock.c @@ -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) { diff --git a/src/pickup.c b/src/pickup.c index 6ff003f58..7ad1d21c5 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -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