distinguish magical and auditory scares

Github issue #1326 states:
"dc9fe0d8bc
 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
This commit is contained in:
nhmall
2025-10-09 09:52:30 -04:00
parent 38161f3e4a
commit d75ffe4b34

View File

@@ -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)));
}