fix #K3997 - livelog feedback for high priests

If you killed a second high priest (either two on Astral or first in
the Sanctum and another on Astral) the livelog/#chronicle message
would report "killed high priest of Foo (2nd time)" even though the
first was the high priest of Bar, or even just "killed high priest
(2nd time)" if second kill happened when not adjacent.

High priests pass the 'unique monster' test (even though they aren't
actually unique--there will be four of them) so get logged for killing
such.  Always report "killed high priest of Foo" and only do so if the
specific high priest[ess] monster hasn't been revived and re-killed.

Logging deaths of unique monsters normally reports the 1st, 2nd, 3rd,
5th, 10th, and various later instances.  If you were to kill Moloch's
high priest and all three on Astral, the last one wouldn't be logged
because 4th instance gets skipped.  This forces each one to be treated
as the 1st (provided that the mrevived flag is clear), so for logging
purposes it will now behave as if there are 4 distinct high priests.
This commit is contained in:
PatR
2023-08-29 00:02:19 -07:00
parent 06a3bd0424
commit 05a99064b6
5 changed files with 23 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 do_name.c $NHDT-Date: 1672605786 2023/01/01 20:43:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.280 $ */
/* NetHack 3.7 do_name.c $NHDT-Date: 1693292527 2023/08/29 07:02:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.289 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1973,21 +1973,15 @@ x_monnam(
EHalluc_resistance = 1L;
if (!do_invis)
mtmp->minvis = 0;
name = priestname(mtmp, article, buf2);
/* EXACT_NAME will force "of <deity>" on the Astral Plane */
name = priestname(mtmp, article,
((suppress & EXACT_NAME) == EXACT_NAME), buf2);
EHalluc_resistance = save_prop;
mtmp->minvis = save_invis;
if (article == ARTICLE_NONE && !strncmp(name, "the ", 4))
name += 4;
return strcpy(buf, name);
}
#if 0 /* [now handled by mon_pmname()] */
/* an "aligned priest" not flagged as a priest or minion should be
"priest" or "priestess" (normally handled by priestname()) */
if (mdat == &mons[PM_ALIGNED_CLERIC])
pm_name = mtmp->female ? "priestess" : "priest";
else if (mdat == &mons[PM_HIGH_CLERIC] && mtmp->female)
pm_name = "high priestess";
#endif
/* Shopkeepers: use shopkeeper name. For normal shopkeepers, just
* "Asidonhopo"; for unusual ones, "Asidonhopo the invisible

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mon.c $NHDT-Date: 1691877848 2023/08/12 22:04:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.514 $ */
/* NetHack 3.7 mon.c $NHDT-Date: 1693292534 2023/08/29 07:02:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.517 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2690,8 +2690,7 @@ RESTORE_WARNING_FORMAT_NONLITERAL
/* specific combination of x_monnam flags for livelogging; show what was
actually killed even when unseen or hallucinated to be something else */
#define livelog_mon_nam(mtmp) \
x_monnam(mtmp, ARTICLE_THE, (char *) 0, \
(SUPPRESS_IT | SUPPRESS_HALLUCINATION), FALSE)
x_monnam(mtmp, ARTICLE_THE, (char *) 0, EXACT_NAME, FALSE)
/* when a mon has died, maybe record an achievement or issue livelog message;
moved into separate routine to unclutter mondead() */
@@ -2702,7 +2701,8 @@ logdeadmon(struct monst *mtmp, int mndx)
if (mndx == PM_MEDUSA && howmany == 1) {
record_achievement(ACH_MEDU); /* also generates a livelog event */
} else if (unique_corpstat(mtmp->data)
} else if ((unique_corpstat(mtmp->data)
&& (mndx != PM_HIGH_CLERIC || !mtmp->mrevived))
|| (mtmp->isshk && !mtmp->mrevived)) {
char shkdetail[QBUFSZ];
const char *mkilled;
@@ -2728,6 +2728,11 @@ logdeadmon(struct monst *mtmp, int mndx)
/* in case shk name doesn't include Mr or Ms honoric */
mtmp->female ? "proprietrix" : "proprietor",
herodidit ? "" : ",");
} else if (mndx == PM_HIGH_CLERIC) {
/* the high priest[ess] monster is not unique; we know that
this is the first death for this particular high priest
(because of the !mtmp->mrevived test above) */
howmany = 1;
}
/* killing a unique more than once doesn't get logged every time;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 priest.c $NHDT-Date: 1624322670 2021/06/22 00:44:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.70 $ */
/* NetHack 3.7 priest.c $NHDT-Date: 1693292537 2023/08/29 07:02:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.93 $ */
/* Copyright (c) Izchak Miller, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -301,6 +301,7 @@ char *
priestname(
struct monst *mon,
int article,
boolean reveal_high_priest,
char *pname) /* caller-supplied output buffer */
{
boolean do_hallu = Hallucination,
@@ -361,7 +362,8 @@ priestname(
Strcat(pname, what);
/* same as distant_monnam(), more or less... */
if (do_hallu || !high_priest || !Is_astralevel(&u.uz)
if (do_hallu || !high_priest || reveal_high_priest
|| !Is_astralevel(&u.uz)
|| next2u(mon->mx, mon->my) || gp.program_state.gameover) {
Strcat(pname, " of ");
Strcat(pname, halu_gname(mon_aligntyp(mon)));