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

@@ -1135,7 +1135,6 @@ give feedback when some types of damage are avoided due to MC (aka negation)
feedback if a named, shape-shifted vampire reverted to original shape rather feedback if a named, shape-shifted vampire reverted to original shape rather
than dying when engulfed could say "Dracula turns into Dracula" than dying when engulfed could say "Dracula turns into Dracula"
adjust archeologist and valkyrie starting intrinsics adjust archeologist and valkyrie starting intrinsics
once per game if receiving killing blow from near-full hp, leave 1 hp
spell of knock can knock back small monsters spell of knock can knock back small monsters
protection from shape changers now prevents the Wizard from mimicking monsters protection from shape changers now prevents the Wizard from mimicking monsters
having worn levitation boots removed and destroyed (scroll, monster spell, having worn levitation boots removed and destroyed (scroll, monster spell,
@@ -2675,6 +2674,14 @@ pyrolisk eggs explode when broken
pauper-option to start the character with no possessions pauper-option to start the character with no possessions
wand of secret door detection, spell of detect unseen, and wizard mode ^E now wand of secret door detection, spell of detect unseen, and wizard mode ^E now
flash the cursor at each location where detection finds something flash the cursor at each location where detection finds something
saving-grace: once per game if receiving a killing blow from full or nearly
full HP, survive with 1 HP
livelog/#chronicle for saving-grace: if saving-grace prevents hero's death,
report it [at present, it uses the livelog classification for breaking
a conduct]
enlightenment/attribute disclosure for saving-grace: include a line for have
or haven't been saved (game in progress) or did or didn't get saved
(game over) via saving-grace
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features

View File

@@ -4045,6 +4045,15 @@ saving_grace(int dmg)
} }
if (!u.usaving_grace && dmg >= u.uhp && (u.uhp * 100 / u.uhpmax) > 90) { 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 */ /* note: this could reduce dmg to 0 if u.uhpmax==1 */
dmg = u.uhp - 1; dmg = u.uhp - 1;
u.usaving_grace = 1; /* used up */ u.usaving_grace = 1; /* used up */

View File

@@ -1922,6 +1922,20 @@ attributes_enlightenment(
} }
#endif #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; const char *p;