hero health manipulation
I've been investigating issue #1252 (while the fuzzer was running, sanity_check complained that hero's current health was greater than maximum health) off and on for three months and haven't found the cause. I've checked all the places that lower maximum HP that I've managed to find, but not spent much time looking for places that raise current HP. These changes might provide some more information. They don't rely on sanity_check being enabled. Issue #1252 is still open.
This commit is contained in:
11
src/hack.c
11
src/hack.c
@@ -4039,10 +4039,15 @@ maybe_wail(void)
|
||||
int
|
||||
saving_grace(int dmg)
|
||||
{
|
||||
if (!u.usaving_grace && (u.uhp <= dmg)
|
||||
&& (u.uhp * 100 / u.uhpmax) > 90) {
|
||||
if (dmg < 0) {
|
||||
impossible("saving_grace check for negative damage? (%d)", dmg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!u.usaving_grace && dmg >= u.uhp && (u.uhp * 100 / u.uhpmax) > 90) {
|
||||
/* note: this could reduce dmg to 0 if u.uhpmax==1 */
|
||||
dmg = u.uhp - 1;
|
||||
u.usaving_grace = TRUE; /* used up */
|
||||
u.usaving_grace = 1; /* used up */
|
||||
end_running(TRUE);
|
||||
if (u.usleep)
|
||||
unmul("Suddenly you wake up!");
|
||||
|
||||
Reference in New Issue
Block a user