From 05a99064b667619f862331fe243f255bffdb3a20 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 29 Aug 2023 00:02:19 -0700 Subject: [PATCH] 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. --- doc/fixes3-7-0.txt | 5 ++++- include/extern.h | 4 ++-- src/do_name.c | 14 ++++---------- src/mon.c | 13 +++++++++---- src/priest.c | 6 ++++-- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index fd32f5962..4c4221a88 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1222 $ $NHDT-Date: 1689448843 2023/07/15 19:20:43 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1233 $ $NHDT-Date: 1693292518 2023/08/29 07:01:58 $ General Fixes and Modified Features ----------------------------------- @@ -1661,6 +1661,9 @@ if something breakable was set up as alternate weapon and the second of two strength cap for hero poly'd into an orc captain was 18/50 even though it is 10/100 for Uruk-Hai and monster Uruk-Hai can grow into orc captains status_hilite rule for critical-hp takes precedence over up/down/changed HP +livelog/#chronicle of multiple high priests reported their deaths as + "killed high priest" and "killed high priest (2nd time)" instead of + "killed high priest of Foo" and "killed high priest of Bar" Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index 14a48f6a1..2ec3a6a3c 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 extern.h $NHDT-Date: 1689629242 2023/07/17 21:27:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1279 $ */ +/* NetHack 3.7 extern.h $NHDT-Date: 1693292519 2023/08/29 07:01:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1282 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2292,7 +2292,7 @@ extern boolean inhistemple(struct monst *); extern int pri_move(struct monst *); extern void priestini(d_level *, struct mkroom *, int, int, boolean); extern aligntyp mon_aligntyp(struct monst *); -extern char *priestname(struct monst *, int, char *); +extern char *priestname(struct monst *, int, boolean, char *); extern boolean p_coaligned(struct monst *); extern struct monst *findpriest(char); extern void intemple(int); diff --git a/src/do_name.c b/src/do_name.c index 9ddf98019..8d7b667aa 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -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 " 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 diff --git a/src/mon.c b/src/mon.c index f4c98afb7..980060cf1 100644 --- a/src/mon.c +++ b/src/mon.c @@ -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; diff --git a/src/priest.c b/src/priest.c index 00779be5c..a7ac5573a 100644 --- a/src/priest.c +++ b/src/priest.c @@ -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)));