prayer timeout bit

It was theoretically possible to reduce prayer timeout by angering
your god.  I'm not sure whether that could actually happen but add
code to avoid it.
This commit is contained in:
PatR
2022-04-08 14:48:55 -07:00
parent bd7ed0d343
commit dde1ae2e9b
+19 -12
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 pray.c $NHDT-Date: 1646870846 2022/03/10 00:07:26 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.164 $ */ /* NetHack 3.7 pray.c $NHDT-Date: 1649454525 2022/04/08 21:48:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.168 $ */
/* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */ /* Copyright (c) Benson I. Margulies, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -667,11 +667,11 @@ fry_by_god(aligntyp resp_god, boolean via_disintegration)
static void static void
angrygods(aligntyp resp_god) angrygods(aligntyp resp_god)
{ {
int maxanger; int maxanger, new_ublesscnt;
if (Inhell) if (Inhell)
resp_god = A_NONE; resp_god = A_NONE;
u.ublessed = 0; u.ublessed = 0; /* lose divine protection */
/* changed from tmp = u.ugangr + abs (u.uluck) -- rph */ /* changed from tmp = u.ugangr + abs (u.uluck) -- rph */
/* added test for alignment diff -dlc */ /* added test for alignment diff -dlc */
@@ -735,7 +735,10 @@ angrygods(aligntyp resp_god)
god_zaps_you(resp_god); god_zaps_you(resp_god);
break; break;
} }
u.ublesscnt = rnz(300); /* even though this might not be in response to prayer, set pray timer */
new_ublesscnt = rnz(300);
if (new_ublesscnt > u.ublesscnt)
u.ublesscnt = new_ublesscnt;
return; return;
} }
@@ -1411,17 +1414,21 @@ consume_offering(struct obj *otmp)
exercise(A_WIS, TRUE); exercise(A_WIS, TRUE);
} }
/* feedback when attempting to offer the Amulet on a "low altar" (not one of
the high altars in the temples on the Astral Plane or Moloch's Sanctum) */
static void static void
offer_too_soon(aligntyp altaralign) offer_too_soon(aligntyp altaralign)
{ {
if (altaralign == A_NONE && Inhell) if (altaralign == A_NONE && Inhell) {
/* hero has left Moloch's Sanctum so is in the process /* offering on an unaligned altar in Gehennom;
of getting away with the Amulet (outside of Gehennom, hero has left Moloch's Sanctum (caller handles that)
fall through to the "ashamed" feedback) */ so is in the process of getting away with the Amulet;
gods_upset(A_NONE); for any unaligned altar outside of Gehennom, give the
else "you feel ashamed" feedback for wrong alignment below */
You_feel("%s.", gods_upset(A_NONE); /* Moloch becomes angry */
Hallucination return;
}
You_feel("%s.", Hallucination
? "homesick" ? "homesick"
/* if on track, give a big hint */ /* if on track, give a big hint */
: (altaralign == u.ualign.type) : (altaralign == u.ualign.type)