]> granicus.if.org Git - nethack/commitdiff
fix U640 - Medusa bug
authornethack.rankin <nethack.rankin>
Thu, 11 Sep 2003 02:45:55 +0000 (02:45 +0000)
committernethack.rankin <nethack.rankin>
Thu, 11 Sep 2003 02:45:55 +0000 (02:45 +0000)
     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.

doc/fixes34.3
src/mhitu.c

index 8ae309ed283d11314f9a1dadb0350cad104fd801..e68f6218a40b5a3a8577a3c2692f8b4025977d88 100644 (file)
@@ -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
index 69d5c009cb596064648357691bc05a9f83b3804f..67810f9f7fb874d729f8a76241e1ecd3ac9776d3 100644 (file)
@@ -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);