]> granicus.if.org Git - nethack/commitdiff
fix #H1911: poison dart message sequence (trunk only)
authornethack.rankin <nethack.rankin>
Tue, 30 Jun 2009 08:18:27 +0000 (08:18 +0000)
committernethack.rankin <nethack.rankin>
Tue, 30 Jun 2009 08:18:27 +0000 (08:18 +0000)
     From a bug report, message sequence
when throwing a poisoned weapon which loses its poison was confusing.

|The dart is no longer poisoned.
|The dart hits the acid blob.
|The poison doesn't seem to affect the acid blob.

This patch makes the first sentence come out last.

     [It appears that poisoned weapons thrown/shot by monsters or traps
never lose their poison.  That can't be right....]

doc/fixes35.0
src/uhitm.c

index 4b1c5a62e44a99568736100b4c66585991967ab8..5e2c683622f3be981a35736b7c4417df910b5ed5 100644 (file)
@@ -324,6 +324,7 @@ simplify hero placement on Castle level when climbing up stairs from Valley
 spell attack by low-Int hero could inflict negative damage
 some wand/spell/breath zaps that hit a secret door failed to reveal it
 wand explosion feedback about adjacent door was phrased as if for a wand zap
+improve the message sequencing when a thrown poisoned weapon loses is poison
 
 
 Platform- and/or Interface-Specific Fixes
index d4e158c0879c333c2e926e3f2d89ea2ad6aa404d..8017d5dba85972391fd671ac2e6d94582956a303 100644 (file)
@@ -1,5 +1,4 @@
 /* NetHack 3.5 uhitm.c $Date$  $Revision$ */
-/*     SCCS Id: @(#)uhitm.c    3.5     2009/02/21      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -551,7 +550,8 @@ int thrown;         /* HMON_xxx (0 => hand-to-hand, other => ranged) */
         */
        boolean hittxt = FALSE, destroyed = FALSE, already_killed = FALSE;
        boolean get_dmg_bonus = TRUE;
-       boolean ispoisoned = FALSE, needpoismsg = FALSE, poiskilled = FALSE;
+       boolean ispoisoned = FALSE, needpoismsg = FALSE, poiskilled = FALSE,
+               unpoisonmsg = FALSE;
        boolean silvermsg = FALSE, silverobj = FALSE;
        boolean valid_weapon_attack = FALSE;
        boolean unarmed = !uwep && !uarm && !uarms;
@@ -963,8 +963,10 @@ int thrown;                /* HMON_xxx (0 => hand-to-hand, other => ranged) */
                adjalign(-1);
            }
            if (obj && !rn2(nopoison)) {
+               /* remove poison now in case obj ends up in a bones file */
                obj->opoisoned = FALSE;
-               pline("%s no longer poisoned.", Yobjnam2(obj, "are"));
+               /* defer "obj is no longer poisoned" until after hit message */
+               unpoisonmsg = TRUE;
            }
            if (resists_poison(mon))
                needpoismsg = TRUE;
@@ -1093,6 +1095,12 @@ int thrown;              /* HMON_xxx (0 => hand-to-hand, other => ranged) */
                    whom = strcat(s_suffix(whom), " flesh");
                pline(fmt, whom);
        }
+       /* if a "no longer poisoned" message is coming, it will be last;
+          obj->opoisoned was cleared above and any message referring to
+          "poisoned <obj>" has now been given; we want just "<obj>" for
+          last message, so reformat while obj is still accessible */
+       if (unpoisonmsg)
+           Strcpy(saved_oname, cxname(obj));
 
        /* [note: thrown obj might go away during killed/xkilled call] */
 
@@ -1101,7 +1109,7 @@ int thrown;               /* HMON_xxx (0 => hand-to-hand, other => ranged) */
        if (poiskilled) {
                pline_The("poison was deadly...");
                if (!already_killed) xkilled(mon, 0);
-               return FALSE;
+               destroyed = TRUE;       /* return FALSE; */
        } else if (destroyed) {
                if (!already_killed)
                    killed(mon);        /* takes care of most messages */
@@ -1114,8 +1122,11 @@ int thrown;              /* HMON_xxx (0 => hand-to-hand, other => ranged) */
                            pline("%s appears confused.", Monnam(mon));
                }
        }
+       if (unpoisonmsg)
+               Your("%s %s no longer poisoned.", saved_oname,
+                    vtense(saved_oname, "are"));
 
-       return((boolean)(destroyed ? FALSE : TRUE));
+       return destroyed ? FALSE : TRUE;
 }
 
 STATIC_OVL boolean