summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells3.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-22 00:12:33 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-22 00:12:33 +0000
commit65b9720cd0a5807efef83eea0fa7780ceef3b82b (patch)
tree3dafc8da3c1f585b3898868da5f836f9f79de69b /crawl-ref/source/spells3.cc
parent2110d762af86506eb00a12494a965c450bf8c664 (diff)
downloadcrawl-ref-65b9720cd0a5807efef83eea0fa7780ceef3b82b.tar.gz
crawl-ref-65b9720cd0a5807efef83eea0fa7780ceef3b82b.zip
Fix equip_undead() to make stupid undead not pick up alternate weapons
again. Since monsters::pickup_item() may change the slot a weapon goes into, and includes checks with regard to picking up two melee weapons or two ranged weapons, check both the weapon and alternate weapon slots, and only fill both if the monster can wield two weapons or is a smart undead. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8665 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r--crawl-ref/source/spells3.cc30
1 files changed, 10 insertions, 20 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 665951f70a..05fd90a2f7 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -718,32 +718,22 @@ void equip_undead(const coord_def &a, int corps, int monster, int monnum)
switch (item.base_type)
{
case OBJ_WEAPONS:
- if (mon->inv[MSLOT_WEAPON] != NON_ITEM)
+ {
+ const bool weapon = mon->inv[MSLOT_WEAPON] != NON_ITEM;
+ const bool alt_weapon = mon->inv[MSLOT_ALT_WEAPON] != NON_ITEM;
+
+ if ((weapon && !alt_weapon) || (!weapon && alt_weapon))
{
- if (mons_wields_two_weapons(mon))
- mslot = MSLOT_ALT_WEAPON;
+ // Stupid undead can't switch between weapons.
+ if (mons_wields_two_weapons(mon) || smart_undead)
+ mslot = !weapon ? MSLOT_WEAPON : MSLOT_ALT_WEAPON;
else
- {
- if (is_range_weapon(mitm[mon->inv[MSLOT_WEAPON]])
- == is_range_weapon(item))
- {
- // Two different items going into the same
- // slot indicate that this and further items
- // weren't equipment the monster died with.
- return;
- }
- else if (smart_undead)
- mslot = MSLOT_ALT_WEAPON;
- else
- {
- // Stupid undead can't switch between weapons.
- continue;
- }
- }
+ continue;
}
else
mslot = MSLOT_WEAPON;
break;
+ }
case OBJ_ARMOUR:
mslot = equip_slot_to_mslot(get_armour_slot(item));