Prevent leashing monsters with no extremities

... and also unsolid monsters.
This commit is contained in:
Pasi Kallinen
2019-11-02 11:40:12 +02:00
parent 13f4a466d9
commit 4c9f4dbbd9
2 changed files with 9 additions and 5 deletions

View File

@@ -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

View File

@@ -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));