follow-up to #1343 fix for telepathic hero

telepathic hero can discern which particular monster just
read a scroll, even though he cannot see the monster
This commit is contained in:
nhmall
2024-12-20 15:30:37 -05:00
parent a35e5779f6
commit f6a5236beb
5 changed files with 30 additions and 16 deletions

View File

@@ -236,7 +236,8 @@ staticfn void
mreadmsg(struct monst *mtmp, struct obj *otmp)
{
char onambuf[BUFSZ];
boolean vismon = canseemon(mtmp);
boolean vismon = canseemon(mtmp),
tpindicator = (!vismon && sensemon(mtmp));
if (!vismon && Deaf)
return; /* no feedback */
@@ -262,12 +263,15 @@ mreadmsg(struct monst *mtmp, struct obj *otmp)
int mflags = (SUPPRESS_INVISIBLE | SUPPRESS_SADDLE
| (recognize ? SUPPRESS_IT : AUGMENT_IT));
/* monster can't be seen; hero might be blind or monster might
be at a spot that isn't in view or might be invisible; remember
it if the spot is within line of sight and relatively close */
if (!sensemon(mtmp)
&& couldsee(mtmp->mx, mtmp->my) && mdistu(mtmp) <= 10 * 10)
if (sensemon(mtmp)) {
tpindicator = TRUE;
} else if (couldsee(mtmp->mx, mtmp->my) && mdistu(mtmp) <= 10 * 10) {
/* monster can't be seen or sensed; hero might be blind or monster
might be at a spot that isn't in view or might be invisible;
remember it if the spot is within line of sight and relatively
close */
map_invisible(mtmp->mx, mtmp->my);
}
Snprintf(blindbuf, sizeof blindbuf, "reading %s", onambuf);
strsubst(blindbuf, "reading a scroll labeled",
@@ -275,6 +279,8 @@ mreadmsg(struct monst *mtmp, struct obj *otmp)
You_hear("%s %s.",
x_monnam(mtmp, ARTICLE_A, (char *) 0, mflags, FALSE),
blindbuf);
if (tpindicator)
flash_mon(mtmp);
}
if (mtmp->mconf) /* (note: won't get if not seen and hero can't hear) */
pline("Being confused, %s mispronounces the magic words...",