Skip to content

Commit

Permalink
fix #H1911: poison dart message sequence (trunk only)
Browse files Browse the repository at this point in the history
     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....]
  • Loading branch information
nethack.rankin committed Jun 30, 2009
1 parent aeecad9 commit e673423
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions doc/fixes35.0
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 16 additions & 5 deletions src/uhitm.c
Original file line number Diff line number Diff line change
@@ -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. */

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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] */

Expand All @@ -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 */
Expand All @@ -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
Expand Down

0 comments on commit e673423

Please sign in to comment.