]> granicus.if.org Git - nethack/commitdiff
djinn/ghosts from potions
authornethack.allison <nethack.allison>
Sat, 5 Jun 2004 18:10:04 +0000 (18:10 +0000)
committernethack.allison <nethack.allison>
Sat, 5 Jun 2004 18:10:04 +0000 (18:10 +0000)
<Someone> 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
include/patchlevel.h
src/makemon.c
src/muse.c
src/potion.c

index d4d4d7153e03f2a245cd06409ce73b081b23a2a5..74fcec34500f23f85a2ef77a8cef74eca2e9be8f 100644 (file)
@@ -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;
index 5eb92c4cb69be385c48acd789acb063bc2f7c0ed..15abc3f0019b87be86f3bb855396c09e48308afb 100644 (file)
@@ -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"
index 5c616e8e1e8da7e93685d627dc38ded54615c942..cfacb34eaf41091b5ce6790e8e6a6c49cd70bf2d 100644 (file)
@@ -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) {
index ee39e5402456b7c7783d5d2b24fe1d87a0924cd9..613c5e945fedf4d80a2536ddaad9c334dc83a91b 100644 (file)
@@ -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);
index 55b38985a877246849e300c3bc6e3780d2c39d89..668e47dece2a4bd0bdbd248890fd2a021d3cce32 100644 (file)
@@ -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);