livelog tweaks, mostly sokoban

Demote "completed sokoban {1,2,3,4}" from major achievement to minor
at the request of hardfought.  OR on the 'dump' flag so that those
entries appear in dumplog.

Change "completed Sokoban" (for the whole branch) to "acquired the
Sokoban <prize object>" since that's what triggers the event and it
is possible to pass through the first level without completing that.
This event is still classified as a major achievement.  It has has
the 'spoiler' flag added to prevent #chronicle from showing that event
which now discloses the type of item the prize is.  (Note: suppression
of spoiler events is ignored in wizard mode.)

The "attained rank N" achievements are classified as minor for ranks
1..3 (gaining levels 3, 6, 10); OR the 'dump' flag for those.  [Rank 0
for levels 1 and 2 isn't an achievement and 4..8 for Xp levels 14, 18,
22, 26, and 30 are classified as 'major' achievements so don't need
that flag to make it into dumplog.]
This commit is contained in:
PatR
2022-03-04 13:07:14 -08:00
parent 7a1db1d0bd
commit 5327412566
4 changed files with 38 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 context.h $NHDT-Date: 1596498530 2020/08/03 23:48:50 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.41 $ */
/* NetHack 3.7 context.h $NHDT-Date: 1646428003 2022/03/04 21:06:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.45 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -116,10 +116,14 @@ struct novel_tracking { /* for choosing random passage when reading novel */
};
struct achievement_tracking {
unsigned mines_prize_oid, /* luckstone->o_id */
soko_prize_oid, /* {bag or amulet}->o_id */
castle_prize_old; /* wand->o_id; not yet implemented */
boolean minetn_reached; /* avoid redundant checking for town entry */
unsigned mines_prize_oid, /* luckstone->o_id */
soko_prize_oid, /* {bag or amulet}->o_id */
castle_prize_old; /* wand->o_id; not yet implemented */
/* record_achievement() wants the item type for livelog() event */
short mines_prize_otyp, /* luckstone */
soko_prize_otyp, /* bag of holding or amulet of reflection */
castle_prize_otyp; /* strange object (someday wand of wishing) */
boolean minetn_reached; /* avoid redundant checking for town entry */
};
struct context_info {

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 insight.c $NHDT-Date: 1646322468 2022/03/03 15:47:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.55 $ */
/* NetHack 3.7 insight.c $NHDT-Date: 1646428012 2022/03/04 21:06:52 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.56 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -62,30 +62,32 @@ static struct ll_achieve_msg achieve_msg [] = {
{ LL_ACHIEVE, "entered the Elemental Planes" },
{ LL_ACHIEVE, "entered the Astral Plane" },
{ LL_ACHIEVE, "ascended" },
{ LL_ACHIEVE | LL_SPOILER, "acquired the Mines' End luckstone" },
{ LL_ACHIEVE, "completed Sokoban" }, /* actually, acquired the prize item
* which doesn't necessarily mean all
* four levels have been solved */
/* if the type of item isn't discovered yet, disclosing the event
via #chronicle would be a spoiler (particularly for gray stone);
the ID'd name for the type of item will be appended to the next
two messages, for display via livelog and/or dumplog */
{ LL_ACHIEVE | LL_SPOILER, "acquired the Mines' End" }, /* " luckstone" */
{ LL_ACHIEVE | LL_SPOILER, "acquired the Sokoban" }, /* " <item>" */
{ LL_ACHIEVE | LL_UMONST, "killed Medusa" },
/* these two are not logged */
{ 0, "hero was always blond, no, blind" },
{ 0, "hero never wore armor" },
/* */
{ LL_MINORAC, "entered the Gnomish Mines" },
{ LL_MINORAC | LL_DUMP, "entered the Gnomish Mines" },
{ LL_ACHIEVE, "reached Mine Town" }, /* probably minor, but dnh logs it */
{ LL_MINORAC, "entered a shop" },
{ LL_MINORAC, "entered a temple" },
{ LL_ACHIEVE, "consulted the Oracle" }, /* minor, but rare enough */
{ LL_ACHIEVE, "read a Discworld novel" }, /* ditto */
{ LL_MINORAC | LL_DUMP, "read a Discworld novel" }, /* even more so */
{ 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
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_MINORAC | LL_DUMP, "" }, /* Xp 3 */
{ LL_MINORAC | LL_DUMP, "" }, /* Xp 6 */
{ LL_MINORAC | LL_DUMP, "" }, /* Xp 10 */
{ LL_ACHIEVE, "" }, /* Xp 14, so able to attempt the quest */
{ LL_ACHIEVE, "" }, /* Xp 18 */
{ LL_ACHIEVE, "" }, /* Xp 22 */
@@ -2302,9 +2304,19 @@ record_achievement(schar achidx)
rank_of(rank_to_xlev(absidx - (ACH_RNK1 - 1)),
Role_switch, (achidx < 0) ? TRUE : FALSE),
u.ulevel);
} else
} else if (achidx == ACH_SOKO_PRIZE
|| achidx == ACH_MINE_PRIZE) {
/* need to supply extra information for these two */
short otyp = ((achidx == ACH_SOKO_PRIZE)
? g.context.achieveo.soko_prize_otyp
: g.context.achieveo.mines_prize_otyp);
livelog_printf(achieve_msg[achidx].llflag, "%s %s",
achieve_msg[achidx].msg, OBJ_NAME(objects[otyp]));
} else {
livelog_printf(achieve_msg[absidx].llflag, "%s",
achieve_msg[absidx].msg);
}
}
/* discard a recorded achievement; return True if removed, False otherwise */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 sp_lev.c $NHDT-Date: 1646171627 2022/03/01 21:53:47 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.257 $ */
/* NetHack 3.7 sp_lev.c $NHDT-Date: 1646428015 2022/03/04 21:06:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.259 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -2276,6 +2276,7 @@ create_object(object* o, struct mkroom* croom)
if (Is_mineend_level(&u.uz)) {
if (!g.context.achieveo.mines_prize_oid) {
g.context.achieveo.mines_prize_oid = otmp->o_id;
g.context.achieveo.mines_prize_otyp = otmp->otyp;
/* prevent stacking; cleared when achievement is recorded */
otmp->nomerge = 1;
} else {
@@ -2284,6 +2285,7 @@ create_object(object* o, struct mkroom* croom)
} else if (Is_sokoend_level(&u.uz)) {
if (!g.context.achieveo.soko_prize_oid) {
g.context.achieveo.soko_prize_oid = otmp->o_id;
g.context.achieveo.soko_prize_otyp = otmp->otyp;
otmp->nomerge = 1; /* redundant; Sokoban prizes don't stack */
} else {
impossible(prize_warning, "sokoban end");

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 trap.c $NHDT-Date: 1646175653 2022/03/01 23:00:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.455 $ */
/* NetHack 3.7 trap.c $NHDT-Date: 1646428017 2022/03/04 21:06:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.459 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -6029,7 +6029,8 @@ maybe_finish_sokoban(void)
/* log the completion event regardless of whether or not
any normal in-game feedback has just been given */
livelog_printf(LL_ACHIEVE, "completed sokoban %d", sokonum);
livelog_printf(LL_MINORAC | LL_DUMP, "completed sokoban %d",
sokonum);
}
}
}