Praying on an altar with pet corpse on it can revive the pet

This commit is contained in:
Pasi Kallinen
2022-07-10 12:56:20 +03:00
parent 1dcd14bffd
commit 314715038d
2 changed files with 22 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ static void gods_upset(aligntyp);
static void consume_offering(struct obj *);
static void offer_too_soon(aligntyp);
static void desecrate_high_altar(aligntyp);
static boolean pray_revive(void);
static boolean water_prayer(boolean);
static boolean blocked_boulder(int, int);
@@ -1994,6 +1995,23 @@ can_pray(boolean praying) /* false means no messages should be given */
return !praying ? (boolean) (g.p_type == 3 && !Inhell) : TRUE;
}
/* return TRUE if praying revived a pet corpse */
static boolean
pray_revive(void)
{
struct obj *otmp;
for (otmp = g.level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere)
if (otmp->otyp == CORPSE && has_omonst(otmp)
&& OMONST(otmp)->mtame && !OMONST(otmp)->isminion)
break;
if (!otmp)
return FALSE;
return (revive(otmp, TRUE) != NULL);
}
/* #pray commmand */
int
dopray(void)
@@ -2102,8 +2120,10 @@ prayer_done(void) /* M. Stephenson (1.0.3b) */
pleased(alignment);
} else {
/* coaligned */
if (on_altar())
if (on_altar()) {
(void) pray_revive();
(void) water_prayer(TRUE);
}
pleased(alignment); /* nice */
}
return 1;