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/enum.h | 2 +- crawl-ref/source/fight.cc | 4 +++- crawl-ref/source/it_use2.cc | 3 ++- crawl-ref/source/player.cc | 35 +++++++++++++++++------------------ crawl-ref/source/spells3.cc | 4 ++-- crawl-ref/source/spl-cast.cc | 3 +++ crawl-ref/source/transfor.cc | 9 ++++++--- 7 files changed, 34 insertions(+), 26 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 8d5fdbd98e..01e5d8fe5a 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -2930,7 +2930,7 @@ enum trap_type // env.trap_type[] TRAP_BOLT, TRAP_NET, TRAP_ZOT, - TRAP_NEEDLE, + TRAP_NEEDLE, // 10 TRAP_SHAFT, NUM_TRAPS, // must remain last 'regular' member {dlb} TRAP_UNASSIGNED = 100, // keep set at 100 for now {dlb} diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index a037b25dec..a4f3c9b3f6 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -197,7 +197,7 @@ int calc_heavy_armour_penalty( bool random_factor ) const bool ur_armed = (you.weapon() != NULL); int heavy_armour = 0; - // heavy armour modifiers for shield borne + // Heavy armour modifiers for shield borne. if (player_wearing_slot(EQ_SHIELD)) { switch (you.shield()->sub_type) @@ -219,7 +219,9 @@ int calc_heavy_armour_penalty( bool random_factor ) { if (you.skills[SK_SHIELDS] < maybe_random2(13, random_factor)) + { heavy_armour += maybe_random2(3, random_factor); + } } } break; diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index 45b0605cbf..a9cbc99bd3 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -441,7 +441,8 @@ bool unwield_item(bool showMsgs) if (you.duration[DUR_BERSERKER]) { - canned_msg(MSG_TOO_BERSERK); + if (showMsgs) + canned_msg(MSG_TOO_BERSERK); return (false); } 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); diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index e9ad01d96a..b35a98ec37 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -134,8 +134,8 @@ bool remove_curse(bool suppress_msg) // What of artefact rings and amulets? {dlb}: for (int i = EQ_WEAPON + 1; i < NUM_EQUIP; i++) { - if (you.equip[i] != -1 && item_cursed(you.inv[you.equip[i]]) - && you_tran_can_wear(you.equip[i])) + // Melded equipment can also get uncursed this way. + if (you.equip[i] != -1 && item_cursed(you.inv[you.equip[i]])) { do_uncurse_item(you.inv[you.equip[i]]); success = true; diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index f51eb60a69..dfe3135ca8 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -235,6 +235,9 @@ static bool _spell_no_hostile_in_range(spell_type spell, int minRange) int list_spells(bool toggle_with_I, bool viewing, int minRange) { + if (toggle_with_I && get_spell_by_letter('I') != SPELL_NO_SPELL) + toggle_with_I = false; + ToggleableMenu spell_menu(MF_SINGLESELECT | MF_ANYPRINTABLE | MF_ALWAYS_SHOW_MORE | MF_ALLOW_FORMATTING); #ifdef USE_TILE diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc index dac21e32aa..3f4f2534d1 100644 --- a/crawl-ref/source/transfor.cc +++ b/crawl-ref/source/transfor.cc @@ -68,7 +68,7 @@ bool transform_allows_wearing_item(const item_def& item, { // It's not jewellery, and it's worn, so it must be armour. const equipment_type eqslot = get_armour_slot(item); - const bool is_soft_helmet = is_helmet(item) && !is_hard_helmet(item); + const bool is_soft_helmet = is_helmet(item) && !is_hard_helmet(item); switch (transform) { @@ -147,7 +147,7 @@ static void _unwear_equipment_slot(equipment_type eqslot) if (eqslot == EQ_WEAPON) { - unwield_item(); + unwield_item(!you.duration[DUR_BERSERKER]); canned_msg(MSG_EMPTY_HANDED); you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] = slot + 1; } @@ -611,8 +611,11 @@ bool transform(int pow, transformation_type which_trans, bool force, std::set rem_stuff = _init_equipment_removal(which_trans); - if (_check_for_cursed_equipment(rem_stuff, which_trans, force) && which_trans!=TRAN_PIG) + if (which_trans != TRAN_PIG + && _check_for_cursed_equipment(rem_stuff, which_trans, force)) + { return (_abort_or_fizzle(just_check)); + } int str = 0, dex = 0, symbol = '@', colour = LIGHTGREY, xhp = 0, dur = 0; const char* tran_name = "buggy"; -- cgit v1.2.3-54-g00ecf