livelog event for finding artifacts

Log artifacts found on the floor, or carried by monsters if hero sees
those monsters do something with them.  Shown to player via #chronicle
and included in dumplog.

For most cases, finding is based on having the artifact object be
formatted for display.  So walking across one won't notice it if pile
size inhibits showing items at its location, even if the artifact is
on top.  Taking stuff out of a container won't notice an artifact if a
subset of the contents chosen by class or BUCX filter doesn't include
it unless player has used ':' to look inside.  Seeing an artifact be
picked up by a monster (even if the monster itself is unseen) or being
dropped (possibly upon death) will find an artifact even if beyond the
normal range of having it be treated as seen up close.  Random treasure
drop items are excluded since they are placed directly on the floor
rather than going into a dying monster's inventory and then dropped
with its other stuff.
This commit is contained in:
PatR
2022-03-07 03:33:01 -08:00
parent d37fa4138a
commit f65e652e2e
7 changed files with 106 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mon.c $NHDT-Date: 1646184187 2022/03/02 01:23:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.412 $ */
/* NetHack 3.7 mon.c $NHDT-Date: 1646652768 2022/03/07 11:32:48 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.414 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1553,6 +1553,18 @@ mpickstuff(struct monst *mtmp, const char *str)
otmp3 = splitobj(otmp, carryamt);
}
if (cansee(mtmp->mx, mtmp->my)) {
/* find an artifact as monster picks it up if its location
can be seen, even if monster itself can't be seen or
is far away at the time; the longer distance than for
seeing item "up close" is mostly for pets rummaging in
shops; we prefer to have an artifact in such situation
described as 'found in a shop' or 'found on floor' now
rather than 'carried by a monster' when later dropped */
if (otmp3->oartifact) {
otmp3->dknown = 1;
find_artifact(otmp3);
}
if (flags.verbose)
/* see 'otmp3' "up close" if within a knight's jump */
pline("%s picks up %s.", Monnam(mtmp),