From: nethack.rankin Date: Sat, 20 Aug 2011 00:22:20 +0000 (+0000) Subject: fix #H2397 - " turns to flee" when paralyzed (trunk only) X-Git-Tag: MOVE2GIT~189 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f07e5ee392e84b410a5227350b2b3dd81986c77;p=nethack fix #H2397 - " turns to flee" when paralyzed (trunk only) From a bug report, a monster incapable of moving could yield the message " 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 seems to flinch" instead. I'd rather use mon->data->mmove == 0 ? "immobile " : mon->paralyzed ? "paralyzed " : "sleeping " 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). --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 4a7c0a4a2..657a2cabf 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 " turns to flee" when mon can't move Platform- and/or Interface-Specific Fixes diff --git a/src/fountain.c b/src/fountain.c index 0339b8391..bb0745002 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -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 */ diff --git a/src/monmove.c b/src/monmove.c index 16533775b..45aa8443f 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -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 diff --git a/src/pline.c b/src/pline.c index 6d7b9edef..53029c8dc 100644 --- a/src/pline.c +++ b/src/pline.c @@ -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" : diff --git a/src/uhitm.c b/src/uhitm.c index 9e336f5f6..f2c65bb61 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -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); }