From c574df1239c436c557b54862aa6f35983fc40eb0 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 20 Jun 2015 14:15:02 +0300 Subject: [PATCH] Prevent unique monsters waking up prematurely Reported by Stefan: > I just did the valkyrie quest. When I arrived on quest goal, I took only > a few steps away from the upstairs and Lord Surtur jumped me. One of the > monsters in his lair had stepped on one of the guaranteed squeaky boards Squeaky boards (and other noisy things) woke up monsters that were meditating. Unfortunately this also woke up such meditating monsters as the Wiz, or the quest nemesis. Prevent unique monsters with waiting strategy being woken up by the noise. --- src/mon.c | 6 ++++-- src/music.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mon.c b/src/mon.c index 8ca8d16a1..8daf72ddc 100644 --- a/src/mon.c +++ b/src/mon.c @@ -2434,7 +2434,8 @@ wake_nearby() continue; if (distu(mtmp->mx, mtmp->my) < u.ulevel * 20) { mtmp->msleeping = 0; - mtmp->mstrategy &= ~STRAT_WAITMASK; + if (!unique_corpstat(mtmp->data)) + mtmp->mstrategy &= ~STRAT_WAITMASK; if (mtmp->mtame && !mtmp->isminion) EDOG(mtmp)->whistletime = moves; } @@ -2453,7 +2454,8 @@ register int x, y, distance; continue; if (distance == 0 || dist2(mtmp->mx, mtmp->my, x, y) < distance) { mtmp->msleeping = 0; - mtmp->mstrategy &= ~STRAT_WAITMASK; + if (!unique_corpstat(mtmp->data)) + mtmp->mstrategy &= ~STRAT_WAITMASK; } } } diff --git a/src/music.c b/src/music.c index 249b454e2..fd0b16a17 100644 --- a/src/music.c +++ b/src/music.c @@ -73,7 +73,7 @@ int distance; mtmp->mcanmove = 1; mtmp->mfrozen = 0; /* may scare some monsters -- waiting monsters excluded */ - if ((mtmp->mstrategy & STRAT_WAITMASK) != 0) + if (!unique_corpstat(mtmp->data) && (mtmp->mstrategy & STRAT_WAITMASK) != 0) mtmp->mstrategy &= ~STRAT_WAITMASK; else if (distm < distance / 3 && !resist(mtmp, TOOL_CLASS, 0, NOTELL)) @@ -195,7 +195,7 @@ struct monst *bugler; /* monster that played instrument */ mtmp->mcanmove = 1; mtmp->mfrozen = 0; /* may scare some monsters -- waiting monsters excluded */ - if ((mtmp->mstrategy & STRAT_WAITMASK) != 0) + if (!unique_corpstat(mtmp->data) && (mtmp->mstrategy & STRAT_WAITMASK) != 0) mtmp->mstrategy &= ~STRAT_WAITMASK; else if (distm < distance / 3 && !resist(mtmp, TOOL_CLASS, 0, NOTELL))