summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 9f18a9d5b8..ee09fc5689 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1275,19 +1275,18 @@ static bool _try_give_plain_armour(item_def &arm)
// Consider shield slot filled in some cases.
if (armour_slots[i] == EQ_SHIELD)
{
- if (you.equip[EQ_WEAPON] == -1)
- {
- if (you.skills[SK_UNARMED_COMBAT] > random2(8))
- continue;
- }
- else
+ const item_def* weapon = you.weapon();
+
+ // Unarmed fighters don't need shields.
+ if (!weapon && you.skills[SK_UNARMED_COMBAT] > random2(8))
+ continue;
+
+ // Two-handed weapons and ranged weapons conflict with shields.
+ if (weapon
+ && (hands_reqd(*weapon, you.body_size()) == HANDS_TWO)
+ || is_range_weapon(*weapon))
{
- const item_def weapon = you.inv[you.equip[EQ_WEAPON]];
- const hands_reqd_type hand = hands_reqd(weapon, you.body_size());
- if (hand == HANDS_TWO || is_range_weapon(weapon))
- {
- continue;
- }
+ continue;
}
}