]> granicus.if.org Git - nethack/commitdiff
part of pull request #737 - pets approach \
authorPatR <rankin@nethack.org>
Wed, 20 Apr 2022 01:21:26 +0000 (18:21 -0700)
committerPatR <rankin@nethack.org>
Wed, 20 Apr 2022 01:21:26 +0000 (18:21 -0700)
hero when hero is [impatiently waiting...] on stairs

My attempts to cherry-pick this failed, so this was done manually.
It is a reimplementation of
NullCGT:feature/monster-item-use:dc2cef0562542fece1732dd2d4c4f0775308faff

] Pets approach the player if they are standing on the stairs.
]
] One of the most frequent complaints I have seen is that pets refuse
] to follow their owners down the stairs. While this can be resolved by
] waiting, most players, especially new ones, are not willing to spend
] multiple dozens of turns waiting for their pets to approach closely
] enough to follow them. This simple commit makes pets react to a player
] standing on stairs as if the player is holding a tripe ration. Simple,
] non-disruptive, and should solve many headaches.

doc/fixes3-7-0.txt
src/dogmove.c

index 3ff27b35af09646ea532eb4f38a13fee5459e857..0a34d1ec17377488c83e2b33630d039257c0f32b 100644 (file)
@@ -1566,7 +1566,9 @@ extend farlook's "<mon>, asleep" to "<mon>, can't move (paralyzed or sleeping
        that is waiting for hero to approach
 add body part terminology for spiders; enhance it for cockatrices
 context sensitive item usage menu from inventory, aka "item actions"
-
+pets are more likely to follow you closely if you are carrying something they
+       really like to eat; behave as if you are carrying such whenever you
+       are standing on stairs so that pets will try harder to come to you
 
 Platform- and/or Interface-Specific New Features
 ------------------------------------------------
index 4a783c95e8a668b9a9b8a721d50c3436e57f1796..f09b006a176a7a994091e20a82e8301aeae3aa1f 100644 (file)
@@ -593,13 +593,19 @@ dog_goal(register struct monst *mtmp, struct edog *edog,
                 || (dog_has_minvent && rn2(edog->apport)))
                 appr = 1;
         }
-        /* if you have dog food it'll follow you more closely */
-        if (appr == 0)
-            for (obj = g.invent; obj; obj = obj->nobj)
-                if (dogfood(mtmp, obj) == DOGFOOD) {
-                    appr = 1;
-                    break;
-                }
+        /* if you have dog food it'll follow you more closely; if you are
+           on stairs (or ladder), it will behave as if you have dog food */
+        if (appr == 0) {
+            if (On_stairs(u.ux, u.uy)) {
+                appr = 1;
+            } else {
+                for (obj = g.invent; obj; obj = obj->nobj)
+                    if (dogfood(mtmp, obj) == DOGFOOD) {
+                        appr = 1;
+                        break;
+                    }
+            }
+        }
     } else
         appr = 1; /* gtyp != UNDEF */
     if (mtmp->mconf)