Skip to content

Commit

Permalink
fix #H184 - rndmonnum plan B
Browse files Browse the repository at this point in the history
     From a bug report, the fallback selection criteria
(used when everything is extinct?) in rndmonnum() was excluding hell-only
monsters when outside of Gehennom, but failed to exclude never-in-hell ones
when inside.  [Some of the never-in-hell monsters are Angels, but the rest
are all cold based creatures.  That must date to when fire resistance was
required for the hero, which is no longer the case.  Should those cold
monsters retain their never-in-hell setting?]

     This also fixes a latent copy/paste bug in the unused mons[] definition
of Cerberus (it was the only unique monster which failed to specify G_NOGEN).
  • Loading branch information
nethack.rankin committed Aug 24, 2006
1 parent d78f81a commit 422bfa6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions doc/fixes34.4
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ fix phrasing in monster against monster attack feedback when attacker is
don't place hero on top of monster when arriving on level which is so full
that the monster can't be moved out of the way
have to see a divine gift in order to have it become a discovery
honor the never-in-hell flag when selecting random monster type for corpses,
eggs, figurines, and statues created in Gehennom


Platform- and/or Interface-Specific Fixes
Expand Down
6 changes: 4 additions & 2 deletions src/mkobj.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mkobj.c 3.5 2006/07/08 */
/* SCCS Id: @(#)mkobj.c 3.5 2006/08/23 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */

Expand Down Expand Up @@ -308,16 +308,18 @@ rndmonnum() /* select a random, common monster type */
{
register struct permonst *ptr;
register int i;
unsigned short excludeflags;

/* Plan A: get a level-appropriate common monster */
ptr = rndmonst();
if (ptr) return(monsndx(ptr));

/* Plan B: get any common monster */
excludeflags = G_UNIQ | G_NOGEN | (Inhell ? G_NOHELL : G_HELL);
do {
i = rn1(SPECIAL_PM - LOW_PM, LOW_PM);
ptr = &mons[i];
} while((ptr->geno & G_NOGEN) || (!Inhell && (ptr->geno & G_HELL)));
} while ((ptr->geno & excludeflags) != 0);

return(i);
}
Expand Down
2 changes: 1 addition & 1 deletion src/monst.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ NEARDATA struct permonst mons[] = {
M3_INFRAVISIBLE, CLR_RED),
#ifdef CHARON
MON("Cerberus", S_DOG,
LVL(12, 10, 2, 20, -7), (G_HELL|G_UNIQ|1),
LVL(12, 10, 2, 20, -7), (G_NOGEN|G_UNIQ|G_HELL),
A(ATTK(AT_BITE, AD_PHYS, 3, 6), ATTK(AT_BITE, AD_PHYS, 3, 6),
ATTK(AT_BITE, AD_PHYS, 3, 6), NO_ATTK, NO_ATTK, NO_ATTK),
SIZ(1000, 350, MS_BARK, MZ_LARGE), MR_FIRE, MR_FIRE,
Expand Down

0 comments on commit 422bfa6

Please sign in to comment.