]> granicus.if.org Git - nethack/commitdiff
Restful sleep regenerates hp
authorPasi Kallinen <paxed@alt.org>
Thu, 29 Oct 2020 17:14:28 +0000 (19:14 +0200)
committerPasi Kallinen <paxed@alt.org>
Thu, 29 Oct 2020 17:14:32 +0000 (19:14 +0200)
When sleeping due to wearing an amulet of restful sleep,
hit points will regenerate, one point faster than with normal regeneration.

doc/fixes37.0
src/allmain.c

index a46b9c1c1ddee420afc88bba0c2158fd3dfcfa4f..8814aa28c7105854f893732f4f2e5e717cc618fa 100644 (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
index eb17b82e01e918f070acb60167cbed319372ec89..a11919b854c40b775752aec20c95cf83037407d4 100644 (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()
 {