fix pull request #386 - monster interaction

The previous teleport scroll fix was mislabeled with this pull
request number.  Too late to fix that now; should have been

Closes #307

Now...  Interaction between voluntarily busy hero (resting,
searching, and so on) with approaching monsters to decide whether
to stop had some inconsistencies.

Really closes #386
This commit is contained in:
PatR
2020-09-18 15:53:43 -07:00
parent 81ec2bfa2a
commit 239620ffd7
3 changed files with 14 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.303 $ $NHDT-Date: 1600468452 2020/09/18 22:34:12 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.304 $ $NHDT-Date: 1600469617 2020/09/18 22:53:37 $
General Fixes and Modified Features
-----------------------------------
@@ -250,6 +250,7 @@ end of game inventory disclosure passed an inappropriate argument to the
turning into slime rendered hero as slime one turn too soon
avoid potential infinite loop if hangup occurs at ring "right or left?" prompt
randomize the turns where accessories and extrinsics affect nutrition
handle being interrupted by approaching monsters more consistently
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 hack.c $NHDT-Date: 1596498171 2020/08/03 23:42:51 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.267 $ */
/* NetHack 3.7 hack.c $NHDT-Date: 1600469617 2020/09/18 22:53:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.268 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2971,10 +2971,10 @@ monster_nearby()
continue;
if ((mtmp = m_at(x, y)) && M_AP_TYPE(mtmp) != M_AP_FURNITURE
&& M_AP_TYPE(mtmp) != M_AP_OBJECT
&& (!mtmp->mpeaceful || Hallucination)
&& (Hallucination
|| (!mtmp->mpeaceful && !noattacks(mtmp->data)))
&& (!is_hider(mtmp->data) || !mtmp->mundetected)
&& !noattacks(mtmp->data) && mtmp->mcanmove
&& !mtmp->msleeping /* aplvax!jcn */
&& mtmp->mcanmove && !mtmp->msleeping /* aplvax!jcn */
&& !onscary(u.ux, u.uy, mtmp) && canspotmon(mtmp))
return 1;
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 monmove.c $NHDT-Date: 1596498186 2020/08/03 23:43:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.142 $ */
/* NetHack 3.7 monmove.c $NHDT-Date: 1600469618 2020/09/18 22:53:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.143 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -114,16 +114,18 @@ register struct monst *mtmp;
/* a similar check is in monster_nearby() in hack.c */
/* check whether hero notices monster and stops current activity */
if (g.occupation && !rd && !Confusion && (!mtmp->mpeaceful || Hallucination)
if (g.occupation && !rd
/* monster is hostile and can attack (or hallu distorts knowledge) */
&& (Hallucination || (!mtmp->mpeaceful && !noattacks(mtmp->data)))
/* it's close enough to be a threat */
&& distu(x, y) <= (BOLT_LIM + 1) * (BOLT_LIM + 1)
&& distu(mtmp->mx, mtmp->my) <= (BOLT_LIM + 1) * (BOLT_LIM + 1)
/* and either couldn't see it before, or it was too far away */
&& (!already_saw_mon || !couldsee(x, y)
|| distu(x, y) > (BOLT_LIM + 1) * (BOLT_LIM + 1))
/* can see it now, or sense it and would normally see it */
&& (canseemon(mtmp) || (sensemon(mtmp) && couldsee(x, y)))
&& mtmp->mcanmove && !noattacks(mtmp->data)
&& !onscary(u.ux, u.uy, mtmp))
&& canspotmon(mtmp) && couldsee(mtmp->mx, mtmp->my)
/* monster isn't paralyzed or afraid (scare monster/Elbereth) */
&& mtmp->mcanmove && !onscary(u.ux, u.uy, mtmp))
stop_occupation();
return rd;