]> granicus.if.org Git - nethack/commitdiff
Tweaks to chatting with mute shopkeeper
authorMichael Meyer <me@entrez.cc>
Fri, 2 Dec 2022 17:32:35 +0000 (12:32 -0500)
committerPatR <rankin@nethack.org>
Sat, 31 Dec 2022 20:22:13 +0000 (12:22 -0800)
A mute shopkeeper shouldn't be able to verbally tell you the prices of
objects.  For normal chatting, on the other hand, shk_chat can handle a
mute shopkeeper (by changing from speech to "indications" -- hand signs,
body language, etc), so allow execution to reach that even if the
shopkeeper is mute (in a silent polyform).

Also more generally allow a shopkeeper to continue chatting with normal
shopkeeper responses if polymorphed into another creature, since they
apparently retain their minds (are able to tell you prices, can
transact, etc).

This is mostly inspired by the fact shk_chat has extensive handling for
mute shopkeepers, but it was unreachable as far as I can tell.  It is
also funny to think of a newt or something wriggling around to indicate
it's been making a lot of money lately.

src/shk.c
src/sounds.c

index 73d563d808a08955c4d9ed61f47e9aea95cb9545..dcdaa82ea9c8891c527b9857aa2d18b88e25fb40 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -4582,7 +4582,7 @@ shop_object(register coordxy x, register coordxy y)
             break;
     /* note: otmp might have ->no_charge set, but that's ok */
     return (otmp && costly_spot(x, y)
-            && NOTANGRY(shkp) && !helpless(shkp))
+            && NOTANGRY(shkp) && !muteshk(shkp))
                ? otmp
                : (struct obj *) 0;
 }
index 49e2c2c50252b316f813392152db47544a5a5f2e..ab07595c3e4673c9af36801c0eeda5c88e582bbb 100644 (file)
@@ -608,7 +608,9 @@ domonnoise(register struct monst* mtmp)
     /* presumably nearness and sleep checks have already been made */
     if (Deaf)
         return ECMD_OK;
-    if (is_silent(ptr))
+    if (is_silent(ptr)
+        /* shk_chat can handle nonverbal monsters */
+        && !mtmp->isshk)
         return ECMD_OK;
 
     /* leader might be poly'd; if he can still speak, give leader speech */
@@ -617,13 +619,16 @@ domonnoise(register struct monst* mtmp)
     /* make sure it's your role's quest guardian; adjust if not */
     else if (msound == MS_GUARDIAN && ptr != &mons[gu.urole.guardnum])
         msound = mons[genus(monsndx(ptr), 1)].msound;
+    /* even polymorphed, shopkeepers retain their minds and capitalist bent */
+    else if (mtmp->isshk)
+        msound = MS_SELL;
     /* some normally non-speaking types can/will speak if hero is similar */
     else if (msound == MS_ORC
              && ((same_race(ptr, gy.youmonst.data)        /* current form, */
                   || same_race(ptr, &mons[Race_switch])) /* unpoly'd form */
                  || Hallucination))
         msound = MS_HUMANOID;
-    /* silliness, with slight chance to interfere with shopping */
+    /* silliness; formerly had a slight chance to interfere with shopping */
     else if (Hallucination && mon_is_gecko(mtmp))
         msound = MS_SELL;
 
@@ -645,7 +650,7 @@ domonnoise(register struct monst* mtmp)
         quest_chat(mtmp);
         break;
     case MS_SELL: /* pitch, pay, total */
-        if (!Hallucination || (mtmp->isshk && !rn2(2))) {
+        if (!Hallucination || is_silent(ptr) || (mtmp->isshk && !rn2(2))) {
             shk_chat(mtmp);
         } else {
             /* approximation of GEICO's advertising slogan (it actually