fix #Q404 - monster wielding cursed corpse
From a bug report, applying a bullwhip towards a monster to try to steal its weapon would report that a cursed cockatrice corpse was welded to the monster's hands even though corpses wielded by the player never become welded. Code for monsters deciding what to wield knew that corpses don't weld; everywhere else seems to assume that they only wield weldable weapons. Add a routine to check whether a wielded item is welded, similar to what's done for the hero. I fixed a couple of other spots besides use_whip() but didn't hunt all over.
This commit is contained in:
@@ -2210,19 +2210,21 @@ mcould_eat_tin(mon)
|
||||
struct monst *mon;
|
||||
{
|
||||
struct obj *obj, *mwep;
|
||||
boolean welded_wep;
|
||||
|
||||
/* monkeys who manage to steal tins can't open and eat them
|
||||
even if they happen to also have the appropriate tool */
|
||||
if (is_animal(mon->data)) return FALSE;
|
||||
|
||||
mwep = MON_WEP(mon);
|
||||
welded_wep = mwep && mwelded(mwep);
|
||||
/* this is different from the player; tin opener or dagger doesn't
|
||||
have to be wielded, and knife can be used instead of dagger
|
||||
(even so, non-nymphs don't pick up tins, so only nymphs might
|
||||
end up being able to benefit from them) */
|
||||
for (obj = mon->minvent; obj; obj = obj->nobj) {
|
||||
/* if stuck with a cursed weapon, don't check rest of inventory */
|
||||
if (mwep && mwep->cursed && obj != mwep) continue;
|
||||
if (welded_wep && obj != mwep) continue;
|
||||
|
||||
if (obj->otyp == TIN_OPENER ||
|
||||
(obj->oclass == WEAPON_CLASS &&
|
||||
|
||||
Reference in New Issue
Block a user