fix #H2225 - death by poison after life-saving (trunk only)

From a bug report,
when falling into a spiked pit and being killed and then life-saved, you
could immediately die from fatal poison.  It isn't necessarily a bug and
there are other ways to be killed, life-saved, and re-killed (such as
zaps that bounce off walls or reflecting targets), but it does seem to be
somewhat unfair.  This patch makes life-saving be more effective:  in a
damage-plus-poison situation, if the damage triggers life-saving then the
poison won't deal out any further damage (including its nasty chance for
instant death).  The poison still matters, but it will always target an
attribute stat--which is already one possible random outcome--instead of
maybe doing damage.  [It is actually possible to get damage if stat loss
tries to take hero's strength below 3, but now there's no chance of that
being fatal immediately after savelife() has restored full hit points.]
This commit is contained in:
nethack.rankin
2011-02-17 03:51:04 +00:00
parent 38cea51d15
commit f23e87f2b4
4 changed files with 34 additions and 17 deletions

View File

@@ -686,6 +686,7 @@ unsigned trflags;
forcebungle = (trflags & FORCEBUNGLE) != 0,
plunged = (trflags & TOOKPLUNGE) != 0,
adj_pit = conjoined_pits(trap, t_at(u.ux0,u.uy0), TRUE);
int oldumort;
#ifdef STEED
int steed_article = ARTICLE_THE;
#endif
@@ -779,13 +780,17 @@ unsigned trflags;
otmp->quan = 1L;
otmp->owt = weight(otmp);
if (!rn2(6)) otmp->opoisoned = 1;
oldumort = u.umortality;
#ifdef STEED
if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) /* nothing */;
else
#endif
if (thitu(7, dmgval(otmp, &youmonst), otmp, "little dart")) {
if (otmp->opoisoned)
poisoned("dart", A_CON, "little dart", 10, TRUE);
poisoned("dart", A_CON, "little dart",
/* if damage triggered life-saving,
poison is limited to attrib loss */
(u.umortality > oldumort) ? 0 : 10, TRUE);
obfree(otmp, (struct obj *)0);
} else {
place_object(otmp, u.ux, u.uy);
@@ -1041,6 +1046,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
if (!steedintrap(trap, (struct obj *)0)) {
#endif
if (ttype == SPIKED_PIT) {
oldumort = u.umortality;
losehp(Maybe_Half_Phys(rnd(adj_pit ? 6 : 10)),
plunged ? "deliberately plunged into a pit of iron spikes" :
adj_pit ? "stepped into a pit of iron spikes" :
@@ -1048,9 +1054,11 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
NO_KILLER_PREFIX);
if (!rn2(6))
poisoned("spikes", A_STR,
adj_pit ? "stepping on poison spikes" :
"fall onto poison spikes",
8, FALSE);
adj_pit ? "stepping on poison spikes" :
"fall onto poison spikes",
/* if damage triggered life-saving,
poison is limited to attrib loss */
(u.umortality > oldumort) ? 0 : 8, FALSE);
} else {
if (!adj_pit)
losehp(Maybe_Half_Phys(rnd(6)),