]> granicus.if.org Git - nethack/commitdiff
fix #K3257 - lichens' sticky attack holds hero
authorPatR <rankin@nethack.org>
Sun, 31 Jan 2021 01:19:17 +0000 (17:19 -0800)
committerPatR <rankin@nethack.org>
Sun, 31 Jan 2021 01:19:17 +0000 (17:19 -0800)
in the air.  can_reach_floor() was changed relatively recently
to return False if hero was held by a monster.  It wasn't
necessarily because the monster was lifting him or her off the
floor though.  Restricted movement could produce same effect.

Change the new behavior to only happen when holder has used a
hug attack, so that being held by a fungus or mimic doesn't
prevent access to the floor.

This may need to be revisited because the idea that the hero's
arms have been pinned by a hugging monster contradicts the
ability to attack that monster.  However, it matches the long-
standing inability to attack any other adjacent monster in
that circumstance.

doc/fixes37.0
src/engrave.c

index 0ac16331906d9982612954892e7aade589ac1b3b..933829660c5aa120bcbd6e234a9ffc7259167a3e 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.438 $ $NHDT-Date: 1612053751 2021/01/31 00:42:31 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.439 $ $NHDT-Date: 1612055953 2021/01/31 01:19:13 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -501,6 +501,8 @@ changes accompanying sorting of discoveries resulted in omitting very last
        item for '`'/#knownclass on a class where every item was discoverable
        and had no extra labels (so potions and rings, possibly others, but
        not scrolls or wands) and every item was actually discovered
+change to can_reach_floor() resulted in hero being unable to reach the floor
+       when held by a lichen
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index 261ca9fe2b895f1d4868a0ce564d0e53761aef31..cfa81983fd996afb57bd0b0e0a8652f7daeb46f8 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 engrave.c       $NHDT-Date: 1608673691 2020/12/22 21:48:11 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.99 $ */
+/* NetHack 3.7 engrave.c       $NHDT-Date: 1612055954 2021/01/31 01:19:14 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.102 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -143,7 +143,13 @@ can_reach_floor(boolean check_pit)
 {
     struct trap *t;
 
-    if (u.uswallow || (u.ustuck && !sticks(g.youmonst.data))
+    if (u.uswallow
+        || (u.ustuck && !sticks(g.youmonst.data)
+            /* assume that arms are pinned rather than that the hero
+               has been lifted up above the floor [doesn't explain
+               how hero can attack the creature holding him or her;
+               that's life in nethack...] */
+            && attacktype(u.ustuck->data, AT_HUGS))
         || (Levitation && !(Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))))
         return FALSE;
     /* Restricted/unskilled riders can't reach the floor */