Stop monsters from interacting with protected items on the floor

This fixes the issue of chests with the wand of wishing on the castle level
being stolen by soldiers.

Commit b12ea03d1 revealed that searches_for_item() didn't check for onscary()
and allowed monsters to pick up items even though they were protected by a
scroll of scare monsters.
This commit is contained in:
Patric Mueller
2020-02-17 10:27:38 +01:00
parent 3981e3e6e5
commit 4b270099ec

View File

@@ -2174,6 +2174,13 @@ struct obj *obj;
{
int typ = obj->otyp;
/* don't let monsters interact with protected items on the floor */
if ((obj->where == OBJ_FLOOR)
&& (obj->ox == mon->mx) && (obj->oy == mon->my)
&& onscary(obj->ox, obj->oy, mon)) {
return FALSE;
}
if (is_animal(mon->data) || mindless(mon->data)
|| mon->data == &mons[PM_GHOST]) /* don't loot bones piles */
return FALSE;