summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-28 14:12:40 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-28 14:12:40 +0000
commita7446c2bdae2423e35285e98a9c2cf517c2552a2 (patch)
tree0c9e2a28bd045df4d642a715bca6f47bf22066a6 /crawl-ref/source
parent20cec15b3f91d8bca9b5142b02f12732729577d3 (diff)
downloadcrawl-ref-a7446c2bdae2423e35285e98a9c2cf517c2552a2.tar.gz
crawl-ref-a7446c2bdae2423e35285e98a9c2cf517c2552a2.zip
Some tweaking of monster pickup:
* Summoned friends may not pick up anything (I feel that allowing players to waste time trying to equip temporary allies would be a bad decision). * Friendly monsters won't pick up gold or miscellany. * Daevas won't switch away from their blessed blades, nor Sigmund from his scythe, seeing how they're signature weapons and all. * Monsters already wielding a two-hander or dual-wielding won't pick up (and equip) shields. * Monsters capable of wielding two weapons won't replace (one of) them with a two-hander. TODO: Unequip shield when wielding a two-hander. For dual-wielding monsters diallow equipping a two-hander and something else (just the two-hander should be okay, I guess). Restrict missile pickup to appropriate launchers. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4742 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/mon-util.cc54
1 files changed, 43 insertions, 11 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 41a9142881..c0dc9f9748 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -3054,7 +3054,6 @@ void monsters::equip(item_def &item, int slot, int near)
case OBJ_WEAPONS:
{
bool give_msg = (slot == MSLOT_WEAPON || mons_wields_two_weapons(this));
-
equip_weapon(item, near, give_msg);
break;
}
@@ -3287,8 +3286,17 @@ bool monsters::pickup_launcher(item_def &launch, int near)
return (eslot == -1? false : pickup(launch, eslot, near));
}
-static bool _is_unique_weapon(monsters *monster, const item_def &weapon)
+static bool _is_signature_weapon(monsters *monster, const item_def &weapon)
{
+ if (weapon.base_type != OBJ_WEAPONS)
+ return false;
+
+ if (monster->type == MONS_DAEVA)
+ return (weapon.sub_type == WPN_BLESSED_BLADE);
+
+ if (monster->type == MONS_SIGMUND)
+ return (weapon.sub_type == WPN_SCYTHE);
+
if (is_fixed_artefact(weapon))
{
switch (weapon.special)
@@ -3326,7 +3334,7 @@ bool monsters::pickup_melee_weapon(item_def &item, int near)
continue;
// Don't drop weapons specific to the monster.
- if (_is_unique_weapon(this, *weap))
+ if (_is_signature_weapon(this, *weap))
continue;
has_melee = true;
@@ -3467,7 +3475,7 @@ bool monsters::pickup_armour(item_def &item, int near, bool force)
// Bardings are only wearable by the appropriate monster.
if (eq == EQ_NONE)
- return false;
+ return (false);
// XXX: Monsters can only equip body armour and shields (as of 0.4).
if (!force && eq != EQ_BODY_ARMOUR && eq != EQ_SHIELD)
@@ -3475,7 +3483,17 @@ bool monsters::pickup_armour(item_def &item, int near, bool force)
const mon_inv_type mslot = _equip_slot_to_mslot(eq);
if (mslot == NUM_MONSTER_SLOTS)
- return false;
+ return (false);
+
+ // Don't pick up a shield if you're already wielding a two-hander, or
+ // two weapons as a double-wielding monster.
+ if (mslot == MSLOT_SHIELD && mslot_item(MSLOT_WEAPON)
+ && (hands_reqd(*mslot_item(MSLOT_WEAPON), body_size(PSIZE_BODY))
+ == HANDS_TWO
+ || mslot_item(MSLOT_ALT_WEAPON) && mons_wields_two_weapons(this)))
+ {
+ return (false);
+ }
int newAC = item.armour_rating();
// no armour yet -> get this one
@@ -3532,6 +3550,15 @@ bool monsters::pickup_weapon(item_def &item, int near, bool force)
// - If it is a throwable weapon, and we're carrying no missiles (or our
// missiles are the same type), pick it up.
+ // Monsters capable of dual-wielding will always prefer two weapons
+ // to a single two-handed one, however strong.
+ if (mons_wields_two_weapons(this)
+ && hands_reqd(item, body_size(PSIZE_BODY)) == HANDS_TWO
+ && mslot_item(MSLOT_ALT_WEAPON))
+ {
+ return (false);
+ }
+
if (is_range_weapon(item))
return (pickup_launcher(item, near));
@@ -3686,13 +3713,11 @@ bool monsters::pickup_item(item_def &item, int near, bool force)
// Equipping stuff can be forced when initially equipping monsters.
if (!force)
{
- if (attitude == ATT_NEUTRAL)
- return (false);
-
// If a monster isn't otherwise occupied (has a foe, is fleeing, etc.)
// it is considered wandering.
bool wandering = (behaviour == BEH_WANDER
|| mons_friendly(this) && foe == MHITYOU);
+ const int itype = item.base_type;
// Weak(ened) monsters won't stop to pick up things as long as they
// feel unsafe.
@@ -3702,10 +3727,18 @@ bool monsters::pickup_item(item_def &item, int near, bool force)
return false;
}
- // Depending on the friendly pickup toggle, your allies may not pick
- // up anything, or only stuff dropped by (other) allies.
if (mons_friendly(this))
{
+ // No pickup for abjurable (summoned) allies - not worth the hassle.
+ if (has_ench(ENCH_ABJ))
+ return false;
+
+ // Never pick up gold or misc. items, it'd only annoy the player.
+ if (itype == OBJ_MISCELLANY || itype == OBJ_GOLD)
+ return false;
+
+ // Depending on the friendly pickup toggle, your allies may not
+ // pick up anything, or only stuff dropped by (other) allies.
if (Options.friendly_pickup < 0
|| Options.friendly_pickup == 0
&& !testbits(item.flags, ISFLAG_DROPPED_BY_ALLY))
@@ -3714,7 +3747,6 @@ bool monsters::pickup_item(item_def &item, int near, bool force)
}
}
- const int itype = item.base_type;
if (!wandering)
{
// These are not important enough for pickup when