more monster/door interaction

Apply visibility fixups for monsters triggering door trap
explosions or digging through doors similar to the monster-opens-
door-handling from a couple of days.  Again, the issue is that
hero/player can see a closed door in situations where they can't
see an open one, and messages about the door being opened or
destroyed need to take that into account when seeing a closed
door go away.

Not as thoroughly tested as monster just opening closed door.
This commit is contained in:
PatR
2021-03-23 08:52:36 -07:00
parent e37d3d9f2d
commit 6c70b46ea1
4 changed files with 51 additions and 30 deletions

View File

@@ -1254,6 +1254,7 @@ boolean
mdig_tunnel(struct monst *mtmp)
{
register struct rm *here;
boolean sawit, seeit, trapped;
int pile = rnd(12);
here = &levl[mtmp->mx][mtmp->my];
@@ -1264,19 +1265,24 @@ mdig_tunnel(struct monst *mtmp)
if (closed_door(mtmp->mx, mtmp->my)) {
if (*in_rooms(mtmp->mx, mtmp->my, SHOPBASE))
add_damage(mtmp->mx, mtmp->my, 0L);
/* sawit: closed door location is more visible than an open one */
sawit = canseemon(mtmp); /* before door state change and unblock_pt */
trapped = (here->doormask & D_TRAPPED) ? TRUE : FALSE;
here->doormask = trapped ? D_NODOOR : D_BROKEN;
unblock_point(mtmp->mx, mtmp->my); /* vision */
if (here->doormask & D_TRAPPED) {
here->doormask = D_NODOOR;
if (mb_trapped(mtmp)) { /* mtmp is killed */
newsym(mtmp->mx, mtmp->my);
if (trapped) {
seeit = canseemon(mtmp);
if (mb_trapped(mtmp, sawit || seeit)) { /* mtmp is killed */
newsym(mtmp->mx, mtmp->my);
return TRUE;
}
} else {
if (!rn2(3) && flags.verbose) /* not too often.. */
draft_message(TRUE); /* "You feel an unexpected draft." */
here->doormask = D_BROKEN;
if (flags.verbose) {
if (!Unaware && !rn2(3)) /* not too often.. */
draft_message(TRUE); /* "You feel an unexpected draft." */
}
}
newsym(mtmp->mx, mtmp->my);
return FALSE;
} else if (here->typ == SCORR) {
here->typ = CORR, here->flags = 0;