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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -433,8 +433,13 @@ getbones()
* set to the magic DEFUNCT_MONSTER cookie value.
*/
for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (mtmp->mhpmax == DEFUNCT_MONSTER) mongone(mtmp);
else
if (mtmp->mhpmax == DEFUNCT_MONSTER) {
#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 */
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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -748,30 +748,32 @@ struct monst *mon;
* TRUE propagation successful
*/
boolean
propagate(mndx, tally)
propagate(mndx, tally, ghostly)
int mndx;
boolean tally;
boolean ghostly;
{
boolean result;
uchar lim = mbirth_limit(mndx);
boolean not_gone_yet = (!(mons[mndx].geno & G_NOGEN) &&
!(mvitals[mndx].mvflags & G_EXTINCT));
if ((int) mvitals[mndx].born < lim && not_gone_yet) {
if (tally) mvitals[mndx].born++;
/* if it's unique, or we've reached the limit
* don't ever make it again.
*/
if ((mvitals[mndx].born >= lim) || (mons[mndx].geno & G_UNIQ)) {
#if defined(WIZARD) && defined(DEBUG)
if (wizard)
pline("Automatically extinguished %s.",
boolean gone = (mvitals[mndx].mvflags & G_GONE); /* genocided or extinct */
result = (((int) mvitals[mndx].born < lim) && !gone) ? TRUE : FALSE;
/* if it's unique, don't ever make it again */
if (mons[mndx].geno & G_UNIQ) mvitals[mndx].mvflags |= G_EXTINCT;
if (mvitals[mndx].born < 255 && tally && (!ghostly || (ghostly && result)))
mvitals[mndx].born++;
if ((int) mvitals[mndx].born >= lim && !(mons[mndx].geno & G_NOGEN) &&
!(mvitals[mndx].mvflags & G_EXTINCT)) {
#if defined(DEBUG) && defined(WIZARD)
if (wizard) pline("Automatically extinguished %s.",
makeplural(mons[mndx].mname));
#endif
mvitals[mndx].mvflags |= G_EXTINCT;
reset_rndmonst(mndx);
}
return TRUE;
mvitals[mndx].mvflags |= G_EXTINCT;
reset_rndmonst(mndx);
}
return FALSE;
return result;
}
/*
@@ -858,7 +860,7 @@ register int mmflags;
} while(!goodpos(x, y, &fakemon, gpflags) && tryct++ < 50);
mndx = monsndx(ptr);
}
propagate(mndx, countbirth);
(void) propagate(mndx, countbirth, FALSE);
xlth = ptr->pxlth;
if (mmflags & MM_EDOG) xlth += sizeof(struct edog);
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. */
/* NetHack may be freely redistributed. See license for details. */
@@ -268,7 +268,7 @@ boolean ghostly;
mtmp->data = &mons[offset];
if (ghostly) {
int mndx = monsndx(mtmp->data);
if (propagate(mndx, TRUE) == 0) {
if (propagate(mndx, TRUE, ghostly) == 0) {
/* cookie to trigger purge in getbones() */
mtmp->mhpmax = DEFUNCT_MONSTER;
}