From 4eb05929590ed83aece80a42de56163d3865435f Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 22 Dec 2021 19:36:52 -0800 Subject: [PATCH] sickness countdown Give messages when sickness countdown has nearly expired to warn player that hero is dying and also so that death at the end doesn't seem so abrupt after an arbitrary period with just "TermIll" and/or "FoodPois" on the status line. Also, abuse constitution each turn when Sick (either variation, but not a double amount if both). --- doc/fixes37.0 | 2 ++ src/timeout.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 596c74d60..d27bd2863 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1299,6 +1299,8 @@ decaying globs of {ooze,pudding,slime} shrink over time based on their total poisoning effect when eaten track peak maximum HP and peak maximum energy/power; no noticeable effect give some dragon armor extra effects when worn +issue messages during last stage of food poisoning/terminal illness countdown + when hero's demise is imminent Platform- and/or Interface-Specific New Features diff --git a/src/timeout.c b/src/timeout.c index e3f1f4f10..0e435c86e 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -11,6 +11,7 @@ static void choke_dialogue(void); static void levitation_dialogue(void); static void slime_dialogue(void); static void slimed_to_death(struct kinfo *); +static void sickness_dialogue(void); static void phaze_dialogue(void); static void done_timeout(int, int); static void slip_or_trip(void); @@ -278,6 +279,37 @@ choke_dialogue(void) exercise(A_STR, FALSE); } +static NEARDATA const char *const sickness_texts[] = { + "Your illness feels worse.", + "Your illness is severe.", + "You are at Death's door.", +}; + +static void +sickness_dialogue(void) +{ + long j = (Sick & TIMEOUT), i = j / 2L; + + if (i > 0L && i <= SIZE(sickness_texts) && (j % 2) != 0) { + char buf[BUFSZ], pronounbuf[40]; + + Strcpy(buf, sickness_texts[SIZE(sickness_texts) - i]); + /* change the message slightly for food poisoning */ + if ((u.usick_type & SICK_NONVOMITABLE) == 0) + (void) strsubst(buf, "illness", "sickness"); + if (Hallucination && strstri(buf, "Death's door")) { + /* youmonst: for Hallucination, mhe()'s mon argument isn't used */ + Strcpy(pronounbuf, mhe(&g.youmonst)); + Sprintf(eos(buf), " %s %s inviting you in.", + /* upstart() modifies its argument but vtense() doesn't + care whether or not that has already happened */ + upstart(pronounbuf), vtense(pronounbuf, "are")); + } + urgent_pline("%s", buf); + } + exercise(A_CON, FALSE); +} + static NEARDATA const char *const levi_texts[] = { "You float slightly lower.", "You wobble unsteadily %s the %s." @@ -530,6 +562,8 @@ nh_timeout(void) vomiting_dialogue(); if (Strangled) choke_dialogue(); + if (Sick) + sickness_dialogue(); if (HLevitation & TIMEOUT) levitation_dialogue(); if (HPasses_walls & TIMEOUT)