extending u.usaving_grace

Issue a livelog/#chronicle message if saving-grace saves the hero.
Right now it's classified as conduct for livelog filtering, because
I didn't want to implement a new category (needs update of global.h
and also the template 'sysconf') and conduct felt like the best fit
of the existing classifications.

Report whether saving-grace is available or already used, among
the attributes of magical enlightenment or end-of-game disclosure.

And move the fixes entry for it from the fixes section to the new
features section of fixes3-7-0.txt.

It seems likely that someone will want to turn not using saving-
grace into a tracked conduct.  That seems like overkill to me, not
to mention inflating the N for "N conduct games".
This commit is contained in:
PatR
2024-09-06 15:32:26 -07:00
parent 045d60848b
commit b9ff8068b4
3 changed files with 31 additions and 1 deletions

View File

@@ -4045,6 +4045,15 @@ saving_grace(int dmg)
}
if (!u.usaving_grace && dmg >= u.uhp && (u.uhp * 100 / u.uhpmax) > 90) {
/* saving_grace doesn't have it's own livelog classification;
we might invent one, or perhaps use LL_LIFESAVE, but surviving
certain death (or preserving worn amulet of life saving) via
saving-grace feels like breaking a conduct; not sure how best
to phrase this though... */
livelog_printf(LL_CONDUCT, "%s (%d damage, %d/%d HP)",
"survived one-shot death via saving-grave",
dmg, u.uhp, u.uhpmax);
/* note: this could reduce dmg to 0 if u.uhpmax==1 */
dmg = u.uhp - 1;
u.usaving_grace = 1; /* used up */

View File

@@ -1922,6 +1922,20 @@ attributes_enlightenment(
}
#endif
{
static const char *verbchoices[2][2] = {
{ "might avoid", "have avoided" },
{ "could have avoided", "avoided" },
};
/* u.usaving_grace will always be 0 or 1; final is 0 (game in
progress), 1 (game over, survived), or 2 (game over, died) */
const char *verb = verbchoices[!!final][u.usaving_grace];
/* 'verb' has already been set for present or past but enl_msg()
needs it twice, one for in progress, the other for game over */
enl_msg(You_, verb, verb, " a one-shot death via saving-grace", "");
}
{
const char *p;