fix #H2397 - "<Mon> turns to flee" when paralyzed (trunk only)

From a bug report, a
monster incapable of moving could yield the message "<Mon> turns to flee!"
when hit by an attack which scared it.  I thought that something to fix
this had already been done, but that wasn't the case.  Now it will give
"The immobile <mon> seems to flinch" instead.  I'd rather use
  mon->data->mmove == 0 ? "immobile <mon>" :
    mon->paralyzed ? "paralyzed <mon>" : "sleeping <mon>"
but it presently isn't possible to distinguish between sleep, paralysis,
and being busy doning armor because mon->mfrozen is used for all three.
(I'm not going to worry about the busy case, even though "immobile" sounds
inaccurate for it.)

     Also, stethoscope and probing were suppressing "scared" after giving
"can't move", in order to reduce the chance of wrapping the top line.
This changes it to display both status conditions so that scared state
isn't hidden when the target is paralyzed or asleep (or busy).
This commit is contained in:
nethack.rankin
2011-08-20 00:22:20 +00:00
parent 612755bfb5
commit 8f07e5ee39
5 changed files with 30 additions and 30 deletions

View File

@@ -377,6 +377,7 @@ when shop prices are adjusted, handle roundoff (integer truncation) better
for hero poly'd into a monster form that lacks a weapon attack but has a claw
attack, use wielded weapon even when claw attack isn't the very first
rename the SLEEPING property and Sleeping attribute to SLEEPY and Sleepy, resp.
give alternate message for "<mon> turns to flee" when mon can't move
Platform- and/or Interface-Specific Fixes

View File

@@ -1,5 +1,4 @@
/* NetHack 3.5 fountain.c $Date$ $Revision$ */
/* SCCS Id: @(#)fountain.c 3.5 2009/01/31 */
/* Copyright Scott R. Turner, srt@ucla, 10/27/86 */
/* NetHack may be freely redistributed. See license for details. */
@@ -334,15 +333,17 @@ drinkfountain()
dowaternymph();
break;
case 29: /* Scare */ {
case 29: /* Scare */
{
register struct monst *mtmp;
pline("This water gives you bad breath!");
for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
if(!DEADMONSTER(mtmp))
monflee(mtmp, 0, FALSE, FALSE);
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) continue;
monflee(mtmp, 0, FALSE, FALSE);
}
break;
}
case 30: /* Gushing forth in this room */

View File

@@ -221,15 +221,22 @@ boolean fleemsg;
if (!fleetime)
mtmp->mfleetim = 0;
else if (!mtmp->mflee || mtmp->mfleetim) {
fleetime += mtmp->mfleetim;
fleetime += (int)mtmp->mfleetim;
/* ensure monster flees long enough to visibly stop fighting */
if (fleetime == 1) fleetime++;
mtmp->mfleetim = min(fleetime, 127);
mtmp->mfleetim = (unsigned)min(fleetime, 127);
}
if (!mtmp->mflee && fleemsg && canseemon(mtmp) &&
mtmp->m_ap_type != M_AP_FURNITURE &&
mtmp->m_ap_type != M_AP_OBJECT) {
/* unfortunately we can't distinguish between temporary
sleep and temporary paralysis, so both conditions
receive the same alternate message */
if (!mtmp->mcanmove || !mtmp->data->mmove)
pline("%s seems to flinch.", Adjmonnam(mtmp, "immobile"));
else
pline("%s turns to flee.", Monnam(mtmp));
}
if (!mtmp->mflee && fleemsg && canseemon(mtmp) && !mtmp->mfrozen &&
mtmp->m_ap_type != M_AP_FURNITURE &&
mtmp->m_ap_type != M_AP_OBJECT)
pline("%s turns to flee!", (Monnam(mtmp)));
mtmp->mflee = 1;
}
}
@@ -259,17 +266,13 @@ int *inrange, *nearby, *scared;
seescaryx = u.ux;
seescaryy = u.uy;
}
*scared = (*nearby && (onscary(seescaryx, seescaryy, mtmp) ||
(!mtmp->mpeaceful &&
in_your_sanctuary(mtmp, 0, 0))));
if(*scared) {
if (rn2(7))
monflee(mtmp, rnd(10), TRUE, TRUE);
else
monflee(mtmp, rnd(100), TRUE, TRUE);
}
if (*nearby &&
(onscary(seescaryx, seescaryy, mtmp) ||
(!mtmp->mpeaceful && in_your_sanctuary(mtmp, 0, 0)))) {
*scared = 1;
monflee(mtmp, rnd(rn2(7) ? 10 : 100), TRUE, TRUE);
} else
*scared = 0;
}
/* perform a special one-time action for a monster; returns -1 if nothing

View File

@@ -1,5 +1,4 @@
/* NetHack 3.5 pline.c $Date$ $Revision$ */
/* SCCS Id: @(#)pline.c 3.5 2009/01/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -386,7 +385,7 @@ register struct monst *mtmp;
/* [arbitrary reason why it isn't moving] */
else if (mtmp->mstrategy & STRAT_WAITMASK)
Strcat(info, ", meditating");
else if (mtmp->mflee) Strcat(info, ", scared");
if (mtmp->mflee) Strcat(info, ", scared");
if (mtmp->mtrapped) Strcat(info, ", trapped");
if (mtmp->mspeed) Strcat(info,
mtmp->mspeed == MFAST ? ", fast" :

View File

@@ -2622,12 +2622,8 @@ struct obj *otmp; /* source of flash */
}
if (mtmp->mhp > 0) {
if (!context.mon_moving) setmangry(mtmp);
if (tmp < 9 && !mtmp->isshk && rn2(4)) {
if (rn2(4))
monflee(mtmp, rnd(100), FALSE, TRUE);
else
monflee(mtmp, 0, FALSE, TRUE);
}
if (tmp < 9 && !mtmp->isshk && rn2(4))
monflee(mtmp, rn2(4) ? rnd(100) : 0, FALSE, TRUE);
mtmp->mcansee = 0;
mtmp->mblinded = (tmp < 3) ? 0 : rnd(1 + 50/tmp);
}