From a18859ddb5a3407fb872538f73b67550907adf2f Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Thu, 9 Jun 2022 12:48:41 -0400 Subject: [PATCH] Let fleeing monsters dig pits in undiggable floor When the hero zaps a wand of digging down in an undiggable level, it creates a pit. When a fleeing monster did the same thing, it had no effect. Bring this closer to the behavior experienced by the hero: if a monster tries to use a wand of digging to create a hole in an undiggable floor, a pit will be made (and the monster will fall into it, if not a flyer). --- src/muse.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/muse.c b/src/muse.c index 44d5cb2e8..9ef429369 100644 --- a/src/muse.c +++ b/src/muse.c @@ -782,10 +782,23 @@ use_defensive(struct monst* mtmp) return 2; } if (!Can_dig_down(&u.uz) && !levl[mtmp->mx][mtmp->my].candig) { - if (canseemon(mtmp)) - pline_The("%s here is too hard to dig in.", - surface(mtmp->mx, mtmp->my)); - return 2; + /* can't dig further if there's already a pit (or other trap) + here, or if pit creation fails for some reason */ + if (t_at(mtmp->mx, mtmp->my) + || !(ttmp = maketrap(mtmp->mx, mtmp->my, PIT))) { + if (vismon) { + pline_The("%s here is too hard to dig in.", + surface(mtmp->mx, mtmp->my)); + } + return 2; + } + /* pit creation succeeded */ + if (vis) { + seetrap(ttmp); + pline("%s has made a pit in the %s.", Monnam(mtmp), + surface(mtmp->mx, mtmp->my)); + } + return (mintrap(mtmp, FORCEBUNGLE) == Trap_Killed_Mon) ? 1 : 2; } ttmp = maketrap(mtmp->mx, mtmp->my, HOLE); if (!ttmp)