busy hero ignoring monster threat
Fix the problem reported by entrez of a zombie corpse reviving and crawling out of the ground while the hero was busy doing something (searching, digging, &c) and having the hero fail to react and just keep doing whatever the thing was because the zombie was already inside the range where a monster changes from no-threat to threat. Done in the monster creation routine so any new monster (including one revived from a corpse) that is visible,&c will cause the hero's action to be interrupted. Teleport arrival probably needs this too. Only interrupts an occupation, not other voluntary multi-turn actitivy such as running or traveling. That would be trivial to change ['if (g.occupation...' to 'if ((g.occupation || multi > 0)...'] but I'm not sure whether it ought to be extended to that.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.903 $ $NHDT-Date: 1651298443 2022/04/30 06:00:43 $
|
||||
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.906 $ $NHDT-Date: 1651886993 2022/05/07 01:29:53 $
|
||||
|
||||
General Fixes and Modified Features
|
||||
-----------------------------------
|
||||
@@ -1198,6 +1198,9 @@ using #wizmakemap on Plane of Water added a new set of air bubbles each time
|
||||
with clouds on Plane of Air
|
||||
avoid new "where are we?" panic if player quits during character selection
|
||||
add Untrap as a potential 'autounlock' action
|
||||
if a zombie revived near the hero, a busy hero would keep doing whatever
|
||||
action was in progress instead of stopping because the zombify didn't
|
||||
walk across the threshold from no-threat to threat
|
||||
|
||||
curses: 'msg_window' option wasn't functional for curses unless the binary
|
||||
also included tty support
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 extern.h $NHDT-Date: 1650875486 2022/04/25 08:31:26 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1109 $ */
|
||||
/* NetHack 3.7 extern.h $NHDT-Date: 1651886993 2022/05/07 01:29:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1112 $ */
|
||||
/* Copyright (c) Steve Creps, 1988. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -1622,7 +1622,7 @@ extern boolean itsstuck(struct monst *);
|
||||
extern boolean mb_trapped(struct monst *, boolean);
|
||||
extern boolean monhaskey(struct monst *, boolean);
|
||||
extern void mon_regen(struct monst *, boolean);
|
||||
extern int dochugw(struct monst *);
|
||||
extern int dochugw(struct monst *, boolean);
|
||||
extern boolean onscary(int, int, struct monst *);
|
||||
extern struct monst *find_pmmonst(int);
|
||||
extern int bee_eat_jelly(struct monst *, struct obj *);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 makemon.c $NHDT-Date: 1646694721 2022/03/07 23:12:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.199 $ */
|
||||
/* NetHack 3.7 makemon.c $NHDT-Date: 1651886995 2022/05/07 01:29:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.204 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1456,6 +1456,10 @@ makemon(
|
||||
: "",
|
||||
exclaim ? '!' : '.');
|
||||
}
|
||||
/* if discernable and a threat, stop fiddling while Rome burns */
|
||||
if (g.occupation)
|
||||
(void) dochugw(mtmp, TRUE);
|
||||
|
||||
/* TODO: unify with teleport appears msg */
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 mon.c $NHDT-Date: 1650836671 2022/04/24 21:44:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.423 $ */
|
||||
/* NetHack 3.7 mon.c $NHDT-Date: 1651886997 2022/05/07 01:29:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.424 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -1064,7 +1064,7 @@ movemon(void)
|
||||
&& fightm(mtmp))
|
||||
continue; /* mon might have died */
|
||||
}
|
||||
if (dochugw(mtmp)) /* otherwise just move the monster */
|
||||
if (dochugw(mtmp, FALSE)) /* otherwise just move the monster */
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 monmove.c $NHDT-Date: 1603507386 2020/10/24 02:43:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.146 $ */
|
||||
/* NetHack 3.7 monmove.c $NHDT-Date: 1651886999 2022/05/07 01:29:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.179 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Michael Allison, 2006. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -109,14 +109,25 @@ watch_on_duty(register struct monst* mtmp)
|
||||
}
|
||||
}
|
||||
|
||||
/* move a monster; if a threat to busy hero, stop doing whatever it is */
|
||||
int
|
||||
dochugw(register struct monst* mtmp)
|
||||
dochugw(
|
||||
register struct monst *mtmp,
|
||||
boolean dontchug) /* True: monster was just created, or maybe it has
|
||||
* teleported; perform stop-what-you're-doing-if-close-
|
||||
* enough-to-be-a-threat check but don't move mtmp */
|
||||
{
|
||||
int x = mtmp->mx, y = mtmp->my;
|
||||
boolean already_saw_mon = !g.occupation ? 0 : canspotmon(mtmp);
|
||||
int rd = dochug(mtmp);
|
||||
boolean already_saw_mon = ((dontchug || !g.occupation) ? 0
|
||||
: canspotmon(mtmp));
|
||||
int rd = dontchug ? 0 : dochug(mtmp);
|
||||
|
||||
/*
|
||||
* A similar check is in monster_nearby() in hack.c.
|
||||
* [The two checks have a lot of differences and chances are high
|
||||
* that some of those are unintentional.]
|
||||
*/
|
||||
|
||||
/* a similar check is in monster_nearby() in hack.c */
|
||||
/* check whether hero notices monster and stops current activity */
|
||||
if (g.occupation && !rd
|
||||
/* monster is hostile and can attack (or hallu distorts knowledge) */
|
||||
|
||||
Reference in New Issue
Block a user