]> granicus.if.org Git - nethack/commitdiff
fix #H1755 - feedback for clerical summoning when blind (trunk only)
authornethack.rankin <nethack.rankin>
Sat, 15 Nov 2008 20:38:02 +0000 (20:38 +0000)
committernethack.rankin <nethack.rankin>
Sat, 15 Nov 2008 20:38:02 +0000 (20:38 +0000)
     From a bug report, the feedback
you get when a monster summons insects or snakes is the same when blind
as when you can see.  A comment in the code stated as much, but fixing
it is relatively straightforward.  (Or not; there are actually a lot of
cases to be handled; this covers enough of them, I hope.)

doc/fixes35.0
include/extern.h
src/mcastu.c
src/minion.c
src/wizard.c

index 44edbacbe7e631dc74600709b1fad9d0ab8b46d3..0ebe06601bc2dc03013829d3b9ae5cd26e2dd72e 100644 (file)
@@ -295,6 +295,7 @@ monsters who ate green slime corpses weren't turned into green slime
 "hand slip" while naming an object would never pick 'z' as a substitute letter
 hero would "gladly take off <armor>" for nymph or succubus even while asleep
 concealed mimic wasn't revealed if kicking attmpt yielded a clumsy miss
+too accurate feedback given to a blinded hero when a monster summons insects
 
 
 Platform- and/or Interface-Specific Fixes
index 190a3308fd75cc2580d9b935f7ff155344de81c4..6d525b2c3dbf02c3eff08fffa46bfd6c37743185 100644 (file)
@@ -1126,7 +1126,7 @@ E int FDECL(doseduce, (struct monst *));
 
 E void FDECL(newemin, (struct monst *));
 E void FDECL(free_emin, (struct monst *));
-E int NDECL(monster_census);
+E int FDECL(monster_census, (BOOLEAN_P));
 E int FDECL(msummon, (struct monst *));
 E void FDECL(summon_minion, (ALIGNTYP_P,BOOLEAN_P));
 E int FDECL(demon_talk, (struct monst *));
index 022c7697770af0c813d6ef107ab7ffd096d48708..59be55f0c3e8f8cc044aae64053fd5fe717e3e2c 100644 (file)
@@ -537,46 +537,66 @@ int spellnum;
        struct permonst *pm = mkclass(S_ANT,0);
        struct monst *mtmp2 = (struct monst *)0;
        char let = (pm ? S_ANT : S_SNAKE);
-       boolean success;
-       int i;
+       boolean success = FALSE, seecaster;
+       int i, quan, oldseen, newseen;
        coord bypos;
-       int quan;
+       const char *fmt;
 
+       oldseen = monster_census(TRUE);
        quan = (mtmp->m_lev < 2) ? 1 : rnd((int)mtmp->m_lev / 2);
        if (quan < 3) quan = 3;
-       success = pm ? TRUE : FALSE;
        for (i = 0; i <= quan; i++) {
            if (!enexto(&bypos, mtmp->mux, mtmp->muy, mtmp->data))
                break;
            if ((pm = mkclass(let,0)) != 0 &&
-                   (mtmp2 = makemon(pm, bypos.x, bypos.y, NO_MM_FLAGS)) != 0) {
+                   (mtmp2 = makemon(pm, bypos.x, bypos.y, MM_ANGRY)) != 0) {
                success = TRUE;
                mtmp2->msleeping = mtmp2->mpeaceful = mtmp2->mtame = 0;
                set_malign(mtmp2);
            }
        }
-       /* Not quite right:
-         * -- message doesn't always make sense for unseen caster (particularly
-        *    the first message)
-         * -- message assumes plural monsters summoned (non-plural should be
-         *    very rare, unlike in nasty())
-         * -- message assumes plural monsters seen
-         */
-       if (!success)
-           pline("%s casts at a clump of sticks, but nothing happens.",
-               Monnam(mtmp));
+       newseen = monster_census(TRUE);
+
+       /* not canspotmon(), which includes unseen things sensed via warning */
+       seecaster = canseemon(mtmp) || tp_sensemon(mtmp) || Detect_monsters;
+
+       fmt = 0;
+       if (!seecaster) {
+           char *arg;  /* [not const: upstart(N==1 ? an() : makeplural())] */
+           const char *what = (let == S_SNAKE) ? "snake" : "insect";
+
+           if (newseen <= oldseen || Unaware) {
+               /* unseen caster fails or summons unseen critters,
+                  or unconscious hero ("You dream that you hear...") */
+               You_hear("someone summoning %s.", makeplural(what));
+           } else {
+               /* unseen caster summoned seen critter(s) */
+               arg = (newseen == oldseen + 1) ? an(what) : makeplural(what);
+               if (!Deaf)
+                   You_hear("someone summoning something, and %s %s.",
+                            arg, vtense(arg, "appear"));
+               else
+                   pline("%s %s.", upstart(arg), vtense(arg, "appear"));
+           }
+
+       /* seen caster, possibly producing unseen--or just one--critters;
+          hero is told what the caster is doing and doesn't necessarily
+          observe complete accuracy of that caster's results (in other
+          words, no need to fuss with visibility or singularization;
+          player is told what's happening even if hero is unconscious) */
+       } else if (!success)
+           fmt = "%s casts at a clump of sticks, but nothing happens.";
        else if (let == S_SNAKE)
-           pline("%s transforms a clump of sticks into snakes!",
-               Monnam(mtmp));
+           fmt = "%s transforms a clump of sticks into snakes!";
        else if (Invisible && !perceives(mtmp->data) &&
                                (mtmp->mux != u.ux || mtmp->muy != u.uy))
-           pline("%s summons insects around a spot near you!",
-               Monnam(mtmp));
+           fmt = "%s summons insects around a spot near you!";
        else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
-           pline("%s summons insects around your displaced image!",
-               Monnam(mtmp));
+           fmt = "%s summons insects around your displaced image!";
        else
-           pline("%s summons insects!", Monnam(mtmp));
+           fmt = "%s summons insects!";
+       if (fmt) pline(fmt, Monnam(mtmp));
+
        dmg = 0;
        break;
       }
index c56f8d3b1c481b9ed88be5f67142e1c9d7b8d6c6..e320cd048e9e243f23cc487479f529432b1c2f36 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)minion.c   3.5     2007/04/15      */
+/*     SCCS Id: @(#)minion.c   3.5     2008/11/14      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -28,13 +28,15 @@ struct monst *mtmp;
 
 /* count the number of monsters on the level */
 int
-monster_census()
+monster_census(spotted)
+boolean spotted;       /* seen|sensed vs all */
 {
     struct monst *mtmp;
     int count = 0;
 
     for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
        if (DEADMONSTER(mtmp)) continue;
+       if (spotted && !canspotmon(mtmp)) continue;
        ++count;
     }
     return count;
@@ -108,7 +110,7 @@ struct monst *mon;
 
        /* some candidates can generate a group of monsters, so simple
           count of non-null makemon() result is not sufficient */
-       census = monster_census();
+       census = monster_census(FALSE);
 
        while (cnt > 0) {
            mtmp = makemon(&mons[dtype], u.ux, u.uy, MM_EMIN);
@@ -128,7 +130,7 @@ struct monst *mon;
        }
 
        /* how many monsters exist now compared to before? */
-       if (result) result = monster_census() - census;
+       if (result) result = monster_census(FALSE) - census;
 
        return result;
 }
index 73d184c9bea5e6f8ce2a1617dae456d9914ffe50..33646c8fdbb9e8e33182d3d5d8cb47185370d7e3 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)wizard.c   3.5     2007/08/26      */
+/*     SCCS Id: @(#)wizard.c   3.5     2008/11/14      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -431,7 +431,7 @@ nasty(mcast)
 
     /* some candidates may be created in groups, so simple count
        of non-null makemon() return is inadequate */
-    census = monster_census();
+    census = monster_census(FALSE);
 
     if(!rn2(10) && Inhell) {
        count = msummon((struct monst *) 0);    /* summons like WoY */
@@ -472,7 +472,7 @@ nasty(mcast)
            }
     }
 
-    if (count) count = monster_census() - census;
+    if (count) count = monster_census(FALSE) - census;
     return count;
 }