fix github issue #900 - "Elbereth" engravings

Issue reported by vultur-cadens:  Elbereth used to be effective in
inhibiting monster movement when an object was present on the same
spot, but since 3.6.0 it isn't.  It only functions that way when the
hero--or hero's displaced image--is present these days.  So special
levels that have been using engraved Elbereth to try to protect
objects from monsters haven't been providing any useful protection.

This makes Elbereth that's engraved during level creation work like
it used to in 3.4.3 and earlier:  when there's at least one object
on the engraving's spot, monsters who are affected by Elbereth will
be affected.  [I'm fairly sure that that behavior started out
unintentionally, as a side-effect of an optimization to only check
for scroll of scare monster when there was at least one item present
which is a necessary condition for such a scroll.]

Old-style Elbereth includes Elbereth chosen as a random engraving
during level creation in addition to engravings specified in special
level definitions.  Engravings by the player don't have the required
attribute and player-engraved Elbereth behaves in the 3.6 way.

This ought to be replaced by something more general.  Perhaps a new
engraving type not usable by the player?

Fixes #900
This commit is contained in:
PatR
2022-10-15 02:13:39 -07:00
parent 2e981966d0
commit 064c9fb52e
5 changed files with 36 additions and 19 deletions
+5 -3
View File
@@ -40,7 +40,8 @@ noteleport_level(struct monst* mon)
}
/* this is an approximation of onscary() that doesn't use any 'struct monst'
fields aside from 'monst->data' */
fields aside from 'monst->data'; used primarily for new monster creation
and monster teleport destination, not for ordinary monster movement */
static boolean
goodpos_onscary(
coordxy x, coordxy y,
@@ -60,10 +61,11 @@ goodpos_onscary(
/* engraved Elbereth doesn't work in Gehennom or the end-game */
if (Inhell || In_endgame(&u.uz))
return FALSE;
/* creatures who don't (or can't) fear a written Elbereth */
/* creatures who don't (or can't) fear a written Elbereth and weren't
caught by the minions check */
if (mptr == &mons[PM_MINOTAUR] || !haseyes(mptr))
return FALSE;
return sengr_at("Elbereth", x, y, TRUE);
return sengr_at("Elbereth", x, y, TRUE) ? TRUE : FALSE;
}
/*