]> granicus.if.org Git - nethack/commitdiff
fix #K3274 - applied polearm locates hidden mon
authorPatR <rankin@nethack.org>
Sun, 7 Mar 2021 23:08:08 +0000 (15:08 -0800)
committerPatR <rankin@nethack.org>
Sun, 7 Mar 2021 23:08:08 +0000 (15:08 -0800)
without using any time.  Targetting an apparently empty spot at
valid polearm range where a monster happens to be hiding reports
"Wait!  There's something there you can't see!" and displays the
remembered, unseen monster glyph, then aborts the attack attempt.
It would use a turn if the polearm became wielded in the attempt
but not if it was already wielded.  Make latter case take time.

doc/fixes37.0
src/apply.c

index 2caa463067015fb5157be8b0aed8501621252647..9e7afcbd04ad35769aa4ab1d2e9ebfc29983a4f6 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.467 $ $NHDT-Date: 1614812488 2021/03/03 23:01:28 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.468 $ $NHDT-Date: 1615158479 2021/03/07 23:07:59 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -394,6 +394,9 @@ it was theoretically possible to overflow an internal buffer containing
        using the '(' or '*' commands
 hero would be blinded and stunned by an Archon's radiance (gaze attack) even
        if the Archon was blind, but monsters would not
+applying a polearm to attempt to attack a hidden monster would report "wait!
+       there's a monster hidden there" and display the "remembered, unseen
+       monster" glyph but only use a turn if polearm wasn't already wielded
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 495fc00a47743cafae9876ce4a689d130605700c..d6eeb80f512477620e1cbc4727ce2362c0ba841d 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 apply.c $NHDT-Date: 1611182249 2021/01/20 22:37:29 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.337 $ */
+/* NetHack 3.7 apply.c $NHDT-Date: 1615158480 2021/03/07 23:08:00 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.340 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -3118,8 +3118,12 @@ use_pole(struct obj *obj)
     /* Attack the monster there */
     g.bhitpos = cc;
     if ((mtmp = m_at(g.bhitpos.x, g.bhitpos.y)) != (struct monst *) 0) {
-        if (attack_checks(mtmp, uwep))
-            return res;
+        if (attack_checks(mtmp, uwep)) /* can attack proceed? */
+            /* no, abort the attack attempt; result depends on
+               res: 1 => polearm became wielded, 0 => already wielded;
+               g.context.move: 1 => discovered hidden monster at target spot,
+               0 => answered 'n' to "Really attack?" prompt */
+            return res || g.context.move;
         if (overexertion())
             return 1; /* burn nutrition; maybe pass out */
         g.context.polearm.hitmon = mtmp;