]> granicus.if.org Git - nethack/commitdiff
github issue #890 - hobbit #chat feedback
authorPatR <rankin@nethack.org>
Tue, 4 Oct 2022 22:03:35 +0000 (15:03 -0700)
committerPatR <rankin@nethack.org>
Tue, 4 Oct 2022 22:03:35 +0000 (15:03 -0700)
Issue reported by eakaye:  the alternate hobbit chat message is a
complaint about dungeon conditions, given if its current HP is 10
or more less than its maximum HP.  But since hobbits are level 1,
they will almost never have 10 HP so won't be alive to chat when
at max minus 10.

Keep the old behavior if maximum happens to be more than 10, but
give alternate feedback when less than max if max is 10 or less.

Fixes #890

src/sounds.c

index fdecb5c5658b769a8c46e1977eabda1ac0517c20..9369d0c58ac95b1ecea88e3c7c7068cbc4d43dc9 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 sounds.c        $NHDT-Date: 1600933442 2020/09/24 07:44:02 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.103 $ */
+/* NetHack 3.7 sounds.c        $NHDT-Date: 1664920994 2022/10/04 22:03:14 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.123 $ */
 /*      Copyright (c) 1989 Janet Walz, Mike Threepoint */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -949,10 +949,15 @@ domonnoise(register struct monst* mtmp)
         else
             switch (monsndx(ptr)) {
             case PM_HOBBIT:
-                pline_msg =
-                    (mtmp->mhpmax - mtmp->mhp >= 10)
-                        ? "complains about unpleasant dungeon conditions."
-                        : "asks you about the One Ring.";
+                /* 3.7: the 'complains' message used to be given if the
+                   hobbit's current hit points were at 10 below max or
+                   less, but their max is normally less than 10 so it
+                   would almost never occur */
+                pline_msg = (mtmp->mhp < mtmp->mhpmax
+                             && (mtmp->mhpmax <= 10
+                                 || mtmp->mhp <= mtmp->mhpmax - 10))
+                            ? "complains about unpleasant dungeon conditions."
+                            : "asks you about the One Ring.";
                 break;
             case PM_ARCHEOLOGIST:
                 pline_msg =