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.
This commit is contained in:
PatR
2020-10-23 20:15:01 -07:00
parent 0e713dc4e9
commit 74c2716004
2 changed files with 18 additions and 7 deletions

View 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 */
}