From ee13fb36ac62662361df57af910d827c25d6c9ec Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 4 Jul 2021 17:47:04 -0700 Subject: [PATCH] fix github issue #542 - clumsy "it" message when encountering a hiding monster that's still unseen after being revealed (so most likely invisible when hero lacks see invisible). Change |Wait! There's an it hiding under ! to !Wait! There's something hiding under ! when hero tries to move onto the object. Also, when a hidden monster reveals itself by attacking, change |It was hidden under ! usually followed by "It hits." or "It misses." to |Something was hidden under ! without changing whatever follows. Fixes #542 --- doc/fixes37.0 | 4 +++- src/mhitu.c | 11 ++++++++--- src/uhitm.c | 17 ++++++++++++----- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index a41e5da92..ae467add2 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.581 $ $NHDT-Date: 1625277130 2021/07/03 01:52:10 $ +NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.584 $ $NHDT-Date: 1625446012 2021/07/05 00:46:52 $ General Fixes and Modified Features ----------------------------------- @@ -556,6 +556,8 @@ perm_invent: when buying shop goods using itemized purchasing while persistent change getloc fastmove keys in number_pad mode from hardcoded HJKL to the run/rush movement keys (meta+number) allow using rush/run prefix key in getloc to fastmove the cursor +avoid "it" in messages "Wait! There's an it hiding under !" (hero + moving) and "It was hidden under !" (unseen monster moving) Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/mhitu.c b/src/mhitu.c index 0ba7f984f..e12add042 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 mhitu.c $NHDT-Date: 1606473488 2020/11/27 10:38:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.196 $ */ +/* NetHack 3.7 mhitu.c $NHDT-Date: 1625446012 2021/07/05 00:46:52 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.245 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -967,9 +967,10 @@ hitmu(register struct monst *mtmp, register struct attack *mattk) */ if (mtmp->mundetected && (hides_under(mdat) || mdat->mlet == S_EEL)) { mtmp->mundetected = 0; - if (!(Blind ? Blind_telepat : Unblind_telepat)) { + if (!tp_sensemon(mtmp) && !Detect_monsters) { struct obj *obj; const char *what; + char Amonbuf[BUFSZ]; if ((obj = g.level.objects[mtmp->mx][mtmp->my]) != 0) { if (Blind && !obj->dknown) @@ -979,7 +980,11 @@ hitmu(register struct monst *mtmp, register struct attack *mattk) else what = doname(obj); - pline("%s was hidden under %s!", Amonnam(mtmp), what); + Strcpy(Amonbuf, Amonnam(mtmp)); + /* mtmp might be invisible with hero unable to see same */ + if (!strcmp(Amonbuf, "It")) /* note: not strcmpi() */ + Strcpy(Amonbuf, Something); + pline("%s was hidden under %s!", Amonbuf, what); } newsym(mtmp->mx, mtmp->my); } diff --git a/src/uhitm.c b/src/uhitm.c index 74bf2f636..b0f0f5fdf 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 uhitm.c $NHDT-Date: 1617035737 2021/03/29 16:35:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.300 $ */ +/* NetHack 3.7 uhitm.c $NHDT-Date: 1625446013 2021/07/05 00:46:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.311 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -202,17 +202,24 @@ attack_checks(struct monst *mtmp, seemimic(mtmp); return FALSE; } - if (!((Blind ? Blind_telepat : Unblind_telepat) || Detect_monsters)) { + if (!tp_sensemon(mtmp) && !Detect_monsters) { struct obj *obj; + char lmonbuf[BUFSZ]; + boolean notseen; + Strcpy(lmonbuf, l_monnam(mtmp)); + /* might be unseen if invisible and hero can't see invisible */ + notseen = !strcmp(lmonbuf, "it"); /* note: not strcmpi() */ if (!Blind && Hallucination) - pline("A %s %s appeared!", - mtmp->mtame ? "tame" : "wild", l_monnam(mtmp)); + pline("A %s %s %s!", mtmp->mtame ? "tame" : "wild", + notseen ? "creature" : (const char *) lmonbuf, + notseen ? "is present" : "appears"); else if (Blind || (is_pool(mtmp->mx, mtmp->my) && !Underwater)) pline("Wait! There's a hidden monster there!"); else if ((obj = g.level.objects[mtmp->mx][mtmp->my]) != 0) pline("Wait! There's %s hiding under %s!", - an(l_monnam(mtmp)), doname(obj)); + notseen ? something : (const char *) an(lmonbuf), + doname(obj)); return TRUE; } }