diff --git a/src/do.c b/src/do.c index 37717f6b8..32b57f180 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 do.c $NHDT-Date: 1627516694 2021/07/28 23:58:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.270 $ */ +/* NetHack 3.7 do.c $NHDT-Date: 1646084773 2022/02/28 21:46:13 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.294 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1503,9 +1503,6 @@ goto_level( } mklev(); new = TRUE; /* made the level */ - livelog_printf(LL_DEBUG, "entered new level %d, %s", - dunlev(&u.uz), g.dungeons[u.uz.dnum].dname); - familiar = bones_include_name(g.plname); } else { /* returning to previously visited level; reload it */ @@ -1762,6 +1759,9 @@ goto_level( if (!In_quest(&u.uz0) && at_dgn_entrance("The Quest") && !(u.uevent.qcompleted || u.uevent.qexpelled || g.quest_status.leader_is_dead)) { + /* [TODO: copy of same TODO below; if an anchievement for + receiving quest call from leader gets added, that should + come after logging new level entry] */ if (!u.uevent.qcalled) { u.uevent.qcalled = 1; /* main "leader needs help" message */ @@ -1773,6 +1773,21 @@ goto_level( } } + /* this was originally done earlier; moved here to be logged after + any achievement related to entering a dungeon branch + [TODO: if an anchievement for receiving quest call from leader + gets added, that should come after this rather than take place + where the message is delivered above] */ + if (new) + /* FIXME: this shows level number relative to the start of the + branch (so "entered new level 3, Vlad's Tower" when going + into the first level of that branch); it should be changed + to show the level number that appears on the status lines; + also in the endgame it shows arbitrary level number instead + of elemental plane name */ + livelog_printf(LL_DEBUG, "entered new level %d, %s", + dunlev(&u.uz), g.dungeons[u.uz.dnum].dname); + assign_level(&u.uz0, &u.uz); /* reset u.uz0 */ #ifdef INSURANCE save_currentstate(); @@ -1798,6 +1813,7 @@ goto_level( } (void) pickup(1); + return; } RESTORE_WARNING_FORMAT_NONLITERAL diff --git a/src/end.c b/src/end.c index e45ac2a96..1236134c8 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 end.c $NHDT-Date: 1644524059 2022/02/10 20:14:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.235 $ */ +/* NetHack 3.7 end.c $NHDT-Date: 1646084789 2022/02/28 21:46:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.238 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1391,6 +1391,14 @@ really_done(int how) if (strcmp(flags.end_disclose, "none")) disclose(how, taken); + /* it would be better to do this after killer.name fixups but + that comes too late; end-of-game is classified as a "major + achievement" even if it happens to be ending in failure */ + formatkiller(pbuf, (unsigned) sizeof pbuf, how, TRUE); + if (!*pbuf) + Strcpy(pbuf, deaths[how]); + livelog_printf(LL_ACHIEVE, "%s", pbuf); + dump_everything(how, endtime); } @@ -1574,8 +1582,8 @@ really_done(int how) Strcat(pbuf, " "); } Sprintf(eos(pbuf), "%s with %ld point%s,", - how == ASCENDED ? "went to your reward" - : "escaped from the dungeon", + (how == ASCENDED) ? "went to your reward" + : "escaped from the dungeon", u.urexp, plur(u.urexp)); dump_forward_putstr(endwin, 0, pbuf, done_stopprint); @@ -1631,7 +1639,7 @@ really_done(int how) if (Is_astralevel(&u.uz)) where = "The Astral Plane"; Sprintf(pbuf, "You %s in %s", ends[how], where); - if (!In_endgame(&u.uz) && !Is_knox(&u.uz)) + if (!In_endgame(&u.uz) && !single_level_branch(&u.uz)) Sprintf(eos(pbuf), " on dungeon level %d", In_quest(&u.uz) ? dunlev(&u.uz) : depth(&u.uz)); } diff --git a/src/insight.c b/src/insight.c index 9624fb834..abc3bfd77 100644 --- a/src/insight.c +++ b/src/insight.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 insight.c $NHDT-Date: 1645298661 2022/02/19 19:24:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.49 $ */ +/* NetHack 3.7 insight.c $NHDT-Date: 1646084789 2022/02/28 21:46:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.52 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -64,7 +64,7 @@ static struct ll_achieve_msg achieve_msg [] = { { LL_ACHIEVE, "ascended" }, { LL_ACHIEVE, "acquired the Mines' End luckstone" }, { LL_ACHIEVE, "completed Sokoban" }, - { LL_ACHIEVE|LL_UMONST, "killed Medusa" }, + { LL_ACHIEVE | LL_UMONST, "killed Medusa" }, /* these two are not logged */ { 0, "hero was always blond, no, blind" }, { 0, "hero never wore armor" }, @@ -75,18 +75,21 @@ static struct ll_achieve_msg achieve_msg [] = { { LL_MINORAC, "entered a temple" }, { LL_ACHIEVE, "consulted the Oracle" }, /* minor, but rare enough */ { LL_ACHIEVE, "read a Discworld novel" }, /* ditto */ - { LL_ACHIEVE, "entered Sokoban" }, /* Keep as major for turn comparison w/completed soko */ + { LL_ACHIEVE, "entered Sokoban" }, /* keep as major for turn comparison + * with completed sokoban */ { LL_ACHIEVE, "entered the Bigroom" }, /* The following 8 are for advancing through the ranks - messages differ by role so are created on the fly */ - { LL_MINORAC, "" }, - { LL_MINORAC, "" }, - { LL_MINORAC, "" }, - { LL_MINORAC, "" }, - { LL_ACHIEVE, "" }, - { LL_ACHIEVE, "" }, - { LL_ACHIEVE, "" }, - { LL_ACHIEVE, "" }, + and messages differ by role so are created on the fly; + rank 0 (Xp 1 and 2) isn't an achievement */ + { LL_MINORAC, "" }, /* Xp 3 */ + { LL_MINORAC, "" }, /* Xp 6 */ + { LL_MINORAC, "" }, /* Xp 10 */ + { LL_ACHIEVE, "" }, /* Xp 14, so able to attempt the quest */ + { LL_ACHIEVE, "" }, /* Xp 18 */ + { LL_ACHIEVE, "" }, /* Xp 22 */ + { LL_ACHIEVE, "" }, /* Xp 26 */ + { LL_ACHIEVE, "" }, /* Xp 30 */ + { LL_MINORAC, "learned castle drawbridge's tune" }, { 0, "" } /* keep this one at the end */ }; @@ -2280,12 +2283,16 @@ record_achievement(schar achidx) an attempt to duplicate an achievement can happen if any of Bell, Candelabrum, Book, or Amulet is dropped then picked up again */ for (i = 0; u.uachieved[i]; ++i) - if (abs(u.uachieved[i]) == abs(achidx)) + if (abs(u.uachieved[i]) == absidx) return; /* already recorded, don't duplicate it */ u.uachieved[i] = achidx; + /* avoid livelog for achievements recorded during final disclosure: + nudist and blind-from-birth; also ascension which is suppressed + by this gets logged separately in really_done() */ if (g.program_state.gameover) - return; /* don't livelog achievements recorded at end of game */ + return; + if (absidx >= ACH_RNK1 && absidx <= ACH_RNK8) { livelog_printf(achieve_msg[absidx].llflag, "attained the rank of %s (level %d)",