diff options
author | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-09 20:29:40 +0530 |
---|---|---|
committer | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-01-09 20:29:40 +0530 |
commit | 8b1fac167bcae924466d59df079106101f09892c (patch) | |
tree | 9b17140119b81d3a0d23988bce06cb9442d8eeec /crawl-ref/source/monster.cc | |
parent | f402990b9d7a17aa5e775c445891bc8428f40692 (diff) | |
download | crawl-ref-8b1fac167bcae924466d59df079106101f09892c.tar.gz crawl-ref-8b1fac167bcae924466d59df079106101f09892c.zip |
Don't let monsters wield stacks of throwing weapons (fixes NetHackish messages about monsters wielding 6 spears).
Diffstat (limited to 'crawl-ref/source/monster.cc')
-rw-r--r-- | crawl-ref/source/monster.cc | 16 |
1 files changed, 13 insertions, 3 deletions
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<mon_inv_type>(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); + } } } |