address issue #1499 - saving grace vs traps

Issue reported by Shrigis1:  hero at or close to full HP stepped on
a not-yet-discovered rolling boulder trap and was killed; end-of-game
disclosure reported "You could have avoided a one-shot death via
saving-grace."

Originally, saving grace was completely hidden, so the disclosure
line wouldn't have been included.  Once disclosure was incorporated,
having saving grace not work for traps triggered by the hero seems
counter-intuitive, regardless of whether player is aware of the trap.

This makes saving grace apply to any damage applied by losehp().  The
original purpose of unexpectedly survivng by the skin of one's teeth
is still maintained.

Aside from having more of a chance of surviving via saving-grace,
the main difference is that some players might try for "survived by
saving-grace" as an unofficial conduct.  As long as we don't start
tracking that as a conduct, I don't think this is a big deal.

Fixes #1499
This commit is contained in:
PatR
2026-04-21 20:55:39 -07:00
parent 2b74dce88c
commit 0a51a9656e

View File

@@ -4251,12 +4251,12 @@ saving_grace(int dmg)
impossible("saving_grace check for negative damage? (%d)", dmg);
return 0;
}
#if 0 /* saving grace _does_ protect hero during own actions */
if (!svc.context.mon_moving) {
/* saving grace doesn't protect you from your own actions */
return dmg;
}
#endif
if (dmg < u.uhp || u.uhp <= 0) {
/* no need for saving grace */
return dmg;