monster birth limits followup

This commit is contained in:
nethack.allison
2003-09-06 11:01:05 +00:00
parent 237a8fbce7
commit 9091855c66
3 changed files with 31 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)bones.c 3.4 2002/08/23 */ /* SCCS Id: @(#)bones.c 3.4 2003/09/06 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -433,8 +433,13 @@ getbones()
* set to the magic DEFUNCT_MONSTER cookie value. * set to the magic DEFUNCT_MONSTER cookie value.
*/ */
for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (mtmp->mhpmax == DEFUNCT_MONSTER) mongone(mtmp); if (mtmp->mhpmax == DEFUNCT_MONSTER) {
else #if defined(DEBUG) && defined(WIZARD)
pline("Removing defunct monster %s from bones.",
mtmp->data->mname);
#endif
mongone(mtmp);
} else
/* to correctly reset named artifacts on the level */ /* to correctly reset named artifacts on the level */
resetobjs(mtmp->minvent,TRUE); resetobjs(mtmp->minvent,TRUE);
} }

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)makemon.c 3.4 2003/05/25 */ /* SCCS Id: @(#)makemon.c 3.4 2003/09/06 */
/* 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. */
@@ -748,30 +748,32 @@ struct monst *mon;
* TRUE propagation successful * TRUE propagation successful
*/ */
boolean boolean
propagate(mndx, tally) propagate(mndx, tally, ghostly)
int mndx; int mndx;
boolean tally; boolean tally;
boolean ghostly;
{ {
boolean result;
uchar lim = mbirth_limit(mndx); uchar lim = mbirth_limit(mndx);
boolean not_gone_yet = (!(mons[mndx].geno & G_NOGEN) && boolean gone = (mvitals[mndx].mvflags & G_GONE); /* genocided or extinct */
!(mvitals[mndx].mvflags & G_EXTINCT));
if ((int) mvitals[mndx].born < lim && not_gone_yet) { result = (((int) mvitals[mndx].born < lim) && !gone) ? TRUE : FALSE;
if (tally) mvitals[mndx].born++;
/* if it's unique, or we've reached the limit /* if it's unique, don't ever make it again */
* don't ever make it again. if (mons[mndx].geno & G_UNIQ) mvitals[mndx].mvflags |= G_EXTINCT;
*/
if ((mvitals[mndx].born >= lim) || (mons[mndx].geno & G_UNIQ)) { if (mvitals[mndx].born < 255 && tally && (!ghostly || (ghostly && result)))
#if defined(WIZARD) && defined(DEBUG) mvitals[mndx].born++;
if (wizard) if ((int) mvitals[mndx].born >= lim && !(mons[mndx].geno & G_NOGEN) &&
pline("Automatically extinguished %s.", !(mvitals[mndx].mvflags & G_EXTINCT)) {
#if defined(DEBUG) && defined(WIZARD)
if (wizard) pline("Automatically extinguished %s.",
makeplural(mons[mndx].mname)); makeplural(mons[mndx].mname));
#endif #endif
mvitals[mndx].mvflags |= G_EXTINCT; mvitals[mndx].mvflags |= G_EXTINCT;
reset_rndmonst(mndx); reset_rndmonst(mndx);
}
return TRUE;
} }
return FALSE; return result;
} }
/* /*
@@ -858,7 +860,7 @@ register int mmflags;
} while(!goodpos(x, y, &fakemon, gpflags) && tryct++ < 50); } while(!goodpos(x, y, &fakemon, gpflags) && tryct++ < 50);
mndx = monsndx(ptr); mndx = monsndx(ptr);
} }
propagate(mndx, countbirth); (void) propagate(mndx, countbirth, FALSE);
xlth = ptr->pxlth; xlth = ptr->pxlth;
if (mmflags & MM_EDOG) xlth += sizeof(struct edog); if (mmflags & MM_EDOG) xlth += sizeof(struct edog);
else if (mmflags & MM_EMIN) xlth += sizeof(struct emin); else if (mmflags & MM_EMIN) xlth += sizeof(struct emin);

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)restore.c 3.4 2002/08/21 */ /* SCCS Id: @(#)restore.c 3.4 2003/09/06 */
/* 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. */
@@ -268,7 +268,7 @@ boolean ghostly;
mtmp->data = &mons[offset]; mtmp->data = &mons[offset];
if (ghostly) { if (ghostly) {
int mndx = monsndx(mtmp->data); int mndx = monsndx(mtmp->data);
if (propagate(mndx, TRUE) == 0) { if (propagate(mndx, TRUE, ghostly) == 0) {
/* cookie to trigger purge in getbones() */ /* cookie to trigger purge in getbones() */
mtmp->mhpmax = DEFUNCT_MONSTER; mtmp->mhpmax = DEFUNCT_MONSTER;
} }