From d75ffe4b3460fc2ccebf0d1bf8161d8fb355ff10 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 9 Oct 2025 09:52:30 -0400 Subject: [PATCH] distinguish magical and auditory scares Github issue #1326 states: "https://github.com/NetHack/NetHack/commit/dc9fe0d8bc96e006c119fa183c9c9a7c4cde2f53 aims to nerf scrolls of scare monster a bit, making humans and uniques immune. But in actuality this change also affects all elves, and also makes them immune to musical instruments, including the objectively scary drums of earthquake. This is possibly unintentional (I don't see why elves would be immune to bugles but dwarves wouldn't), and in my experience (playing EvilHack which ports this commit) it makes elves really annoying, and seems to contradict the commit's message about getting "most of the effect in the early game when you're usually dealing with normal monsters" (elves are fairly common starting from around Sokoban). [...] Also the commit has a comment saying "humans aren't monsters" presumably referring to the scroll of scare monster, but read scrolls can still scare most @, or uniques for that matter." Resolves #1326 --- src/monmove.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/monmove.c b/src/monmove.c index 8bf665099..0b0b27dfb 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -241,22 +241,33 @@ boolean onscary(coordxy x, coordxy y, struct monst *mtmp) { struct engr *ep; + /* <0,0> is used by musical scaring; + * it doesn't care about scrolls or engravings or dungeon branch */ + boolean auditory_scare = (x == 0 && y == 0), + magical_scare = !auditory_scare; - /* creatures who are directly resistant to magical scaring: - * humans aren't monsters - * uniques have ascended their base monster instincts - * Rodney, lawful minions, Angels, the Riders, shopkeepers - * inside their own shop, priests inside their own temple */ + /* creatures who are directly resistant to any type of scaring: + * Rodney, lawful minions, Angels, the Riders */ if (mtmp->iswiz || is_lminion(mtmp) || mtmp->data == &mons[PM_ANGEL] - || is_rider(mtmp->data) - || mtmp->data->mlet == S_HUMAN || unique_corpstat(mtmp->data) - || (mtmp->isshk && inhishop(mtmp)) + || is_rider(mtmp->data)) + return FALSE; + + /* creatures who are directly resistant to magical scaring + * based on the mere presence of something at a location: + * humans etc. + * uniques have ascended their base monster instincts */ + if (magical_scare + && (mtmp->data->mlet == S_HUMAN || unique_corpstat(mtmp->data))) + return FALSE; + + /* creatues who resist scaring under particular circumstances: + * shopkeepers inside their own shop + * priests inside their own temple */ + if ((mtmp->isshk && inhishop(mtmp)) || (mtmp->ispriest && inhistemple(mtmp))) return FALSE; - /* <0,0> is used by musical scaring to check for the above; - * it doesn't care about scrolls or engravings or dungeon branch */ - if (x == 0 && y == 0) + if (auditory_scare) return TRUE; /* should this still be true for defiled/molochian altars? */ @@ -286,7 +297,7 @@ onscary(coordxy x, coordxy y, struct monst *mtmp) || (Displaced && mtmp->mux == x && mtmp->muy == y) || (ep->guardobjects && vobj_at(x, y))) && !(mtmp->isshk || mtmp->isgd || !mtmp->mcansee - || mtmp->mpeaceful || mtmp->data->mlet == S_HUMAN + || mtmp->mpeaceful || mtmp->data == &mons[PM_MINOTAUR] || Inhell || In_endgame(&u.uz))); }