fix github issue #1253 - shape change vs Elbereth

Issue reported by chadministratorwastaken:  were-creature that was
ignoring Elbereth while in human form would make one more attack
after changing into creature form.

Have new_were() make an onscary() check when changing to beast form
while next to the hero.  Do likewise for polymorphing creature.

Fixes #1253
This commit is contained in:
PatR
2024-06-04 23:59:39 -07:00
parent 8652262105
commit cfb053157a
3 changed files with 27 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mon.c $NHDT-Date: 1716588803 2024/05/24 22:13:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.568 $ */
/* NetHack 3.7 mon.c $NHDT-Date: 1717570485 2024/06/05 06:54:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.573 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -5282,6 +5282,20 @@ newcham(
if (mtmp == u.usteed)
poly_steed(mtmp, olddata);
/* old form might not have been affected by Elbereth but perhaps the
new form is */
if (gc.context.mon_moving) {
/* give 'mtmp' a new chance to pinpoint hero's location */
if (!u_at(mtmp->mux, mtmp->muy))
set_apparxy(mtmp);
/* if hero is on Elbereth or scare monster, mtmp in new form might
become scared */
if (!mtmp->mpeaceful
&& onscary(mtmp->mux, mtmp->muy, mtmp)
&& monnear(mtmp, mtmp->mux, mtmp->muy))
monflee(mtmp, rn1(9, 2), TRUE, TRUE); /* 2..10 turns */
}
return 1;
}