fix B13006 - Unchanging-poly self-genocide

<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.
This commit is contained in:
nethack.rankin
2002-10-05 08:24:12 +00:00
parent 1c0516ce1e
commit bfd4af4388
2 changed files with 27 additions and 12 deletions
+4
View File
@@ -266,6 +266,10 @@ removing a ring might relearn what it is after amnesia
sleeping shopkeeper shouldn't talk to digging player sleeping shopkeeper shouldn't talk to digging player
give more specific feedback when dipping unicorn horns into potions give more specific feedback when dipping unicorn horns into potions
can see self via infravision or ESP or monster detection when invisible 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 Platform- and/or Interface-Specific Fixes
+23 -12
View 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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1405,7 +1405,7 @@ do_it:
static void static void
do_class_genocide() do_class_genocide()
{ {
register int i, j, immunecnt, gonecnt, goodcnt, class; int i, j, immunecnt, gonecnt, goodcnt, class, feel_dead = 0;
char buf[BUFSZ]; char buf[BUFSZ];
boolean gameover = FALSE; /* true iff killed self */ boolean gameover = FALSE; /* true iff killed self */
@@ -1496,19 +1496,26 @@ do_class_genocide()
update_inventory(); /* eggs & tins */ update_inventory(); /* eggs & tins */
pline("Wiped out all %s.", nam); pline("Wiped out all %s.", nam);
if (Upolyd && i == u.umonnum) { if (Upolyd && i == u.umonnum) {
if (Unchanging) done(GENOCIDED); u.mh = -1;
rehumanize(); 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 */ /* Self-genocide if it matches either your race
/* Assumption: male and female forms share the same letter */ or role. Assumption: male and female forms
share same monster class. */
if (i == urole.malenum || i == urace.malenum) { if (i == urole.malenum || i == urace.malenum) {
u.uhp = -1; u.uhp = -1;
killer_format = KILLED_BY_AN; if (Upolyd) {
killer = "scroll of genocide"; if (!feel_dead++) You_feel("dead inside.");
if (Upolyd) } else {
You_feel("dead inside."); if (!feel_dead++) You("die.");
else
gameover = TRUE; gameover = TRUE;
}
} }
} else if (mvitals[i].mvflags & G_GENOD) { } else if (mvitals[i].mvflags & G_GENOD) {
if (!gameover) 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; return;
} }
} }