From 8b1fac167bcae924466d59df079106101f09892c Mon Sep 17 00:00:00 2001 From: Darshan Shaligram Date: Sat, 9 Jan 2010 20:29:40 +0530 Subject: Don't let monsters wield stacks of throwing weapons (fixes NetHackish messages about monsters wielding 6 spears). --- crawl-ref/source/monster.cc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'crawl-ref/source/monster.cc') diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 4667599a33..c2139a4b90 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -1322,8 +1322,8 @@ bool monsters::pickup_melee_weapon(item_def &item, int near) { // Throwable weapons may be picked up as though dual-wielding. const bool dual_wielding = (mons_wields_two_weapons(this) - || is_throwable(this, item)); - if (dual_wielding) + || is_throwable(this, item)); + if (dual_wielding && item.quantity == 1) { // If we have either weapon slot free, pick up the weapon. if (inv[MSLOT_WEAPON] == NON_ITEM) @@ -1347,6 +1347,11 @@ bool monsters::pickup_melee_weapon(item_def &item, int near) { weap = mslot_item(static_cast(i)); + // If the weapon is a stack of throwing weaons, the monster + // will not use the stack as their primary melee weapon. + if (item.quantity != 1 && i == MSLOT_WEAPON) + continue; + if (!weap) { // If no weapon in this slot, mark this one. @@ -1928,8 +1933,13 @@ void monsters::wield_melee_weapon(int near) // Switch to the alternate weapon if it's not a ranged weapon, too, // or switch away from our main weapon if it's a ranged weapon. - if (alt && !is_range_weapon(*alt) || weap && !alt && type != MONS_STATUE) + // + // Don't switch to alt weapon if it's a stack of throwing weapons. + if (alt && !is_range_weapon(*alt) && alt->quantity == 1 + || weap && !alt && type != MONS_STATUE) + { swap_weapons(near); + } } } -- cgit v1.2.3-54-g00ecf