]> granicus.if.org Git - nethack/commitdiff
fix #H2259 - rising from dead message gives away info (trunk only)
authornethack.rankin <nethack.rankin>
Sun, 24 Apr 2011 02:53:52 +0000 (02:53 +0000)
committernethack.rankin <nethack.rankin>
Sun, 24 Apr 2011 02:53:52 +0000 (02:53 +0000)
     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.

doc/fixes35.0
src/bones.c
src/end.c

index 78ee47d55f8ce880ce520361c895e5d289b58a7c..c91ce80d9ee7fc20de0e614ca22ceafcba3f5064 100644 (file)
@@ -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
index 765604377d52f19edcbcd596c3651328edd90240..f4c5fb39fbced9bd84d9118ca682ed319e08e5d4 100644 (file)
@@ -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);
        }
index fd24aff29023c62294e9143355f31bc7d861c8eb..4ee934fbecc2c81f156c277eeb1aa9f61a772cd7 100644 (file)
--- 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')