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

@@ -2751,6 +2751,7 @@ tourists gain experience by seeing new types of creatures up close, and
healers gain experience by healing pets
blessed scroll of destroy armor asks which armor to destroy
archeologists' fedora is lucky
telepathic hero can discern which particular monster just read a scroll
Platform- and/or Interface-Specific New Features

View File

@@ -1785,6 +1785,7 @@ extern void adj_erinys(unsigned);
extern void see_monster_closeup(struct monst *) NONNULLARG1;
extern void see_nearby_monsters(void);
extern void shieldeff_mon(struct monst *) NONNULLARG1;
extern void flash_mon(struct monst *) NONNULLARG1;
/* ### mondata.c ### */

View File

@@ -5848,4 +5848,18 @@ shieldeff_mon(struct monst *mtmp)
pline_mon(mtmp, "%s resists!", Monnam(mtmp));
}
void
flash_mon(struct monst *mtmp)
{
coordxy mx = mtmp->mx, my = mtmp->my;
int count = couldsee(mx, my) ? 8 : 4;
char saveviz = gv.viz_array[my][mx];
if (!flags.sparkle)
count /= 2;
gv.viz_array[my][mx] |= (IN_SIGHT | COULD_SEE);
flash_glyph_at(mx, my, mon_to_glyph(mtmp, newsym_rn2), count);
gv.viz_array[my][mx] = saveviz;
newsym(mx, my);
}
/*mon.c*/

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...",

View File

@@ -3248,17 +3248,9 @@ create_particular_creation(
/* if asking for 'hidden', show location of every created monster
that can't be seen--whether that's due to successfully hiding
or vision issues (line-of-sight, invisibility, blindness) */
if ((d->hidden || d->invisible) && !canspotmon(mtmp)) {
int count = couldsee(mx, my) ? 8 : 4;
char saveviz = gv.viz_array[my][mx];
if ((d->hidden || d->invisible) && !canspotmon(mtmp))
flash_mon(mtmp);
if (!flags.sparkle)
count /= 2;
gv.viz_array[my][mx] |= (IN_SIGHT | COULD_SEE);
flash_glyph_at(mx, my, mon_to_glyph(mtmp, newsym_rn2), count);
gv.viz_array[my][mx] = saveviz;
newsym(mx, my);
}
madeany = TRUE;
/* in case we got a doppelganger instead of what was asked
for, make it start out looking like what was asked for */