From: PatR Date: Sat, 24 Oct 2020 03:15:01 +0000 (-0700) Subject: fix #K2622 - fire/frost horn feedback for monster X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=74c2716004952b02af209451fe30e154daec2e92;p=nethack fix #K2622 - fire/frost horn feedback for monster 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. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 711d612e7..4e19df77c 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 diff --git a/src/muse.c b/src/muse.c index 31f88fbd6..360b56482 100644 --- a/src/muse.c +++ b/src/muse.c @@ -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; /* " plays a 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 */ }