From 4c9f4dbbd937bea1bccfa692bebdfcd873b9c4dc Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 2 Nov 2019 11:40:12 +0200 Subject: [PATCH] Prevent leashing monsters with no extremities ... and also unsolid monsters. --- doc/fixes36.3 | 1 + src/apply.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 4738aa857..df3a55a30 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -211,6 +211,7 @@ wizmakemap could leave genocided monsters on map when entering Astral level, initial rendering of guardian angel didn't show it as tame; noticeable if the level was entered with 'hilite_pet' On fix a leashed pet polymorphed into a long worm staying leashed +prevent leashing unsolid monsters and monsters with no extremities Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/apply.c b/src/apply.c index 96f9469b6..6c135f110 100644 --- a/src/apply.c +++ b/src/apply.c @@ -591,15 +591,13 @@ unleash_all() #define MAXLEASHED 2 -/* TODO: - * This ought to exclude various other things, such as lights and gas - * spore, is_whirly() critters, ethereal creatures, possibly others. - */ boolean leashable(mtmp) struct monst *mtmp; { - return (boolean) (mtmp->mnum != PM_LONG_WORM); + return (boolean) (mtmp->mnum != PM_LONG_WORM + && !unsolid(mtmp->data) + && (!nolimbs(mtmp->data) || has_head(mtmp->data))); } /* ARGSUSED */ @@ -671,6 +669,11 @@ struct obj *obj; if (mtmp->mleashed) { pline("This %s is already leashed.", spotmon ? l_monnam(mtmp) : "creature"); + } else if (unsolid(mtmp->data)) { + pline("The leash would just fall off."); + } else if (nolimbs(mtmp->data) && !has_head(mtmp->data)) { + pline("%s has no extremities the leash would fit.", + Monnam(mtmp)); } else if (!leashable(mtmp)) { pline("The leash won't fit onto %s%s.", spotmon ? "your " : "", l_monnam(mtmp));