summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r--crawl-ref/source/mon-util.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 3e6ffac5db..faec32cacc 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -4124,7 +4124,10 @@ void monsters::wield_melee_weapon(int near)
if (!weap || (!weap->cursed() && is_range_weapon(*weap)))
{
const item_def *alt = mslot_item(MSLOT_ALT_WEAPON);
- if (alt && (!weap || !is_range_weapon(*alt)))
+
+ // 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)
swap_weapons(near);
}
}