]> granicus.if.org Git - nethack/commitdiff
one last(?) polyself bit: no control while stunned (trunk only)
authornethack.rankin <nethack.rankin>
Mon, 28 Feb 2011 11:29:27 +0000 (11:29 +0000)
committernethack.rankin <nethack.rankin>
Mon, 28 Feb 2011 11:29:27 +0000 (11:29 +0000)
     Teleport_control is disabled while the hero is Stunned; do the same
with Polymorph_control.  Also now disabled while unconscious, but that
is academic since random polymorphs and were-critter transformations are
postponed until multi is non-negative.  I included it for completeness.
(Reverting to original form can occur while unconscious, but control is
not a factor in that situation.  Teleporting handles being unconscious
differently but does negate control then.)

     The fixes entry could just as easily have gone into the new features
section as into the bug fixes one.  The teleport control part actually
belongs in fixes34.4 because it is present in the branch, but I didn't
feel like spreading this across two different files (and the current diff
references ``Unaware'' which doesn't exist in the branch so it isn't
trivial to include this patch there).

doc/fixes35.0
src/polyself.c
src/were.c

index c8acd81d0977a78b2b2abedc4386243fde3dd2a9..f3ac143d13ef5aab05a9da6b17ab0cc36f3192d7 100644 (file)
@@ -346,6 +346,7 @@ purple worm could end up in wall or solid rock when swallowing ghost or xorn
 enhance life-saving by preventing subsequent poison from being fatal upon
        rescue from death due to spiked pit, dart trap, or poisoned missile
 don't create mail daemons when populating special levels with random demons
+teleport control and polymorph control are ineffective while hero is stunned
 
 
 Platform- and/or Interface-Specific Fixes
index e94a71edc0cb1ad39d430ba613d9d880a5b3bbbe..c7010ff4098eb25f208ab82468e3f969b9c4a1d2 100644 (file)
@@ -245,7 +245,7 @@ newman()
        if (Sick) make_sick(0L, (char *) 0, FALSE, SICK_ALL);
        if (Stoned) make_stoned(0L, (char *)0, 0, (char *)0);
        if (u.uhp <= 0) {
-               if (Polymorph_control) {
+               if (Polymorph_control) {  /* even when Stunned || Unaware */
                    if (u.uhp <= 0) u.uhp = 1;
                } else {
 dead: /* we come directly here if their experience level went to 0 or less */
@@ -286,12 +286,14 @@ int psflags;
                monsterpoly = (psflags == 2),
                draconian = (uarm && Is_dragon_armor(uarm)),
                iswere = (u.ulycn >= LOW_PM),
-               isvamp = (youmonst.data->mlet == S_VAMPIRE);
+               isvamp = (youmonst.data->mlet == S_VAMPIRE),
+               controllable_poly = Polymorph_control && !(Stunned || Unaware);
 
        if (Unchanging) {
            pline("You fail to transform!");
            return;
        }
+       /* being Stunned|Unaware doesn't negate this aspect of Poly_control */
        if (!Polymorph_control && !forcecontrol &&
                !draconian && !iswere && !isvamp) {
            if (rn2(20) > ACURR(A_CON)) {
@@ -307,7 +309,7 @@ int psflags;
        if (monsterpoly && isvamp)
            goto do_vampyr;
 
-       if (Polymorph_control || forcecontrol) {
+       if (controllable_poly || forcecontrol) {
                tryct = 5;
                do {
                        mntmp = NON_PM;
@@ -404,7 +406,7 @@ int psflags;
                                mntmp = (youmonst.data != &mons[PM_VAMPIRE] &&
                                         !rn2(10)) ? PM_WOLF :
                                        !rn2(4) ? PM_FOG_CLOUD : PM_VAMPIRE_BAT;
-                       if (Polymorph_control) {
+                       if (controllable_poly) {
                                Sprintf(buf, "Become %s?",
                                        an(mons[mntmp].mname));
                                if (yn(buf) != 'y') return;
index ff1875ccf2d2f759028637a9e6fb7fa5b6583592..864ee5fed81930c5dac3b3b6d041fc3f67e409fe 100644 (file)
@@ -1,5 +1,4 @@
 /* NetHack 3.5 were.c  $Date$  $Revision$ */
-/*     SCCS Id: @(#)were.c     3.5     2007/06/02      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -157,9 +156,10 @@ void
 you_were()
 {
        char qbuf[QBUFSZ];
+       boolean controllable_poly = Polymorph_control && !(Stunned || Unaware);
 
        if (Unchanging || (u.umonnum == u.ulycn)) return;
-       if (Polymorph_control) {
+       if (controllable_poly) {
            /* `+4' => skip "were" prefix to get name of beast */
            Sprintf(qbuf, "Do you want to change into %s?",
                    an(mons[u.ulycn].mname+4));
@@ -172,12 +172,14 @@ void
 you_unwere(purify)
 boolean purify;
 {
+       boolean controllable_poly = Polymorph_control && !(Stunned || Unaware);
+
        if (purify) {
            You_feel("purified.");
            u.ulycn = NON_PM;   /* cure lycanthropy */
        }
        if (!Unchanging && is_were(youmonst.data) &&
-               (!Polymorph_control || yn("Remain in beast form?") == 'n'))
+               (!controllable_poly || yn("Remain in beast form?") == 'n'))
            rehumanize();
 }