Make saving grace also work against repeated damage sources

For example, being hit by the bounce of a wand of fire means that
the main character could take damage twice in a turn, which would
kill even through saving grace; and scrolls and potions could burn
up after that and finish off the last HP, even if the wand only hit
once. This commit changes it to track all damage done during the
turn, and prevent HP dropping below 1 from damage until the next
player action or the next turn boundary, whichever comes first.
This commit is contained in:
Alex Smith
2025-11-26 05:45:45 +00:00
parent 6eb2eb7df7
commit 4d55e1de79
4 changed files with 38 additions and 2 deletions

View File

@@ -200,6 +200,7 @@ moveloop_core(void)
encumber_msg();
svc.context.mon_moving = TRUE;
gu.uhp_at_start_of_monster_turn = u.uhp;
do {
monscanmove = movemon();
if (u.umovement >= NORMAL_SPEED)
@@ -272,6 +273,8 @@ moveloop_core(void)
if (u.ublesscnt)
u.ublesscnt--;
gs.saving_grace_turn = FALSE;
/* One possible result of prayer is healing. Whether or
* not you get healed depends on your current hit points.
* If you are allowed to regenerate during the prayer,
@@ -423,6 +426,8 @@ moveloop_core(void)
else if (!u.umoved)
(void) pooleffects(FALSE);
gs.saving_grace_turn = FALSE;
/* vision while buried or underwater is updated here */
if (Underwater)
under_water(0);