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

View 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

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. */
/* 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;
}
}