another mimic fix

The report (sent directly to devteam) stated that the bump-into-mimic
code might crash when bumping into a mimic that is masqueraing as
some other monster.  Mimics don't actually do that, but the Wizard
of Yendor mimics another monster via Double Trouble.  All I got from
it though is
 |Wait!  That's <other monster>!
which won't crash but is a fairly useless message.

This changes it to be
 |Wait!  That <other monster> is <the Wizard of Yendor>!
which seems a bit bland but provides useful information.
This commit is contained in:
PatR
2025-01-11 02:22:23 -08:00
parent 0fe42a67d0
commit cba032d187

View File

@@ -6099,12 +6099,27 @@ that_is_a_mimic(
otmp->where = OBJ_FREE; /* object_from_map set to OBJ_FLOOR */
dealloc_obj(otmp);
}
} else if (glyph_is_monster(glyph)) {
const char *mtmp_name;
int sym = glyph_to_mon(glyph);
#ifdef EXTRA_SANITY_CHECKS
if (iflags.sanity_check && (int) mtmp->mappearance != sym)
impossible("mimic appearance %u does not match"
" monster #%d (glyph=%d)",
mtmp->mappearance, sym, glyph);
#endif
mtmp_name = pmname(&mons[sym], Mgender(mtmp));
Snprintf(fmtbuf, sizeof fmtbuf,
"Wait! That %s is %%s!", mtmp_name);
}
/* cloned Wiz starts out mimicking some other monster and
might make himself invisible before being revealed */
if (mtmp->minvis && !See_invisible)
what = generic;
else if (M_AP_TYPE(mtmp) == M_AP_MONSTER)
what = x_monnam(mtmp, ARTICLE_A, (char *) NULL, EXACT_NAME, TRUE);
else if (mtmp->data->mlet == S_MIMIC
&& (M_AP_TYPE(mtmp) == M_AP_OBJECT
|| M_AP_TYPE(mtmp) == M_AP_FURNITURE)