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 dogmove.c $NHDT-Date: 1645311270 2022/02/19 22:54:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.108 $ */
/* NetHack 3.7 dogmove.c $NHDT-Date: 1646652766 2022/03/07 11:32:46 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.111 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -464,9 +464,17 @@ dog_invent(struct monst *mtmp, struct edog *edog, int udist)
otmp = obj;
if (carryamt != obj->quan)
otmp = splitobj(obj, carryamt);
if (cansee(omx, omy) && flags.verbose)
pline("%s picks up %s.", Monnam(mtmp),
distant_name(otmp, doname));
if (cansee(omx, omy)) {
if (otmp->oartifact) {
otmp->dknown = 1; /* see mpickstuff() */
find_artifact(otmp);
}
if (flags.verbose)
pline("%s picks up %s.", Monnam(mtmp),
((distu(omx, omy) <= 5)
? doname(otmp)
: distant_name(otmp, doname)));
}
obj_extract_self(otmp);
newsym(omx, omy);
(void) mpickobj(mtmp, otmp);