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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user