From 4151ab500f21e7635985e37a4ddf5380190a5eeb Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sun, 24 Apr 2011 02:53:52 +0000 Subject: [PATCH] fix #H2259 - rising from dead message gives away info (trunk only) From a bug report, receiving the message "Your body rises from the dead as an ..." 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. --- doc/fixes35.0 | 2 ++ src/bones.c | 18 ++++++++++-------- src/end.c | 32 +++++++++++++++++++++----------- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 78ee47d55..c91ce80d9 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 ..." + even when bones data isn't being saved Platform- and/or Interface-Specific Fixes diff --git a/src/bones.c b/src/bones.c index 765604377..f4c5fb39f 100644 --- a/src/bones.c +++ b/src/bones.c @@ -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 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 ..." 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); } diff --git a/src/end.c b/src/end.c index fd24aff29..4ee934fbe 100644 --- a/src/end.c +++ b/src/end.c @@ -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; @@ -912,16 +914,16 @@ die: 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) { @@ -940,7 +942,6 @@ die: 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) */ @@ -1006,6 +1007,15 @@ die: } } + 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') -- 2.50.1