Skip to content

Commit

Permalink
fix #H2259 - rising from dead message gives away info (trunk only)
Browse files Browse the repository at this point in the history
     From a bug report, receiving the
message "Your body rises from the dead as an <undead>..." gives away
the fact that bones are being created (and its absence when applicable
undead kills the hero gives away the fact that bones aren't being
created).  Not very interesting for single player installations where
5-10 seconds later the player is going to check the playground for new
files, but matters on multi-user installations where players don't have
access to the directory and sometimes race each other to juicy bones,
such as nethack.alt.org.

     At the end of disclosure, give the message whether bones are being
saved or not (for cases where it would have happened when bones are
created).  Player won't know whether new bones are becoming available.
Also, prevent risen undead-from-hero from being given random monster
inventory, but explicitly give mummy-from-hero a mummy wrapping if the
hero isn't already carrying one.  It will end up being worn; that's
the only armor mummies are allowed to put on.
  • Loading branch information
nethack.rankin committed Apr 24, 2011
1 parent 72b4010 commit 4151ab5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
2 changes: 2 additions & 0 deletions doc/fixes35.0
Expand Up @@ -362,6 +362,8 @@ dying in lava and being life-saved or leaving bones would destroy ring of
scrolls of fire and spellbook of fireball
surviving in lava boils away carried potions, but dying in lava and being
life-saved or leaving bones would keep them intact
when applicable, give "your body rises from the dead as an <undead>..."
even when bones data isn't being saved


Platform- and/or Interface-Specific Fixes
Expand Down
18 changes: 10 additions & 8 deletions src/bones.c
Expand Up @@ -354,22 +354,24 @@ struct obj *corpse;
(void) obj_attach_mid(corpse, mtmp->m_id);
} else {
/* give your possessions to the monster you become */
in_mklev = TRUE;
mtmp = makemon(&mons[u.ugrave_arise], u.ux, u.uy, NO_MM_FLAGS);
in_mklev = TRUE; /* use <u.ux,u.uy> as-is */
mtmp = makemon(&mons[u.ugrave_arise], u.ux, u.uy, NO_MINVENT);
in_mklev = FALSE;
if (!mtmp) {
drop_upon_death((struct monst *)0, (struct obj *)0,
u.ux, u.uy);
u.ugrave_arise = NON_PM; /* in case caller cares */
return;
}
/* give mummy-from-hero a wrapping unless hero already
carries one; don't bother forcing it to become worn */
if (mtmp->data->mlet == S_MUMMY && !carrying(MUMMY_WRAPPING))
(void)mongets(mtmp, MUMMY_WRAPPING);
mtmp = christen_monst(mtmp, plname);
newsym(u.ux, u.uy);
/* turning into slime isn't rising from the dead
and has already given its own message */
if (u.ugrave_arise != PM_GREEN_SLIME)
Your("body rises from the dead as %s...",
an(mons[u.ugrave_arise].mname));
display_nhwindow(WIN_MESSAGE, FALSE);
/* ["Your body rises from the dead as an <mname>..." used
to be given here, but it has been moved to done() so that
it gets delivered even when savebones() isn't called] */
drop_upon_death(mtmp, (struct obj *)0, u.ux, u.uy);
m_dowear(mtmp, TRUE);
}
Expand Down
32 changes: 21 additions & 11 deletions src/end.c
Expand Up @@ -462,6 +462,8 @@ int how;
u.ugrave_arise = PM_VAMPIRE;
else if (mptr == &mons[PM_GHOUL])
u.ugrave_arise = PM_GHOUL;
/* this could happen if a high-end vampire kills the hero
when ordinary vampires are genocided; ditto for wraiths */
if (u.ugrave_arise >= LOW_PM &&
(mvitals[u.ugrave_arise].mvflags & G_GENOD))
u.ugrave_arise = NON_PM;
Expand Down Expand Up @@ -912,16 +914,16 @@ int how;

if (bones_ok && launch_in_progress()) force_launch_placement();

if (bones_ok && u.ugrave_arise < LOW_PM) {
/* corpse gets burnt up too */
if (how == BURNING || how == DISSOLVED)
u.ugrave_arise = (NON_PM - 2); /* leave no corpse */
else if (how == STONING)
u.ugrave_arise = (NON_PM - 1); /* statue instead of corpse */
else if (how == TURNED_SLIME)
u.ugrave_arise = PM_GREEN_SLIME;
else if (u.ugrave_arise == NON_PM &&
!(mvitals[u.umonnum].mvflags & G_NOCORPSE)) {
/* maintain ugrave_arise even for !bones_ok */
if (how == BURNING || how == DISSOLVED) /* corpse gets burnt up too */
u.ugrave_arise = (NON_PM - 2); /* leave no corpse */
else if (how == STONING)
u.ugrave_arise = (NON_PM - 1); /* statue instead of corpse */
else if (how == TURNED_SLIME)
u.ugrave_arise = PM_GREEN_SLIME;

if (bones_ok && u.ugrave_arise == NON_PM &&
!(mvitals[u.umonnum].mvflags & G_NOCORPSE)) {
int mnum = u.umonnum;

if (!Upolyd) {
Expand All @@ -940,7 +942,6 @@ int how;
killer.format == KILLED_BY_AN ? an(killer.name) :
killer.name);
make_grave(u.ux, u.uy, pbuf);
}
}
/* if pets will contribute to score, populate mydogs list now
(bones creation isn't a factor, but pline() messaging is) */
Expand Down Expand Up @@ -1006,6 +1007,15 @@ int how;
}
}

if (u.ugrave_arise >= LOW_PM && u.ugrave_arise != PM_GREEN_SLIME) {
/* give this feedback even if bones aren't going to be created,
so that its presence or absence doesn't tip off the player to
new bones or their lack; it might be a lie if makemon fails */
Your("body rises from the dead as %s...",
an(mons[u.ugrave_arise].mname));
display_nhwindow(WIN_MESSAGE, FALSE);
}

if (bones_ok) {
#ifdef WIZARD
if (!wizard || yn("Save bones?") == 'y')
Expand Down

0 comments on commit 4151ab5

Please sign in to comment.