Fix boulder over a hole or a pit dug by a monster

When a monster digs down and creates a pit or a hole,
drop the boulder at the location into it.
This commit is contained in:
Pasi Kallinen
2024-05-28 18:31:12 +03:00
parent 800b3b4b4b
commit 2ebbd13f79
2 changed files with 4 additions and 1 deletions

View File

@@ -899,6 +899,7 @@ use_defensive(struct monst *mtmp)
pline("%s has made a pit in the %s.", Monnam(mtmp),
surface(mtmp->mx, mtmp->my));
}
fill_pit(mtmp->mx, mtmp->my);
return (mintrap(mtmp, FORCEBUNGLE) == Trap_Killed_Mon) ? 1 : 2;
}
t = maketrap(mtmp->mx, mtmp->my, HOLE);
@@ -915,6 +916,7 @@ use_defensive(struct monst *mtmp)
You_hear("%s crash through the %s.", something,
surface(mtmp->mx, mtmp->my));
}
fill_pit(mtmp->mx, mtmp->my);
/* we made sure that there is a level for mtmp to go to */
migrate_to_level(mtmp, ledger_no(&u.uz) + 1, MIGR_RANDOM,
(coord *) 0);

View File

@@ -3819,13 +3819,14 @@ float_up(void)
return;
}
/* a boulder fills a pit or a hole at x,y */
void
fill_pit(coordxy x, coordxy y)
{
struct obj *otmp;
struct trap *t;
if ((t = t_at(x, y)) != 0 && is_pit(t->ttyp)
if ((t = t_at(x, y)) != 0 && (is_pit(t->ttyp) || is_hole(t->ttyp))
&& (otmp = sobj_at(BOULDER, x, y)) != 0) {
obj_extract_self(otmp);
(void) flooreffects(otmp, x, y, "settle");