diff --git a/src/pray.c b/src/pray.c index ee50fc10e..a983c4de9 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 pray.c $NHDT-Date: 1712233483 2024/04/04 12:24:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.217 $ */ +/* NetHack 3.7 pray.c $NHDT-Date: 1727250729 2024/09/25 07:52:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.220 $ */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* NetHack may be freely redistributed. See license for details. */ @@ -368,7 +368,7 @@ fix_curse_trouble(struct obj *otmp, const char *what) staticfn void fix_worst_trouble(int trouble) { - int i; + int i, maxhp, polyd = NON_PM; struct obj *otmp = 0; const char *what = (const char *) 0; static NEARDATA const char leftglow[] = "Your left ring softly glows", @@ -419,18 +419,20 @@ fix_worst_trouble(int trouble) boosted to be more than that */ You_feel("much better."); if (Upolyd) { - u.mhmax += rnd(5); - if (u.mhmax <= 5) - u.mhmax = 5 + 1; + maxhp = u.mhmax + rnd(5); + setuhpmax(max(maxhp, 5 + 1)); u.mh = u.mhmax; + polyd = u.umonnum; + u.umonnum = u.umonster; /* temporarily unpolymorph so that next + * setuhpmax() call deals with u.uhpmax */ } - if (u.uhpmax < u.ulevel * 5 + 11) - u.uhpmax += rnd(5); - if (u.uhpmax <= 5) - u.uhpmax = 5 + 1; - if (u.uhpmax > u.uhppeak) - u.uhppeak = u.uhpmax; + maxhp = u.uhpmax; + if (maxhp < u.ulevel * 5 + 11) + maxhp += rnd(5); + setuhpmax(max(maxhp, 5 + 1)); u.uhp = u.uhpmax; + if (polyd != NON_PM) + u.umonnum = polyd; /* restore Upolyd */ disp.botl = TRUE; break; case TROUBLE_COLLAPSING: