Use a common funcion for all monster healing

Previously, the code for monster healing was repeated every time it
was needed; this commit sends it all through a common function, which
will make it easier to make changes to how monster healing works in
the future.

This is just a code reorganisation and won't have any gameplay
effect unless I made a mistake.
This commit is contained in:
Alex Smith
2025-01-12 18:20:13 +00:00
parent f0a0a74dcc
commit 97e0e934e8
13 changed files with 59 additions and 46 deletions

View File

@@ -675,10 +675,7 @@ mon_catchup_elapsed_time(
/* recover lost hit points */
if (!regenerates(mtmp->data))
imv /= 20;
if (mtmp->mhp + imv >= mtmp->mhpmax)
mtmp->mhp = mtmp->mhpmax;
else
mtmp->mhp += imv;
healmon(mtmp, imv, 0);
set_mon_lastmove(mtmp);
}