fix #H1755 - feedback for clerical summoning when blind (trunk only)

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.)
This commit is contained in:
nethack.rankin
2008-11-15 20:38:02 +00:00
parent 655a340f69
commit 4b1116f4d0
5 changed files with 53 additions and 30 deletions

View 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 "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 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 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 Platform- and/or Interface-Specific Fixes

View File

@@ -1126,7 +1126,7 @@ E int FDECL(doseduce, (struct monst *));
E void FDECL(newemin, (struct monst *)); E void FDECL(newemin, (struct monst *));
E void FDECL(free_emin, (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 int FDECL(msummon, (struct monst *));
E void FDECL(summon_minion, (ALIGNTYP_P,BOOLEAN_P)); E void FDECL(summon_minion, (ALIGNTYP_P,BOOLEAN_P));
E int FDECL(demon_talk, (struct monst *)); E int FDECL(demon_talk, (struct monst *));

View File

@@ -537,46 +537,66 @@ int spellnum;
struct permonst *pm = mkclass(S_ANT,0); struct permonst *pm = mkclass(S_ANT,0);
struct monst *mtmp2 = (struct monst *)0; struct monst *mtmp2 = (struct monst *)0;
char let = (pm ? S_ANT : S_SNAKE); char let = (pm ? S_ANT : S_SNAKE);
boolean success; boolean success = FALSE, seecaster;
int i; int i, quan, oldseen, newseen;
coord bypos; coord bypos;
int quan; const char *fmt;
oldseen = monster_census(TRUE);
quan = (mtmp->m_lev < 2) ? 1 : rnd((int)mtmp->m_lev / 2); quan = (mtmp->m_lev < 2) ? 1 : rnd((int)mtmp->m_lev / 2);
if (quan < 3) quan = 3; if (quan < 3) quan = 3;
success = pm ? TRUE : FALSE;
for (i = 0; i <= quan; i++) { for (i = 0; i <= quan; i++) {
if (!enexto(&bypos, mtmp->mux, mtmp->muy, mtmp->data)) if (!enexto(&bypos, mtmp->mux, mtmp->muy, mtmp->data))
break; break;
if ((pm = mkclass(let,0)) != 0 && 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; success = TRUE;
mtmp2->msleeping = mtmp2->mpeaceful = mtmp2->mtame = 0; mtmp2->msleeping = mtmp2->mpeaceful = mtmp2->mtame = 0;
set_malign(mtmp2); set_malign(mtmp2);
} }
} }
/* Not quite right: newseen = monster_census(TRUE);
* -- message doesn't always make sense for unseen caster (particularly
* the first message) /* not canspotmon(), which includes unseen things sensed via warning */
* -- message assumes plural monsters summoned (non-plural should be seecaster = canseemon(mtmp) || tp_sensemon(mtmp) || Detect_monsters;
* very rare, unlike in nasty())
* -- message assumes plural monsters seen fmt = 0;
*/ if (!seecaster) {
if (!success) char *arg; /* [not const: upstart(N==1 ? an() : makeplural())] */
pline("%s casts at a clump of sticks, but nothing happens.", const char *what = (let == S_SNAKE) ? "snake" : "insect";
Monnam(mtmp));
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) else if (let == S_SNAKE)
pline("%s transforms a clump of sticks into snakes!", fmt = "%s transforms a clump of sticks into snakes!";
Monnam(mtmp));
else if (Invisible && !perceives(mtmp->data) && else if (Invisible && !perceives(mtmp->data) &&
(mtmp->mux != u.ux || mtmp->muy != u.uy)) (mtmp->mux != u.ux || mtmp->muy != u.uy))
pline("%s summons insects around a spot near you!", fmt = "%s summons insects around a spot near you!";
Monnam(mtmp));
else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy)) else if (Displaced && (mtmp->mux != u.ux || mtmp->muy != u.uy))
pline("%s summons insects around your displaced image!", fmt = "%s summons insects around your displaced image!";
Monnam(mtmp));
else else
pline("%s summons insects!", Monnam(mtmp)); fmt = "%s summons insects!";
if (fmt) pline(fmt, Monnam(mtmp));
dmg = 0; dmg = 0;
break; break;
} }

View 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. */ /* 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. */
@@ -28,13 +28,15 @@ struct monst *mtmp;
/* count the number of monsters on the level */ /* count the number of monsters on the level */
int int
monster_census() monster_census(spotted)
boolean spotted; /* seen|sensed vs all */
{ {
struct monst *mtmp; struct monst *mtmp;
int count = 0; int count = 0;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) continue; if (DEADMONSTER(mtmp)) continue;
if (spotted && !canspotmon(mtmp)) continue;
++count; ++count;
} }
return count; return count;
@@ -108,7 +110,7 @@ struct monst *mon;
/* some candidates can generate a group of monsters, so simple /* some candidates can generate a group of monsters, so simple
count of non-null makemon() result is not sufficient */ count of non-null makemon() result is not sufficient */
census = monster_census(); census = monster_census(FALSE);
while (cnt > 0) { while (cnt > 0) {
mtmp = makemon(&mons[dtype], u.ux, u.uy, MM_EMIN); 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? */ /* how many monsters exist now compared to before? */
if (result) result = monster_census() - census; if (result) result = monster_census(FALSE) - census;
return result; return result;
} }

View 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. */ /* 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. */
@@ -431,7 +431,7 @@ nasty(mcast)
/* some candidates may be created in groups, so simple count /* some candidates may be created in groups, so simple count
of non-null makemon() return is inadequate */ of non-null makemon() return is inadequate */
census = monster_census(); census = monster_census(FALSE);
if(!rn2(10) && Inhell) { if(!rn2(10) && Inhell) {
count = msummon((struct monst *) 0); /* summons like WoY */ 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; return count;
} }