Restful sleep regenerates hp

When sleeping due to wearing an amulet of restful sleep,
hit points will regenerate, one point faster than with normal regeneration.
This commit is contained in:
Pasi Kallinen
2020-10-29 19:14:28 +02:00
parent f5a6267b3a
commit 91c46ab54b
2 changed files with 10 additions and 3 deletions

View File

@@ -287,6 +287,7 @@ hero poly'd into rust monster could implicitly eat bars when adjacent by
trying to move there, now when in rock mole form too; in xorn form
can explicitly eat them via 'e' after moving onto their spot
monster hiding under an egg that hatched was kept hidden
restful sleep regenerates hit points
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -471,6 +471,8 @@ boolean resuming;
}
}
#define U_CAN_REGEN() (Regeneration || (Sleepy && u.usleep))
/* maybe recover some lost health (or lose some when an eel out of water) */
static void
regen_hp(wtcap)
@@ -491,7 +493,7 @@ int wtcap;
&& (!Half_physical_damage || !(g.moves % 2L)))
heal = -1;
} else if (u.mh < u.mhmax) {
if (Regeneration || (encumbrance_ok && !(g.moves % 20L)))
if (U_CAN_REGEN() || (encumbrance_ok && !(g.moves % 20L)))
heal = 1;
}
if (heal) {
@@ -506,7 +508,7 @@ int wtcap;
no !Upolyd check here, so poly'd hero recovered lost u.uhp
once u.mh reached u.mhmax; that may have been convenient
for the player, but it didn't make sense for gameplay...] */
if (u.uhp < u.uhpmax && (encumbrance_ok || Regeneration)) {
if (u.uhp < u.uhpmax && (encumbrance_ok || U_CAN_REGEN())) {
if (u.ulevel > 9) {
if (!(g.moves % 3L)) {
int Con = (int) ACURR(A_CON);
@@ -523,8 +525,10 @@ int wtcap;
if (!(g.moves % (long) ((MAXULEV + 12) / (u.ulevel + 2) + 1)))
heal = 1;
}
if (Regeneration && !heal)
if (U_CAN_REGEN() && !heal)
heal = 1;
if (Sleepy && u.usleep)
heal++;
if (heal) {
g.context.botl = TRUE;
@@ -541,6 +545,8 @@ int wtcap;
interrupt_multi("You are in full health.");
}
#undef U_CAN_REGEN
void
stop_occupation()
{