fix github issue #493 - hero item knowledge

Issue was about being asked what to call a previously seen potion
which has been picked up and thrown by an unseen monster.  Hero
shouldn't remember what the item description was.  This is a much
more general change than just fixing that.  Any item picked up by
an unseen non-tame monster will have all its *known flags cleared
since the hero can't see what that monster does to it.  Same if an
item is picked up while seen but then used when unseen.

Unseen pets are excluded from the pick up case--but not the use
case--because they pick up and drop stuff continually and players
would just slaughter them if they caused item information to be
forgotten.

Fixes #493
This commit is contained in:
PatR
2021-05-06 12:36:32 -07:00
parent 86120d4574
commit ad7f2afef9
6 changed files with 40 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 invent.c $NHDT-Date: 1615794750 2021/03/15 07:52:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.324 $ */
/* NetHack 3.7 invent.c $NHDT-Date: 1620329776 2021/05/06 19:36:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.330 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2150,6 +2150,19 @@ askchain(struct obj **objchn, /* *objchn might change */
return cnt;
}
/* hero is losing access to previously known info about an object
(called when an unseen monster picks up or uses the object) */
void
unknow_object(struct obj *obj)
{
obj->dknown = 0;
obj->bknown = obj->rknown = 0;
obj->cknown = obj->lknown = 0;
/* awareness of charges or enchantment has gone poof... */
if (objects[obj->otyp].oc_uses_known)
obj->known = 0;
}
/*
* Object identification routines:
*/