]> granicus.if.org Git - nethack/commitdiff
fix github issue #486 - feedback while engulfed
authorPatR <rankin@nethack.org>
Sun, 18 Apr 2021 20:29:54 +0000 (13:29 -0700)
committerPatR <rankin@nethack.org>
Sun, 18 Apr 2021 20:29:54 +0000 (13:29 -0700)
Issue is about monster shape changes being sensed via telepathy
while hero is swallowed, so player gets told about things that
aren't being shown on the map.  Similar situation while underwater;
only monsters in adjacent water spots are shown on the screen, but
messages about sensed monsters will continue to be given.  It isn't
limited to shape changing; lots of places include telepathy,
extended monster detection, and warning against specific types of
creatures as criteria to decide whether the hero 'sees' something
that isn't directly visible happen.

Change sensemon() to behave as if being swallowed or underwater
blocks telepathy, extended monster detection, and warning.  I
consider this to be experimental, but it needs much wider testing
than would take place if put into its own test branch.  It can be
tweaked or reversed if that turns out to be necessary.

There should be no change in behavior when not swallowed and not
underwater.  But for either of those two situations, some messages
that have been getting delivered may be different (such as using
"it" instead of sensed monster's name) or suppressed.

Fixes #486

doc/fixes37.0
include/display.h
src/potion.c

index 8cbba5056b4b94d9ff2cbe66486bf87b0a2569e7..bf067b45252eeb11be08e85828831287b5c494ca 100644 (file)
@@ -465,6 +465,10 @@ contents of chests, large boxes, and ice boxes are now immune to water damage
        chests+large boxes were always immune and ice boxes always vulnerable)
 applying an empty brass lantern in an attempt to light it reported "your lamp
        has run out of power"; change to "your lantern is out of power"
+when swallowed or underwater, player could be told about events (such as a
+       shapechanger taking on a new form) that the hero sensed but which
+       were not shown on the screen; treat being swallowed or underwater as
+       situations which block telepathy, extended monster detection, warning
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index e3fa0d816825787111787f962c83dfd64c8c9eb5..a32469c89a791784b783a1936a3d84f75ff3059f 100644 (file)
@@ -38,6 +38,11 @@ enum explosion_types {
  *
  * Returns true if the hero can sense the given monster.  This includes
  * monsters that are hiding or mimicing other monsters.
+ *
+ * [3.7] Note: the map doesn't display any monsters when hero is swallowed
+ * (or display non-adjacent, non-submerged ones when hero is underwater),
+ * so treat those situations as blocking telepathy, detection, and warning
+ * even though conceptually they shouldn't do so.
  */
 #define tp_sensemon(mon) \
     (/* The hero can always sense a monster IF:        */  \
@@ -49,15 +54,19 @@ enum explosion_types {
           /*        object and in range                */  \
           || (Unblind_telepat                              \
               && (distu(mon->mx, mon->my) <= (BOLT_LIM * BOLT_LIM)))))
-
+/* organized to perform cheaper tests first;
+   is_pool() vs is_pool_or_lava(): hero who is underwater can see adjacent
+   lava, but presumeably any monster there is on top so not sensed */
 #define sensemon(mon) \
-    (tp_sensemon(mon) || Detect_monsters || MATCH_WARN_OF_MON(mon))
+    (   (!u.uswallow || (mon) == u.ustuck)                                 \
+     && (!Underwater || (distu((mon)->mx, (mon)->my) <= 2                  \
+                         && is_pool((mon)->mx, (mon)->my)))                \
+     && (Detect_monsters || tp_sensemon(mon) || MATCH_WARN_OF_MON(mon))   )
 
 /*
  * mon_warning() is used to warn of any dangerous monsters in your
  * vicinity, and a glyph representing the warning level is displayed.
  */
-
 #define mon_warning(mon)                                                 \
     (Warning && !(mon)->mpeaceful && (distu((mon)->mx, (mon)->my) < 100) \
      && (((int) ((mon)->m_lev / 4)) >= g.context.warnlevel))
index 22c21c06044deb5b048717274d52acc624584992..516f4d9bd84dc03d505accbb6f76c7b7a9a9ea0c 100644 (file)
@@ -826,10 +826,13 @@ peffects(struct obj *otmp)
                         g.potion_unkn = 0;
                 }
             }
-            see_monsters();
-            if (g.potion_unkn)
-                You_feel("lonely.");
-            break;
+            /* if swallowed or underwater, fall through to uncursed case */
+            if (!u.uswallow && !Underwater) {
+                see_monsters();
+                if (g.potion_unkn)
+                    You_feel("lonely.");
+                break;
+            }
         }
         if (monster_detect(otmp, 0))
             return 1; /* nothing detected */