fix github issue #1192 - engulfers vs iron bars

Issue reported by Umbire:  an engulfing monster capable of passing
through iron bars (vortices and air elemental) could do so while
carrying the hero.

Prevent an engulfer from doing that unless the hero happens to be
polymorphed into a subset of the types of monsters that can move to
iron bar locations.

Fixes #1192
This commit is contained in:
PatR
2024-01-05 16:15:30 -08:00
parent 2c26176de8
commit 21068b05c5
2 changed files with 7 additions and 1 deletions

View File

@@ -1873,7 +1873,11 @@ mon_allowflags(struct monst* mtmp)
allowflags |= OPENDOOR;
if (can_unlock)
allowflags |= UNLOCKDOOR;
if (passes_bars(mtmp->data))
if (passes_bars(mtmp->data)
/* restrict engulfer or holder who might try to pass iron bars while
carrying hero; accept small subset for poly'd hero passes_bars() */
&& (mtmp != u.ustuck || (unsolid(gy.youmonst.data)
|| verysmall(gy.youmonst.data))))
allowflags |= ALLOW_BARS;
#if 0 /* can't do this here; leave it for mfndpos() */
if (is_displacer(mtmp->data))