fix #K3907 - reviving buried corpse

Burying an olog-hai corpse with a boulder resulted in a panic when
its time to revive occurred.  I was able to reproduce this once but
failed with "you feel less hassled" several times (using same save
file for multiple tests) so I'm not quite sure what was happening.

A buried corpse was allowed to revive if it was for a zombie.  This
fix extends that to auto-revivers (trolls and Riders).  The corpse
keeps its revive_mon timer rather than changing that to zombify_mon.

If/when revival of a buried troll or Rider happens while in view, it
will "claw itself out of the ground" like zombies do.
This commit is contained in:
PatR
2023-05-02 18:02:02 -07:00
parent 7a18387ff2
commit 654b7d41b2
3 changed files with 17 additions and 4 deletions
+3 -1
View File
@@ -1552,6 +1552,8 @@ anti-magic field's reduction of hero's maximum energy could result in current
if hero was killed by a wand zapped by a monster, cause of death was reported if hero was killed by a wand zapped by a monster, cause of death was reported
as "killed by a bolt of <damage type> imagined by <monster>" as "killed by a bolt of <damage type> imagined by <monster>"
throttle the difficulty of the monsters in theme room "buried zombies" throttle the difficulty of the monsters in theme room "buried zombies"
buried troll whose auto-revive timer expired might triger panic with
"revive default case 6"
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository
@@ -1790,7 +1792,7 @@ Qt: use idPressed signal instead of buttonPressed and mappedString instead
of mapped for recent Qt (pr #913 by chasonr) of mapped for recent Qt (pr #913 by chasonr)
Qt+macOS: fix control key (fixed all except for ^V); handle ^V as a shortcut Qt+macOS: fix control key (fixed all except for ^V); handle ^V as a shortcut
Qt+macOS: rename menu entry "nethack->Preferences..." for invoking nethack's Qt+macOS: rename menu entry "nethack->Preferences..." for invoking nethack's
key 'O' command to "Game->Run-time options" and entry "Game->Qt settings" 'O' command to "Game->Run-time options" and entry "Game->Qt settings"
for making persistent Qt customizations to "nethack->Preferences..." for making persistent Qt customizations to "nethack->Preferences..."
Qt+macOS: prevent game->Quit-without-saving from being hijacked for the nethack Qt+macOS: prevent game->Quit-without-saving from being hijacked for the nethack
menu by renaming it game->_Quit-without-saving (macOS only) menu by renaming it game->_Quit-without-saving (macOS only)
+7 -1
View File
@@ -2002,10 +2002,16 @@ revive_corpse(struct obj *corpse)
char cname[BUFSZ]; char cname[BUFSZ];
struct obj *container = (struct obj *) 0; struct obj *container = (struct obj *) 0;
int container_where = 0; int container_where = 0;
boolean is_zomb = (mons[corpse->corpsenm].mlet == S_ZOMBIE); int montype;
boolean is_zomb;
coordxy corpsex, corpsey; coordxy corpsex, corpsey;
where = corpse->where; where = corpse->where;
montype = corpse->corpsenm;
/* treat buried auto-reviver (troll, Rider?) like a zombie
so that it can dig itself out of the ground if it revives */
is_zomb = (mons[montype].mlet == S_ZOMBIE
|| (where == OBJ_BURIED && is_reviver(&mons[montype])));
is_uwep = (corpse == uwep); is_uwep = (corpse == uwep);
chewed = (corpse->oeaten != 0); chewed = (corpse->oeaten != 0);
Strcpy(cname, corpse_xname(corpse, Strcpy(cname, corpse_xname(corpse,
+7 -2
View File
@@ -839,12 +839,18 @@ revive(struct obj *corpse, boolean by_hero)
boolean one_of; boolean one_of;
mmflags_nht mmflags = NO_MINVENT | MM_NOWAIT | MM_NOMSG; mmflags_nht mmflags = NO_MINVENT | MM_NOWAIT | MM_NOMSG;
int montype, cgend, container_nesting = 0; int montype, cgend, container_nesting = 0;
boolean is_zomb = (mons[corpse->corpsenm].mlet == S_ZOMBIE); boolean is_zomb;
if (corpse->otyp != CORPSE) { if (corpse->otyp != CORPSE) {
impossible("Attempting to revive %s?", xname(corpse)); impossible("Attempting to revive %s?", xname(corpse));
return (struct monst *) 0; return (struct monst *) 0;
} }
montype = corpse->corpsenm;
/* treat buried auto-reviver (troll, Rider?) like a zombie
so that it can dig itself out of the ground if it revives */
is_zomb = mons[montype].mlet == S_ZOMBIE
|| (corpse->where == OBJ_BURIED && is_reviver(&mons[montype]));
/* if this corpse is being eaten, stop doing that; this should be done /* if this corpse is being eaten, stop doing that; this should be done
after makemon() succeeds and skipped if it fails, but waiting until after makemon() succeeds and skipped if it fails, but waiting until
we know the result for that would be too late */ we know the result for that would be too late */
@@ -897,7 +903,6 @@ revive(struct obj *corpse, boolean by_hero)
return (struct monst *) 0; return (struct monst *) 0;
/* prepare for the monster */ /* prepare for the monster */
montype = corpse->corpsenm;
mptr = &mons[montype]; mptr = &mons[montype];
/* [should probably handle recorporealization first; if corpse and /* [should probably handle recorporealization first; if corpse and
ghost are at same location, revived creature shouldn't be bumped ghost are at same location, revived creature shouldn't be bumped