From b2a80ab87ae55841eda029722fa0c1acc0f942f6 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 2 Apr 2026 15:40:03 +0300 Subject: [PATCH] Prevent phaseable monster hiding deep in undiggable walls The outer edge of a random dungeon level can have undiggable walls. Phaseable monsters, such as earth elementals, could hide deep inside that boundary. Turn the walls beyond the first layer of non-diggable walls also non-phaseable. --- doc/fixes3-7-0.txt | 1 + src/mkmaze.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 1d40de239..47d4f53f7 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1592,6 +1592,7 @@ one orc-town shaman has a higher level, affecting spellcasting hero has a small chance of catching items thrown at them wizard mode: history menu for #wizwish and WIZKIT monster priests and wizards did not cast spells +prevent phaseable monsters hiding deep inside nondiggable walls Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/mkmaze.c b/src/mkmaze.c index 9c665a37e..573eada04 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -1426,8 +1426,9 @@ get_level_extends( *bottom = ymax; } -/* put a non-diggable boundary around the initial portion of a level map. - * assumes that no level will initially put things beyond the isok() range. +/* put a non-diggable/non-phaseable boundary around the initial portion + * of a level map. assumes that no level will initially put things + * beyond the isok() range. * * we can't bound unconditionally on the last line with something in it, * because that something might be a niche which was already reachable, @@ -1449,9 +1450,14 @@ bound_digging(void) for (x = 0; x < COLNO; x++) for (y = 0; y < ROWNO; y++) - if (IS_STWALL(levl[x][y].typ) - && (y <= ymin || y >= ymax || x <= xmin || x >= xmax)) - levl[x][y].wall_info |= W_NONDIGGABLE; + if (IS_STWALL(levl[x][y].typ)) { + /* undiggable walls at edges, ... */ + if (y <= ymin || y >= ymax || x <= xmin || x >= xmax) + levl[x][y].wall_info |= W_NONDIGGABLE; + /* one tile past that, everything is also unphaseable */ + if (y < ymin || y > ymax || x < xmin || x > xmax) + levl[x][y].wall_info |= W_NONPASSWALL; + } } void