From: nethack.rankin Date: Thu, 11 Sep 2003 02:45:55 +0000 (+0000) Subject: fix U640 - Medusa bug X-Git-Tag: MOVE2GIT~1799 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=951ca18e619b0c19edc6195509644596e98d5455;p=nethack fix U640 - Medusa bug Described in the newsgroup a while back and recently reported: if you had reflection and were invisible and had esp and were blind, Medusa would turn herself to stone by looking at you. When you're invisible, she shouldn't be able to see your source of reflection so shouldn't be affected by the gaze; that's how things work when you aren't blind but the relevant code was being skipped when you are. Now esp is irrelevant for this and she'll see her reflected gaze only when she can see you, regardless of whether you see it happen. --- diff --git a/doc/fixes34.3 b/doc/fixes34.3 index 8ae309ed2..e68f6218a 100644 --- a/doc/fixes34.3 +++ b/doc/fixes34.3 @@ -13,6 +13,8 @@ fix inconsistency where you can't kick something out of a pit, but you can the bottom of pit room cleanup, eg on Bustling Town, could incorrectly truncate room bounds for rooms that become L shared due to partial overlap with the MAP +approaching Medusa while having reflection+invisibility+esp would cause her + to turn herself to stone if you happened to be at the time Platform- and/or Interface-Specific Fixes diff --git a/src/mhitu.c b/src/mhitu.c index 69d5c009c..67810f9f7 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)mhitu.c 3.4 2003/01/02 */ +/* SCCS Id: @(#)mhitu.c 3.4 2003/09/09 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1861,33 +1861,33 @@ gazemu(mtmp, mattk) /* monster gazes at you */ switch(mattk->adtyp) { case AD_STON: if (mtmp->mcan || !mtmp->mcansee) { - if (mtmp->data == &mons[PM_MEDUSA] && canseemon(mtmp)) { - if (mtmp->mcan) { - pline("%s doesn't look all that ugly.", - Monnam(mtmp)); - break; - } - } - if (canseemon(mtmp)) - pline("%s gazes ineffectually.", Monnam(mtmp)); + if (!canseemon(mtmp)) break; /* silently */ + pline("%s %s.", Monnam(mtmp), + (mtmp->data == &mons[PM_MEDUSA] && mtmp->mcan) ? + "doesn't look all that ugly" : + "gazes ineffectually"); break; } - if (Reflecting && canspotmon(mtmp) && - mtmp->data == &mons[PM_MEDUSA]) { - if(!Blind) { - (void) ureflects("%s gaze is reflected by your %s.", - s_suffix(Monnam(mtmp))); - if (mon_reflects(mtmp, - "The gaze is reflected away by %s %s!")) - break; - if (!m_canseeu(mtmp)) { /* probably you're invisible */ - pline("%s doesn't seem to notice that %s gaze was reflected.", - Monnam(mtmp), - mhis(mtmp)); - break; - } - pline("%s is turned to stone!", Monnam(mtmp)); + if (Reflecting && couldsee(mtmp->mx, mtmp->my) && + mtmp->data == &mons[PM_MEDUSA]) { + /* hero has line of sight to Medusa and she's not blind */ + boolean useeit = canseemon(mtmp); + + if (useeit) + (void) ureflects("%s gaze is reflected by your %s.", + s_suffix(Monnam(mtmp))); + if (mon_reflects(mtmp, !useeit ? (char *)0 : + "The gaze is reflected away by %s %s!")) + break; + if (!m_canseeu(mtmp)) { /* probably you're invisible */ + if (useeit) + pline( + "%s doesn't seem to notice that %s gaze was reflected.", + Monnam(mtmp), mhis(mtmp)); + break; } + if (useeit) + pline("%s is turned to stone!", Monnam(mtmp)); stoned = TRUE; killed(mtmp);