From 72d421a98654a1d73704397dfd9a4be3177289d0 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 13 Sep 2009 21:20:59 +0000 Subject: A bug fix commit! (I didn't do one of these in a while...) * 2856912: being turned into a pig while berserk complaining about being "too berserk" when unequipping the weapon * 2849963: shields working even when melded * 2845355: melded equipment not being affected by remove curse * 2836148: disallow toggle_with_I if you've got a spell on 'I' git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10671 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/player.cc | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'crawl-ref/source/player.cc') diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 8de920345c..049302d608 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -2403,7 +2403,7 @@ int player_evasion() // Some lesser armours have small penalties now (shields, barding). for (int i = EQ_CLOAK; i < EQ_BODY_ARMOUR; i++) { - if (you.equip[i] == -1) + if (!player_wearing_slot(i)) continue; int pen = property( you.inv[ you.equip[i] ], PARM_EVASION ); @@ -2452,7 +2452,7 @@ int player_evasion() if (dodge_bonus > 0) // always a bonus ev += dodge_bonus; - if (you.duration[DUR_AGILITY]) + if (you.duration[DUR_AGILITY]) ev += 5; if (you.duration[DUR_PHASE_SHIFT]) @@ -2648,22 +2648,10 @@ item_def *player_shield() int player_shield_class(void) //jmf: changes for new spell { int base_shield = 0; - const int shield = you.equip[EQ_SHIELD]; - - if (shield == -1) - { - if (you.duration[DUR_MAGIC_SHIELD]) - base_shield = 2 + you.skills[SK_EVOCATIONS] / 6; - if (!you.duration[DUR_FIRE_SHIELD] && - you.duration[DUR_CONDENSATION_SHIELD]) - { - base_shield += 2 + (you.skills[SK_ICE_MAGIC] / 6); // max 6 - } - } - else + if (player_wearing_slot(EQ_SHIELD)) { - const item_def& item = you.inv[shield]; + const item_def& item = you.inv[you.equip[EQ_SHIELD]]; base_shield = property(item, PARM_AC); int racial_bonus = _player_armour_racial_bonus(item) * 2 / 3; @@ -2674,6 +2662,17 @@ int player_shield_class(void) //jmf: changes for new spell base_shield += item.plus; } + else + { + if (you.duration[DUR_MAGIC_SHIELD]) + base_shield = 2 + you.skills[SK_EVOCATIONS] / 6; + + if (!you.duration[DUR_FIRE_SHIELD] + && you.duration[DUR_CONDENSATION_SHIELD]) + { + base_shield += 2 + (you.skills[SK_ICE_MAGIC] / 6); // max 6 + } + } if (you.duration[DUR_DIVINE_SHIELD]) base_shield += you.attribute[ATTR_DIVINE_SHIELD]; @@ -3747,7 +3746,7 @@ int check_stealth(void) if ( you.duration[DUR_STEALTH] ) stealth += 80; - if (you.duration[DUR_AGILITY]) + if (you.duration[DUR_AGILITY]) stealth += 50; stealth += scan_artefacts( ARTP_STEALTH ); @@ -6476,7 +6475,7 @@ bool player::can_wield(const item_def& item, bool ignore_curse, const bool two_handed = item.base_type == OBJ_UNASSIGNED || hands_reqd(item, body_size()) == HANDS_TWO; - if (two_handed && !ignore_shield && equip[EQ_SHIELD] != -1) + if (two_handed && !ignore_shield && player_wearing_slot(EQ_SHIELD)) return (false); return could_wield(item, ignore_brand, ignore_transform); -- cgit v1.2.3-54-g00ecf