From 21068b05c5c98ad7d5e50a9dbaa1b6256063e2e3 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 5 Jan 2024 16:15:30 -0800 Subject: [PATCH] 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 --- doc/fixes3-7-0.txt | 2 ++ src/mon.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index d2423a075..713537929 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1346,6 +1346,8 @@ if polymorphing a potion turned it into oil, dipping potions produced oil set of the original potion's age (turn it was created) and could burn for an arbitrarily long time if applied; conversely, polymophing oil into non-oil kept its relative age (no noticeable effect though) +an engulfer capable of passing through iron bars could do so even when hero + was engulfed Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/mon.c b/src/mon.c index cfc773a3e..6e9c8ae47 100644 --- a/src/mon.c +++ b/src/mon.c @@ -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))