From 9840d7611bfc6c8e2c961663799e9f70dc4da20b Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Sat, 5 Jun 2004 18:10:04 +0000 Subject: [PATCH] djinn/ghosts from potions wrote: >It seems silly to have two flags being used for counting djinn and >ghosts, now that there's mvitals.born... This does not break save and bones compatibility in the 3.4.x branch, it changes the code, but leaves the obsolete fields in flags. --- include/context.h | 1 - include/patchlevel.h | 2 +- src/makemon.c | 8 ++------ src/muse.c | 8 ++++---- src/potion.c | 8 ++++---- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/include/context.h b/include/context.h index d4d4d7153..74fcec345 100644 --- a/include/context.h +++ b/include/context.h @@ -80,7 +80,6 @@ struct context_info { /* 8: travel */ unsigned startingpet_mid; int warnlevel; - int djinni_count, ghost_count; /* potion effect tuning */ long next_attrib_check; /* next attribute check */ long stethoscope_move; short stethoscope_movement; diff --git a/include/patchlevel.h b/include/patchlevel.h index 5eb92c4cb..15abc3f00 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -13,7 +13,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 11 +#define EDITLEVEL 12 #define COPYRIGHT_BANNER_A \ "NetHack, Copyright 1985-2004" diff --git a/src/makemon.c b/src/makemon.c index 5c616e8e1..cfacb34ea 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1019,12 +1019,8 @@ register int mmflags; context.no_of_wizards++; if (context.no_of_wizards == 1 && Is_earthlevel(&u.uz)) mitem = SPE_DIG; - } else if (mndx == PM_DJINNI) { - context.djinni_count++; - } else if (mndx == PM_GHOST) { - context.ghost_count++; - if (!(mmflags & MM_NONAME)) - mtmp = christen_monst(mtmp, rndghostname()); + } else if (mndx == PM_GHOST && !(mmflags & MM_NONAME)) { + mtmp = christen_monst(mtmp, rndghostname()); } else if (mndx == PM_VLAD_THE_IMPALER) { mitem = CANDELABRUM_OF_INVOCATION; } else if (mndx == PM_CROESUS) { diff --git a/src/muse.c b/src/muse.c index ee39e5402..613c5e945 100644 --- a/src/muse.c +++ b/src/muse.c @@ -72,8 +72,8 @@ struct obj *obj; potion_descr = OBJ_DESCR(objects[obj->otyp]); if (potion_descr && !strcmp(potion_descr, "milky")) { - if ( context.ghost_count < MAXMONNO && - !rn2(POTION_OCCUPANT_CHANCE(context.ghost_count))) { + if (!(mvitals[PM_GHOST].mvflags & G_GONE) && + !rn2(POTION_OCCUPANT_CHANCE(mvitals[PM_GHOST].born))) { if (!enexto(&cc, mon->mx, mon->my, &mons[PM_GHOST])) return 0; mquaffmsg(mon, obj); m_useup(mon, obj); @@ -95,8 +95,8 @@ struct obj *obj; } } if (potion_descr && !strcmp(potion_descr, "smoky") && - context.djinni_count < MAXMONNO && - !rn2(POTION_OCCUPANT_CHANCE(context.djinni_count))) { + !(mvitals[PM_DJINNI].mvflags & G_GONE) && + !rn2(POTION_OCCUPANT_CHANCE(mvitals[PM_DJINNI].born))) { if (!enexto(&cc, mon->mx, mon->my, &mons[PM_DJINNI])) return 0; mquaffmsg(mon, obj); m_useup(mon, obj); diff --git a/src/potion.c b/src/potion.c index 55b38985a..668e47dec 100644 --- a/src/potion.c +++ b/src/potion.c @@ -375,14 +375,14 @@ dodrink() potion_descr = OBJ_DESCR(objects[otmp->otyp]); if (potion_descr) { if (!strcmp(potion_descr, "milky") && - context.ghost_count < MAXMONNO && - !rn2(POTION_OCCUPANT_CHANCE(context.ghost_count))) { + !(mvitals[PM_GHOST].mvflags & G_GONE) && + !rn2(POTION_OCCUPANT_CHANCE(mvitals[PM_GHOST].born))) { ghost_from_bottle(); useup(otmp); return(1); } else if (!strcmp(potion_descr, "smoky") && - context.djinni_count < MAXMONNO && - !rn2(POTION_OCCUPANT_CHANCE(context.djinni_count))) { + !(mvitals[PM_DJINNI].mvflags & G_GONE) && + !rn2(POTION_OCCUPANT_CHANCE(mvitals[PM_DJINNI].born))) { djinni_from_bottle(otmp); useup(otmp); return(1); -- 2.50.1