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
+1
View File
@@ -2751,6 +2751,7 @@ tourists gain experience by seeing new types of creatures up close, and
healers gain experience by healing pets healers gain experience by healing pets
blessed scroll of destroy armor asks which armor to destroy blessed scroll of destroy armor asks which armor to destroy
archeologists' fedora is lucky archeologists' fedora is lucky
telepathic hero can discern which particular monster just read a scroll
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features
+1
View File
@@ -1785,6 +1785,7 @@ extern void adj_erinys(unsigned);
extern void see_monster_closeup(struct monst *) NONNULLARG1; extern void see_monster_closeup(struct monst *) NONNULLARG1;
extern void see_nearby_monsters(void); extern void see_nearby_monsters(void);
extern void shieldeff_mon(struct monst *) NONNULLARG1; extern void shieldeff_mon(struct monst *) NONNULLARG1;
extern void flash_mon(struct monst *) NONNULLARG1;
/* ### mondata.c ### */ /* ### mondata.c ### */
+14
View File
@@ -5848,4 +5848,18 @@ shieldeff_mon(struct monst *mtmp)
pline_mon(mtmp, "%s resists!", Monnam(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*/ /*mon.c*/
+12 -6
View File
@@ -236,7 +236,8 @@ staticfn void
mreadmsg(struct monst *mtmp, struct obj *otmp) mreadmsg(struct monst *mtmp, struct obj *otmp)
{ {
char onambuf[BUFSZ]; char onambuf[BUFSZ];
boolean vismon = canseemon(mtmp); boolean vismon = canseemon(mtmp),
tpindicator = (!vismon && sensemon(mtmp));
if (!vismon && Deaf) if (!vismon && Deaf)
return; /* no feedback */ return; /* no feedback */
@@ -262,12 +263,15 @@ mreadmsg(struct monst *mtmp, struct obj *otmp)
int mflags = (SUPPRESS_INVISIBLE | SUPPRESS_SADDLE int mflags = (SUPPRESS_INVISIBLE | SUPPRESS_SADDLE
| (recognize ? SUPPRESS_IT : AUGMENT_IT)); | (recognize ? SUPPRESS_IT : AUGMENT_IT));
/* monster can't be seen; hero might be blind or monster might if (sensemon(mtmp)) {
be at a spot that isn't in view or might be invisible; remember tpindicator = TRUE;
it if the spot is within line of sight and relatively close */ } else if (couldsee(mtmp->mx, mtmp->my) && mdistu(mtmp) <= 10 * 10) {
if (!sensemon(mtmp) /* monster can't be seen or sensed; hero might be blind or monster
&& couldsee(mtmp->mx, mtmp->my) && mdistu(mtmp) <= 10 * 10) 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); map_invisible(mtmp->mx, mtmp->my);
}
Snprintf(blindbuf, sizeof blindbuf, "reading %s", onambuf); Snprintf(blindbuf, sizeof blindbuf, "reading %s", onambuf);
strsubst(blindbuf, "reading a scroll labeled", strsubst(blindbuf, "reading a scroll labeled",
@@ -275,6 +279,8 @@ mreadmsg(struct monst *mtmp, struct obj *otmp)
You_hear("%s %s.", You_hear("%s %s.",
x_monnam(mtmp, ARTICLE_A, (char *) 0, mflags, FALSE), x_monnam(mtmp, ARTICLE_A, (char *) 0, mflags, FALSE),
blindbuf); blindbuf);
if (tpindicator)
flash_mon(mtmp);
} }
if (mtmp->mconf) /* (note: won't get if not seen and hero can't hear) */ if (mtmp->mconf) /* (note: won't get if not seen and hero can't hear) */
pline("Being confused, %s mispronounces the magic words...", pline("Being confused, %s mispronounces the magic words...",
+2 -10
View File
@@ -3248,17 +3248,9 @@ create_particular_creation(
/* if asking for 'hidden', show location of every created monster /* if asking for 'hidden', show location of every created monster
that can't be seen--whether that's due to successfully hiding that can't be seen--whether that's due to successfully hiding
or vision issues (line-of-sight, invisibility, blindness) */ or vision issues (line-of-sight, invisibility, blindness) */
if ((d->hidden || d->invisible) && !canspotmon(mtmp)) { if ((d->hidden || d->invisible) && !canspotmon(mtmp))
int count = couldsee(mx, my) ? 8 : 4; flash_mon(mtmp);
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);
}
madeany = TRUE; madeany = TRUE;
/* in case we got a doppelganger instead of what was asked /* in case we got a doppelganger instead of what was asked
for, make it start out looking like what was asked for */ for, make it start out looking like what was asked for */