as a restriction for missile pickup.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9707 c06c8d41-db1a-0410-9941-cceddc491573
ORZ4ZAHPUVIWAI6UODCKDS3TB4U4Y6GL3TYSNL3ALNBERG3K4UHQC UUY534OLJRLTQDHHEP2UAMDCPEFFL4BW63AWB5WZWCEYSAXPE6RAC UQ4P6W76CTKR2MQNH3EWPS4QPDXE3YRLJRR6744ZJJ32XKYPXQQQC W424WG7JEQN344GQAXTTPLLNYVQJZQJ5X4MLA4ACEVJYV6ECR45AC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC CHO4U5JC3RNTLXVIDXXJYZMOBZJ4VXW2GVJWDOTBRKK3AJ36LDLQC DDU4A3JGN5IUIPP5IASOODKPR2WBHSDSV4FITZ6HNXNSXXQACWAQC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC S4W5EBZLFX3HA3JNR524LF5RJ7PAPMSMN3FVRZNLQZY4QNEILGLQC RBAGQ2PB7V5YAM5KSHSZR2E3MLKDSRVM5XYGI2TIXP5QMVBOQHDQC QS3ZRS3E6KL3YJHPKYEWCWJYRBJSXD5OOYF6Y25HZVECGPJRDB5QC NVSFIV2ZKP44XHCSCXG6OZVGL67OIFINC34J2EMKTA4KULCERUEAC S34LKQDIQJLIWVIPASOJBBZ6ZCXDHP5KPS7TRBZJSCDRVNCLK6UAC RKFHYYANUZQHOWOE6YHVFFJNCZU7X67FWUQPQFF6KJKMNIKXFWEAC TRWPSFTO32PTSWMTZ476HJER6NTJIFRRMDSKHLJ7JLDRIOVQL6BAC JW5LVDYDDQMYLQLEB4WS7V3CV7FTHW7PSADCNY5JOJW4ZR34X6GQC Y2NYY7HWFZ2LQDK3ACSLGS37F2J2IJ5LRGCIMZYXLEOSVPD3A4DAC OWERGKLVPNPGIIS23FZ7ZDOBWUIXCKYAFG3URXU75JAUDX3N5ENAC GRSLMD5WMJD2WEKMYORL5K5FBA6QT3QIO4FNQQYD5XFFCD3EOL3QC LFBNFE3PZBXTR2ROPKYPARUWLJAYWAKGTS7VBWADZWVVSJ5CLX6AC HAM54HXIO2245W6REO4RZDY2QMIH476AWWJSMYAMSYYNEBBJSHWAC R3ZUGT5VJ2DG5NFPG4RBWDWTULDE7L4REYSGVPHJPDXFG6OBIXYAC VCQYSNAWZZHOZMARWQ4AJBDNFSS7T7CZBQISSPZ2YIIK5PVAWPRQC switch (monspell){case SPELL_SUMMON_DEMON:case SPELL_SUMMON_GREATER_DEMON:case SPELL_SUMMON_UNDEAD:case SPELL_SUMMON_UFETUBUS:case SPELL_SUMMON_HORRIBLE_THINGS:case SPELL_SUMMON_DRAKES:case SPELL_SUMMON_MUSHROOMS:case SPELL_SUMMON_ICE_BEAST:
if (monspell == SPELL_SMITING || spell_typematch(monspell, SPTYP_SUMMONING))
// Prevent monsters that have conjurations / summonings from// grabbing missiles.if (has_spell_of_type(SPTYP_CONJURATION | SPTYP_SUMMONING))
// Prevent monsters that have conjurations from grabbing missiles.if (has_spell_of_type(SPTYP_CONJURATION))return (false);// Same for summonings, but make an exception for friendlies.if (!mons_friendly(this) && has_spell_of_type(SPTYP_SUMMONING))
}// We don't want monsters to pick up ammunition that cancels out with// the launcher brand or that is identical to the launcher brand,// the latter in hope of another monster wandering by who may want to// use the ammo in question.static bool _compatible_launcher_ammo_brands(item_def *launcher,const item_def *ammo){const int bow_brand = get_weapon_brand(*launcher);const int ammo_brand = get_ammo_brand(*ammo);switch (ammo_brand){case SPMSL_FLAME:case SPMSL_FROST:return (bow_brand != SPWPN_FLAME && bow_brand != SPWPN_FROST);case SPMSL_CHAOS:return (bow_brand != SPWPN_CHAOS);default:return (true);}
return (fires_ammo_type(*elaunch) == mt&& mons_weapon_damage_rating(*elaunch) < mdam_rating
return ((fires_ammo_type(*elaunch) == mt || !missiles())&& (mons_weapon_damage_rating(*elaunch) < mdam_rating|| mons_weapon_damage_rating(*elaunch) == mdam_rating&& get_weapon_brand(*elaunch) == SPWPN_NORMAL&& get_weapon_brand(launch) != SPWPN_NORMAL&& _compatible_launcher_ammo_brands(&launch,missiles()))
}static int _ego_damage_bonus(item_def &item){switch (get_weapon_brand(item)){case SPWPN_NORMAL: return 0;case SPWPN_PROTECTION: return 1;default: return 2;case SPWPN_VORPAL: return 3;}}static bool _item_race_matches_monster(const item_def &item, monsters *mons){return (get_equip_race(item) == ISFLAG_ELVEN&& mons_genus(mons->type) == MONS_ELF|| get_equip_race(item) == ISFLAG_ORCISH&& mons_genus(mons->type) == MONS_ORC);
if (mons_weapon_damage_rating(*weap) < mdam_rating&& !weap->cursed())
const int old_wpn_dam = mons_weapon_damage_rating(*weap)+ _ego_damage_bonus(*weap);bool new_wpn_better = (new_wpn_dam > old_wpn_dam);if (new_wpn_dam == old_wpn_dam){// Use shopping value as a crude estimate of resistances etc.// XXX: This is not really logical as many properties don't// apply to monsters (e.g. levitation, blink, berserk).// For simplicity, don't apply this check to secondary weapons// for dual wielding monsters.int oldval = item_value(*weap, true);int newval = item_value(item, true);// Vastly prefer matching racial type.if (_item_race_matches_monster(*weap, this))oldval *= 2;if (_item_race_matches_monster(item, this))newval *= 2;if (newval > oldval)new_wpn_better = true;}if (new_wpn_better && !weap->cursed())
static bool _item_race_matches_monster(const item_def &item, monsters *mons){return (get_equip_race(item) == ISFLAG_ELVEN&& mons_genus(mons->type) == MONS_ELF|| get_equip_race(item) == ISFLAG_ORCISH&& mons_genus(mons->type) == MONS_ORC);}