]> granicus.if.org Git - nethack/commitdiff
fix #K2622 - fire/frost horn feedback for monster
authorPatR <rankin@nethack.org>
Sat, 24 Oct 2020 03:15:01 +0000 (20:15 -0700)
committerPatR <rankin@nethack.org>
Sat, 24 Oct 2020 03:15:01 +0000 (20:15 -0700)
When a monster used a fire horn or frost horn to attack the hero,
the feedback claimed that the attack was being directed at itself.
The error occurred in code that was added to 3.7 during 3.6
development but wasn't present in 3.6.x so fixes entry is in the
"exposed by git" section.

doc/fixes37.0
src/muse.c

index 711d612e74dd80a39f4987054a256a114e785e9b..4e19df77c60f9f982b248376adf70d2a14488ff2 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.337 $ $NHDT-Date: 1603507384 2020/10/24 02:43:04 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.338 $ $NHDT-Date: 1603509297 2020/10/24 03:14:57 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -369,6 +369,8 @@ replace worm tail placement code that reportedly led to a sanity_check warning
 learn scroll of teleportation after reading even when random destination is
        right by starting spot
 fix off-by-one bug in dimensions of theme rooms
+fire/frost horn feedback when zapped by monster was inaccurate (falsely
+       claimed that it was "directed at self" when attacking hero)
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index 31f88fbd619e597004ea1e13a10b734aeb5804d4..360b564826fa93af93128aca4e6baefc567ec4e9 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 muse.c  $NHDT-Date: 1596498190 2020/08/03 23:43:10 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.129 $ */
+/* NetHack 3.7 muse.c  $NHDT-Date: 1603509297 2020/10/24 03:14:57 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.132 $ */
 /*      Copyright (C) 1990 by Ken Arromdee                         */
 /* NetHack may be freely redistributed.  See license for details.  */
 
@@ -183,6 +183,8 @@ struct monst *mtmp;
 struct obj *otmp;
 boolean self;
 {
+    char *objnamp, objbuf[BUFSZ];
+
     if (!canseemon(mtmp)) {
         int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */
                        ? (BOLT_LIM + 1) : (BOLT_LIM - 3);
@@ -191,9 +193,7 @@ boolean self;
                  (distu(mtmp->mx, mtmp->my) <= range * range)
                  ? "nearby" : "in the distance");
         otmp->known = 0; /* hero doesn't know how many charges are left */
-    } else {
-        char *objnamp, objbuf[BUFSZ];
-
+    } else if (self) {
         otmp->dknown = 1;
         objnamp = xname(otmp);
         if (strlen(objnamp) >= QBUFSZ)
@@ -202,8 +202,17 @@ boolean self;
         /* "<mon> plays a <horn> directed at himself!" */
         pline("%s!", monverbself(mtmp, Monnam(mtmp), "play", objbuf));
         makeknown(otmp->otyp); /* (wands handle this slightly differently) */
-        if (!self)
-            stop_occupation();
+    } else {
+        otmp->dknown = 1;
+        objnamp = xname(otmp);
+        if (strlen(objnamp) >= QBUFSZ)
+            objnamp = simpleonames(otmp);
+        pline("%s %s %s directed at you!",
+              /* monverbself() would adjust the verb if hallucination made
+                 subject plural; stick with singular here, at least for now */
+              Monnam(mtmp), "plays", an(objnamp));
+        makeknown(otmp->otyp);
+        stop_occupation();
     }
     otmp->spe -= 1; /* use a charge */
 }