fix github issue #372 - Wizard escaping dungeon

If the Wizard fled up the stairs on level 1 and escaped the dungeon
(which can only happen if he isn't carrying the Amulet or any of
the invocation items), the number_of_wizards counter wasn't being
decremented.  If that was the only Wizard, he couldn't be brought
back into play because he wasn't on the migrating monsters list, and
he wouldn't appear on the Plane of Earth when the hero eventually
went there.  If that was one of two, the remaining one couldn't use
Double Trouble anymore.  (I'm not sure about Earth handling in that
situation; should be moot now.)

Wizard mode blessed genocide of "*" when the Wizard is on current
level caused the same problem.

Fix by keeping the number_of_wizards counter up to date if mongone()
is called for the Wizard, handling both cases.  Also, don't let the
Wizard escape the dungeon unless he's one of two at the time, making
the first case no longer possible.

If wizard mode blessed genocide of "*" is used on the level where
the quest nemesis is present, the killed-the-nemesis feedback will
now be given.  I'm not completely convinced that this was the right
thing to do, but it only applies to wizard mode so may not matter.

Fixes #372
This commit is contained in:
PatR
2020-07-13 01:58:44 -07:00
parent 2980aaa4cb
commit 12498ffa44
3 changed files with 19 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.245 $ $NHDT-Date: 1594395803 2020/07/10 15:43:23 $
$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.246 $ $NHDT-Date: 1594630713 2020/07/13 08:58:33 $
General Fixes and Modified Features
-----------------------------------
@@ -217,6 +217,10 @@ the default engraving, epitaph, and bogus monster inserted by 'makedefs -s'
when the corresponding file wasn't actually empty its first line ended
up concatenated; default portion of the bad combined entry would be
decrypted properly but the portion from the file's first line wouldn't
if the Wizard of Yendor fled up the stairs on level 1, the game would behave
as if he was still in play, but he wouldn't be on migrating monsters
list so couldn't be brought back and wouldn't appear on Plane of Earth
(stale non-zero value for context.no_of_wizards)
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1593306909 2020/06/28 01:15:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.338 $ */
/* NetHack 3.6 mon.c $NHDT-Date: 1594630713 2020/07/13 08:58:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.339 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1988,9 +1988,14 @@ struct permonst *mptr; /* reflects mtmp->data _prior_ to mtmp's death */
/* to prevent an infinite relobj-flooreffects-hmon-killed loop */
mtmp->mtrapped = 0;
mtmp->mhp = 0; /* simplify some tests: force mhp to 0 */
if (mtmp->iswiz)
wizdead();
if (mtmp->data->msound == MS_NEMESIS)
nemdead();
if (mtmp->m_id == g.stealmid)
thiefdead();
relobj(mtmp, 0, FALSE);
if (onmap || mtmp == g.level.monsters[0][0]) {
if (mtmp->wormno)
remove_worm(mtmp);
@@ -2243,10 +2248,12 @@ register struct monst *mtmp;
break;
}
}
#if 0 /* moved to m_detach() to kick in if mongone() happens */
if (mtmp->iswiz)
wizdead();
if (mtmp->data->msound == MS_NEMESIS)
nemdead();
#endif
if (mtmp->data == &mons[PM_MEDUSA])
record_achievement(ACH_MEDU);
if (glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph))

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 muse.c $NHDT-Date: 1590870788 2020/05/30 20:33:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.127 $ */
/* NetHack 3.6 muse.c $NHDT-Date: 1594630714 2020/07/13 08:58:34 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.128 $ */
/* Copyright (C) 1990 by Ken Arromdee */
/* NetHack may be freely redistributed. See license for details. */
@@ -938,8 +938,12 @@ struct monst *mtmp;
* (mongone -> mdrop_special_objs) but we force any
* monster who manages to acquire it or the invocation
* tools to stick around instead of letting it escape.
* Don't let the Wizard escape even when not carrying
* anything of interest unless there are more than 1
* of him.
*/
if (mon_has_special(mtmp))
if (mon_has_special(mtmp)
|| (mtmp->iswiz && g.context.no_of_wizards < 2))
return 0;
if (vismon)
pline("%s escapes the dungeon!", Monnam(mtmp));