From e8e1868b700bd73e70eadf78658b90ad5159e0c0 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 5 Sep 2025 12:37:40 -0400 Subject: [PATCH] part3 of 3 for GitHub issue #1441 > Perhaps related: when a wand of sleep hits a disguised already-sleeping > mimic (about which it is a separate question if they should go into > disguise when sleeping, is it supposed to be automagic or conscious > effort for them? but I digress), the mimic is not revealed (should it?) > but the message says "hits a mimic". Adjust restrap() so that a revealed mimic won't disguise itself while sleeping. This seems to be in keeping with mimic lore. Also, normal shop sounds (chime of register etc.) will wake a mimic up from indeterminate sleep. Closes #1441 --- include/extern.h | 2 ++ src/mon.c | 7 +++++++ src/shk.c | 10 ++++++++++ src/sounds.c | 1 + 4 files changed, 20 insertions(+) diff --git a/include/extern.h b/include/extern.h index 5f50b67ea..670fb77a8 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2920,6 +2920,8 @@ extern void globby_bill_fixup(struct obj *, struct obj *) NONNULLARG12; extern void credit_report(struct monst *shkp, int idx, boolean silent) NONNULLARG1; extern void use_unpaid_trapobj(struct obj *, coordxy, coordxy) NONNULLARG1; +extern void noisy_shop(struct mkroom *); + /* ### shknam.c ### */ diff --git a/src/mon.c b/src/mon.c index dce75521c..1536f460b 100644 --- a/src/mon.c +++ b/src/mon.c @@ -4647,6 +4647,13 @@ restrap(struct monst *mtmp) return FALSE; if (mtmp->data->mlet == S_MIMIC) { + if (mtmp->msleeping || mtmp->mfrozen) { + /* + * The mimic needs to be awake to disguise itself + * as something else. + */ + return FALSE; + } set_mimic_sym(mtmp); return TRUE; } else if (levl[mtmp->mx][mtmp->my].typ == ROOM) { diff --git a/src/shk.c b/src/shk.c index 3463effbd..d493caefb 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1063,6 +1063,16 @@ tended_shop(struct mkroom *sroom) return !mtmp ? FALSE : (boolean) inhishop(mtmp); } +void +noisy_shop(struct mkroom *sroom) +{ + struct monst *mtmp = sroom->resident; + + if (mtmp && inhishop(mtmp)) { + wake_nearto(mtmp->mx, mtmp->my, 11 * 11); + } +} + staticfn struct bill_x * onbill(struct obj *obj, struct monst *shkp, boolean silent) { diff --git a/src/sounds.c b/src/sounds.c index 599469de8..5e4a0e1cd 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -323,6 +323,7 @@ dosounds(void) "the chime of a cash register.", "Neiman and Marcus arguing!", }; You_hear1(shop_msg[rn2(2) + hallu]); + noisy_shop(sroom); } return; }