probably fix #K4269 - sanity failure for u.mh \

being greater than u.mhmax

I think this will fix the situation where current HP as a monster
was greater than maximum HP as a monster, triggering a sanity_check
failure.  No promises though.

[poisoned() needs some missing Upolyd handling.]
This commit is contained in:
PatR
2024-09-24 13:59:28 -07:00
parent 6e32407e12
commit a3f176c9dc
3 changed files with 47 additions and 23 deletions

View File

@@ -395,13 +395,9 @@ touch_of_death(struct monst *mtmp)
newuhpmax = u.uhpmax - drain;
setuhpmax(max(newuhpmax, minuhpmax(3)));
/* reduce pending loss if uhp has already been reduced due to
drop in uhpmax */
if (u.uhp < olduhp) {
dmg -= (olduhp - u.uhp);
if (dmg < 1)
dmg = 1;
}
dmg = adjuhploss(dmg, olduhp); /* reduce pending damage if uhp has
* already been reduced due to drop
* in uhpmax */
losehp(dmg, kbuf, KILLED_BY);
}
svk.killer.name[0] = '\0'; /* not killed if we get here... */