git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2516 c06c8d41-db1a-0410-9941-cceddc491573
NVK2OISSU4XF2CGSK2BAWZE2OPCLTXYHNSE6UDJ5M54EHY2I7BLAC
bool monsters::wants_armour(const item_def &item) const
{
// FIXME: Need monster body-size handling. For now, never attempt to
// change armour.
return (!mslot_item(MSLOT_ARMOUR));
}
bool monsters::pickup_armour(item_def &item, int near, bool force)
{
ASSERT(item.base_type == OBJ_ARMOUR);
if (!force && !wants_armour(item))
return (false);
// XXX: Monsters can only equip body armour (as of 0.3).
if (get_armour_slot(item) != EQ_BODY_ARMOUR)
return (false);
// XXX: Very simplistic armour evaluation for the moment.
if (const item_def *existing_armour = slot_item(EQ_BODY_ARMOUR))
{
if (!force && existing_armour->armour_rating() >= item.armour_rating())
return (false);
if (!drop_item(MSLOT_ARMOUR, near))
return (false);
}
return pickup(item, MSLOT_ARMOUR, near);
}