Allow monsters to rummage through containers
This commit is contained in:
@@ -140,6 +140,7 @@ when 'color' if Off and 'use_inverse' is On, draw ice on the map in inverse
|
|||||||
new 'mention_decor' option; when On, describe dungeon features being stepped
|
new 'mention_decor' option; when On, describe dungeon features being stepped
|
||||||
on or floated/flown over even when they're not covered by objects
|
on or floated/flown over even when they're not covered by objects
|
||||||
applying royal jelly on an egg kills, revives, or changes the egg
|
applying royal jelly on an egg kills, revives, or changes the egg
|
||||||
|
intelligent monsters pick up and rummage through containers
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific New Features
|
Platform- and/or Interface-Specific New Features
|
||||||
|
|||||||
33
src/muse.c
33
src/muse.c
@@ -1614,6 +1614,7 @@ struct monst *mtmp;
|
|||||||
#define MUSE_WAN_SPEED_MONSTER 7
|
#define MUSE_WAN_SPEED_MONSTER 7
|
||||||
#define MUSE_BULLWHIP 8
|
#define MUSE_BULLWHIP 8
|
||||||
#define MUSE_POT_POLYMORPH 9
|
#define MUSE_POT_POLYMORPH 9
|
||||||
|
#define MUSE_BAG 10
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
find_misc(mtmp)
|
find_misc(mtmp)
|
||||||
@@ -1738,6 +1739,13 @@ struct monst *mtmp;
|
|||||||
g.m.misc = obj;
|
g.m.misc = obj;
|
||||||
g.m.has_misc = MUSE_POT_POLYMORPH;
|
g.m.has_misc = MUSE_POT_POLYMORPH;
|
||||||
}
|
}
|
||||||
|
nomore(MUSE_BAG);
|
||||||
|
if (Is_container(obj) && obj->otyp != BAG_OF_TRICKS && !rn2(5)
|
||||||
|
&& !g.m.has_misc && Has_contents(obj)
|
||||||
|
&& !obj->olocked && !obj->otrapped) {
|
||||||
|
g.m.misc = obj;
|
||||||
|
g.m.has_misc = MUSE_BAG;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (boolean) !!g.m.has_misc;
|
return (boolean) !!g.m.has_misc;
|
||||||
#undef nomore
|
#undef nomore
|
||||||
@@ -1875,6 +1883,29 @@ struct monst *mtmp;
|
|||||||
makeknown(POT_POLYMORPH);
|
makeknown(POT_POLYMORPH);
|
||||||
m_useup(mtmp, otmp);
|
m_useup(mtmp, otmp);
|
||||||
return 2;
|
return 2;
|
||||||
|
case MUSE_BAG:
|
||||||
|
{
|
||||||
|
struct obj *xobj;
|
||||||
|
long count = 1;
|
||||||
|
|
||||||
|
/* FIXME: handle cursed bag of holding */
|
||||||
|
if (Is_mbag(otmp) && otmp->cursed)
|
||||||
|
return 0;
|
||||||
|
if (!Has_contents(otmp) || otmp->olocked)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (xobj = otmp->cobj; xobj; xobj = xobj->nobj) count++;
|
||||||
|
count = rn2(count);
|
||||||
|
for (xobj = otmp->cobj; xobj && count; xobj = xobj->nobj) count--;
|
||||||
|
if (xobj && can_carry(mtmp, xobj)) {
|
||||||
|
if (vismon)
|
||||||
|
pline("%s rummages through something.", Monnam(mtmp));
|
||||||
|
obj_extract_self(xobj);
|
||||||
|
(void) mpickobj(mtmp, xobj);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
case MUSE_POLY_TRAP:
|
case MUSE_POLY_TRAP:
|
||||||
if (vismon) {
|
if (vismon) {
|
||||||
const char *Mnam = Monnam(mtmp);
|
const char *Mnam = Monnam(mtmp);
|
||||||
@@ -2087,6 +2118,8 @@ struct obj *obj;
|
|||||||
return (boolean) (!obj->cursed && !is_unicorn(mon->data));
|
return (boolean) (!obj->cursed && !is_unicorn(mon->data));
|
||||||
if (typ == FROST_HORN || typ == FIRE_HORN)
|
if (typ == FROST_HORN || typ == FIRE_HORN)
|
||||||
return (obj->spe > 0 && can_blow(mon));
|
return (obj->spe > 0 && can_blow(mon));
|
||||||
|
if (Is_container(obj) && !(Is_mbag(obj) && obj->cursed))
|
||||||
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
case FOOD_CLASS:
|
case FOOD_CLASS:
|
||||||
if (typ == CORPSE)
|
if (typ == CORPSE)
|
||||||
|
|||||||
Reference in New Issue
Block a user