fix github issue #1072 - pets pick up cursed items
Issue reported by vultur-cadens: tame monsters capable of using items
would pick up cursed ones and even wear cursed armor.
The report cites commit 6c9700ab25 but
I don't see any reason why it would be the cause. However, I was able
to reproduce the misbehavior and this commit seems to fix it.
Fixes #1072
This commit is contained in:
@@ -1644,6 +1644,7 @@ hero might not be credited with "entered Mine Town" achievement for the town
|
|||||||
entered via falling or level teleport
|
entered via falling or level teleport
|
||||||
in the theme room "water-surrounded vault", guarantee an item which can be
|
in the theme room "water-surrounded vault", guarantee an item which can be
|
||||||
be used to escape from the room in one of the four chests
|
be used to escape from the room in one of the four chests
|
||||||
|
pets capable of using items would pick up and wear cursed armor
|
||||||
|
|
||||||
|
|
||||||
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository
|
Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository
|
||||||
|
|||||||
@@ -885,6 +885,8 @@ mon_would_take_item(struct monst *mtmp, struct obj *otmp)
|
|||||||
|
|
||||||
if (otmp == uball || otmp == uchain)
|
if (otmp == uball || otmp == uchain)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
if (mtmp->mtame && otmp->cursed)
|
||||||
|
return FALSE; /* note: will get overridden if mtmp will eat otmp */
|
||||||
if (is_unicorn(mtmp->data) && objects[otmp->otyp].oc_material != GEMSTONE)
|
if (is_unicorn(mtmp->data) && objects[otmp->otyp].oc_material != GEMSTONE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!mindless(mtmp->data) && !is_animal(mtmp->data) && pctload < 75
|
if (!mindless(mtmp->data) && !is_animal(mtmp->data) && pctload < 75
|
||||||
@@ -916,10 +918,17 @@ mon_would_take_item(struct monst *mtmp, struct obj *otmp)
|
|||||||
boolean
|
boolean
|
||||||
mon_would_consume_item(struct monst *mtmp, struct obj *otmp)
|
mon_would_consume_item(struct monst *mtmp, struct obj *otmp)
|
||||||
{
|
{
|
||||||
|
int ftyp;
|
||||||
|
|
||||||
if (otmp->otyp == CORPSE && !touch_petrifies(&mons[otmp->corpsenm])
|
if (otmp->otyp == CORPSE && !touch_petrifies(&mons[otmp->corpsenm])
|
||||||
&& corpse_eater(mtmp->data))
|
&& corpse_eater(mtmp->data))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
if (mtmp->mtame && has_edog(mtmp) /* has_edog(): not guardian angel */
|
||||||
|
&& (ftyp = dogfood(mtmp, otmp)) < MANFOOD
|
||||||
|
&& (ftyp < ACCFOOD || EDOG(mtmp)->hungrytime <= gm.moves))
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1148,7 +1157,11 @@ maybe_spin_web(struct monst *mtmp)
|
|||||||
|
|
||||||
/* monster looks for items it wants nearby */
|
/* monster looks for items it wants nearby */
|
||||||
static boolean
|
static boolean
|
||||||
m_search_items(struct monst *mtmp, coordxy *ggx, coordxy *ggy, schar *mmoved, int *appr)
|
m_search_items(
|
||||||
|
struct monst *mtmp,
|
||||||
|
coordxy *ggx, coordxy *ggy,
|
||||||
|
schar *mmoved,
|
||||||
|
int *appr)
|
||||||
{
|
{
|
||||||
register int minr = SQSRCHRADIUS; /* not too far away */
|
register int minr = SQSRCHRADIUS; /* not too far away */
|
||||||
register struct obj *otmp;
|
register struct obj *otmp;
|
||||||
@@ -1802,8 +1815,10 @@ m_move(register struct monst *mtmp, int after)
|
|||||||
u.ux = mtmp->mx;
|
u.ux = mtmp->mx;
|
||||||
u.uy = mtmp->my;
|
u.uy = mtmp->my;
|
||||||
swallowed(0);
|
swallowed(0);
|
||||||
} else
|
} else {
|
||||||
newsym(mtmp->mx, mtmp->my);
|
newsym(mtmp->mx, mtmp->my);
|
||||||
|
}
|
||||||
|
#undef UnblockDoor
|
||||||
}
|
}
|
||||||
if (OBJ_AT(mtmp->mx, mtmp->my) && mtmp->mcanmove) {
|
if (OBJ_AT(mtmp->mx, mtmp->my) && mtmp->mcanmove) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user