]> granicus.if.org Git - nethack/commitdiff
fix B13006 - Unchanging-poly self-genocide
authornethack.rankin <nethack.rankin>
Sat, 5 Oct 2002 08:24:12 +0000 (08:24 +0000)
committernethack.rankin <nethack.rankin>
Sat, 5 Oct 2002 08:24:12 +0000 (08:24 +0000)
     <Someone> reported that killing yourself by picking your current
monster class as the target of a blessed scroll of genocide while
polymorphed and wearing an amulet of unchanging would result in
"killed by genocide" rather than "killed by a scroll of genocide".
That wasn't the only problem here; it also ended the game right away,
before genociding the rest of the class of monsters; that could affect
the contents of a resulting bones level.

     Also, the 3.3.0 race/class split resulted in getting the message
"you feel dead inside" twice if you were a human or elf character who
genocides '@' while polymorphed into some non-@ form.

doc/fixes34.1
src/read.c

index 055724da044782f59f1ce6fb360ceaafc15a6a51..90f45c2b55f030ad9af7e0e8ffb86abde3f12abe 100644 (file)
@@ -266,6 +266,10 @@ removing a ring might relearn what it is after amnesia
 sleeping shopkeeper shouldn't talk to digging player
 give more specific feedback when dipping unicorn horns into potions
 can see self via infravision or ESP or monster detection when invisible
+class genocide that killed polymorphed self while `Unchanging' reported
+       incomplete cause of death and possibly left rest of class in bones
+class genocide of @ by human or elf character polymorphed into non-@ gave
+       "you feel dead inside" message twice
 
 
 Platform- and/or Interface-Specific Fixes
index c80d7dadae85a6e40bc7fdbaac041b0c0a645452..67954ad878373cdc03e1af76c3ab023cf85e8675 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)read.c     3.4     2002/03/22      */
+/*     SCCS Id: @(#)read.c     3.4     2002/10/04      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1405,7 +1405,7 @@ do_it:
 static void
 do_class_genocide()
 {
-       register int i, j, immunecnt, gonecnt, goodcnt, class;
+       int i, j, immunecnt, gonecnt, goodcnt, class, feel_dead = 0;
        char buf[BUFSZ];
        boolean gameover = FALSE;       /* true iff killed self */
 
@@ -1496,19 +1496,26 @@ do_class_genocide()
                            update_inventory();         /* eggs & tins */
                            pline("Wiped out all %s.", nam);
                            if (Upolyd && i == u.umonnum) {
-                               if (Unchanging) done(GENOCIDED);
-                               rehumanize();
+                               u.mh = -1;
+                               if (Unchanging) {
+                                   if (!feel_dead++) You("die.");
+                                   /* finish genociding this class of
+                                      monsters before ultimately dying */
+                                   gameover = TRUE;
+                               } else
+                                   rehumanize();
                            }
-                           /* Self-genocide if it matches either your race or role */
-                           /* Assumption: male and female forms share the same letter */
+                           /* Self-genocide if it matches either your race
+                              or role.  Assumption:  male and female forms
+                              share same monster class. */
                            if (i == urole.malenum || i == urace.malenum) {
                                u.uhp = -1;
-                               killer_format = KILLED_BY_AN;
-                               killer = "scroll of genocide";
-                               if (Upolyd)
-                                   You_feel("dead inside.");
-                               else
+                               if (Upolyd) {
+                                   if (!feel_dead++) You_feel("dead inside.");
+                               } else {
+                                   if (!feel_dead++) You("die.");
                                    gameover = TRUE;
+                               }
                            }
                        } else if (mvitals[i].mvflags & G_GENOD) {
                            if (!gameover)
@@ -1539,7 +1546,11 @@ do_class_genocide()
                        }
                    }
                }
-               if (gameover) done(GENOCIDED);
+               if (gameover || u.uhp == -1) {
+                   killer_format = KILLED_BY_AN;
+                   killer = "scroll of genocide";
+                   if (gameover) done(GENOCIDED);
+               }
                return;
        }
 }