From d6ab241b8c39830de41c61f6fc2df5760d239cb9 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 19 Apr 2022 18:21:26 -0700 Subject: [PATCH] part of pull request #737 - pets approach \ 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 | 4 +++- src/dogmove.c | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 3ff27b35a..0a34d1ec1 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1566,7 +1566,9 @@ extend farlook's ", asleep" to ", 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 ------------------------------------------------ diff --git a/src/dogmove.c b/src/dogmove.c index 4a783c95e..f09b006a1 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -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)