Merge branch 'derek-elbereth'

* derek-elbereth:
  ensure that the 'safe' objects remain safe
  finish up the changes to trigger erosion on use
  initial pass for toning down Elbereth

Conflicts:
	dat/castle.des
	dat/sokoban.des
	include/extern.h
	src/engrave.c
	src/mklev.c
	src/monmove.c
	src/zap.c
This commit is contained in:
Derek S. Ray
2015-05-09 11:58:36 -04:00
7 changed files with 88 additions and 47 deletions

View File

@@ -1,5 +1,4 @@
/* NetHack 3.6 monmove.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.6 monmove.c $Date: 2011/08/30 22:13:27 $ $Revision: 1.46 $ */
/* NetHack 3.6 monmove.c $NHDT-Date: 1430172947 2015/04/27 22:15:47 $ $NHDT-Branch: derek-elbereth $:$NHDT-Revision: 1.62 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -123,17 +122,42 @@ onscary(x, y, mtmp)
int x, y;
struct monst *mtmp;
{
if (mtmp->isshk || mtmp->isgd || mtmp->iswiz || !mtmp->mcansee ||
mtmp->mpeaceful || mtmp->data->mlet == S_HUMAN ||
is_lminion(mtmp) || mtmp->data == &mons[PM_ANGEL] ||
is_rider(mtmp->data) || mtmp->data == &mons[PM_MINOTAUR])
return(FALSE);
boolean epresent = sengr_at("Elbereth", x, y, TRUE);
/* creatures who are directly resistant to magical scaring:
* Rodney, lawful minions, angels, the Riders
*/
if (mtmp->iswiz || is_lminion(mtmp)
|| mtmp->data == &mons[PM_ANGEL]
|| is_rider(mtmp->data))
return(FALSE);
return (boolean)(sobj_at(SCR_SCARE_MONSTER, x, y) ||
sengr_at("Elbereth", x, y) ||
(IS_ALTAR(levl[x][y].typ) &&
(mtmp->data->mlet == S_VAMPIRE ||
is_vampshifter(mtmp))));
/* creatures who don't (or can't) fear a written Elbereth:
* all the above plus shopkeepers, guards, blind or
* peaceful monsters, humans, and minotaurs.
*
* Elbereth doesn't work in Gehennom, the Elemental Planes, or the
* Astral Plane; the influence of the Valar only reaches so far.
*/
if (epresent && (mtmp->isshk || mtmp->isgd || !mtmp->mcansee
|| mtmp->mpeaceful || mtmp->data->mlet == S_HUMAN
|| mtmp->data == &mons[PM_MINOTAUR]
|| Inhell || In_endgame(&u.uz)))
return(FALSE);
/* should this still be true for defiled/molochian altars? */
if (IS_ALTAR(levl[x][y].typ) && (mtmp->data->mlet == S_VAMPIRE
|| is_vampshifter(mtmp)))
return(TRUE);
/* if the player isn't actually on the square OR the player's image
* isn't displaced to the square, no protection is being granted
*
* the scare monster scroll, though, is quite powerful.
*/
return (boolean)(sobj_at(SCR_SCARE_MONSTER, x, y)
|| (epresent && ((u.ux == x && u.uy == y)
|| (Displaced && mtmp->mux == x && mtmp->muy == y))));
}
/* regenerate lost hit points */
@@ -254,6 +278,7 @@ register struct monst *mtmp;
int *inrange, *nearby, *scared;
{
int seescaryx, seescaryy;
boolean sawscary = FALSE;
*inrange = (dist2(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy) <=
(BOLT_LIM * BOLT_LIM));
@@ -273,11 +298,18 @@ int *inrange, *nearby, *scared;
seescaryx = u.ux;
seescaryy = u.uy;
}
if (*nearby &&
(onscary(seescaryx, seescaryy, mtmp) ||
(!mtmp->mpeaceful && in_your_sanctuary(mtmp, 0, 0)))) {
sawscary = onscary(seescaryx, seescaryy, mtmp);
if (*nearby && (sawscary || (!mtmp->mpeaceful
&& in_your_sanctuary(mtmp, 0, 0)))) {
*scared = 1;
monflee(mtmp, rnd(rn2(7) ? 10 : 100), TRUE, TRUE);
/* magical protection won't last forever, so there'll be a
* chance of the magic being used up regardless of type */
if (sawscary) {
wipe_engr_at(seescaryx, seescaryy, 1, TRUE);
}
} else
*scared = 0;
}
@@ -337,7 +369,7 @@ register struct monst *mtmp;
}
/* not frozen or sleeping: wipe out texts written in the dust */
wipe_engr_at(mtmp->mx, mtmp->my, 1);
wipe_engr_at(mtmp->mx, mtmp->my, 1, FALSE);
/* confused monsters get unconfused with small probability */
if (mtmp->mconf && !rn2(50)) mtmp->mconf = 0;