From: PatR Date: Mon, 24 Dec 2018 10:08:44 +0000 (-0800) Subject: fix temporary strength loss that was permanent X-Git-Tag: NetHack-3.6.2_Released~122^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2852f25fd02bb5a1205b2a4f9af5b3ee41ba06f;p=nethack fix temporary strength loss that was permanent Watching the fuzzer, I saw hero's strength plummet to 3 again and not rise above 5 after that. It turns out to be due to life-saving, which was fixing severe hunger but was not restoring the point of strength that's lost when you go from hungry to weak. I'm not sure whether this was caused by 3.6.1's commit 024e9e122576db664e37df0937cfb4c06c436e0c or already behaved that way. Another fuzzer bit: the monk I was watching was bitten by a wererat early on and was still inflicted with lycanthropy when he reached level 19. (I've no idea how his level got to be so high; it jumped from 14 to 19 while I wasn't paying attention.) Extend the earlier hack for drinking a blessed potion of restore ability to recover lost characteristcs to sometimes drink a potion of holy water instead. --- diff --git a/doc/fixes36.2 b/doc/fixes36.2 index aa0a07c87..dbe5691c9 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -301,6 +301,8 @@ message sequencing when vampire shifts to fog cloud to pass under closed door: when in sight, give form change message before moving to door spot limit carrying heavy loads from water to land failing to carry a wished-for item behaved differenctly from dropping one +life-saving while weak/starving/fainting boosted nutrition without restoring + lost point of strength, making temporary loss be permanent Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/end.c b/src/end.c index b89eee7e9..3803a4366 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1545172226 2018/12/18 22:30:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.159 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1545646111 2018/12/24 10:08:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.160 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -859,16 +859,13 @@ int how; u.uhp = u.uhpmax; if (Upolyd) /* Unchanging, or death which bypasses losing hit points */ u.mh = u.mhmax; - if (u.uhunger < 500) { - u.uhunger = 500; - newuhs(FALSE); + if (u.uhunger < 500 || how == CHOKING) { + init_uhunger(); } /* cure impending doom of sickness hero won't have time to fix */ if ((Sick & TIMEOUT) == 1L) { make_sick(0L, (char *) 0, FALSE, SICK_ALL); } - if (how == CHOKING) - init_uhunger(); nomovemsg = "You survived that attempt on your life."; context.move = 0; if (multi > 0) @@ -1060,9 +1057,12 @@ int how; if (iflags.debug_fuzzer) { if (!(program_state.panicking || how == PANICKED)) { savelife(how); - /* periodically restore characteristics and lost exp levels */ + /* periodically restore characteristics and lost exp levels + or cure lycanthropy */ if (!rn2(10)) { - struct obj *potion = mksobj(POT_RESTORE_ABILITY, TRUE, FALSE); + struct obj *potion = mksobj((u.ulycn > LOW_PM && !rn2(3)) + ? POT_WATER : POT_RESTORE_ABILITY, + TRUE, FALSE); bless(potion); (void) peffects(potion); /* always -1 for restore ability */