From 6ceab003bb46f769b5f4d1c0d7429f5032f3c017 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Fri, 26 Dec 2008 22:21:16 +0000 Subject: Fix 2448686: some jewellery properties not working properly while transformed. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7983 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 6 ++--- crawl-ref/source/dat/descript/items.txt | 3 ++- crawl-ref/source/output.cc | 47 ++++++++++++++++++--------------- crawl-ref/source/player.cc | 33 ++++++++++++----------- crawl-ref/source/unrand.h | 2 +- 5 files changed, 50 insertions(+), 41 deletions(-) diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index b08372d1d3..00760dd015 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1855,17 +1855,17 @@ static void _print_friendly_pickup_setting(bool was_changed) if (you.friendly_pickup == FRIENDLY_PICKUP_NONE) { - mprf("Your intelligent, permanent allies are %sforbidden to pick up anything at all.", + mprf("Your intelligent allies are %sforbidden to pick up anything at all.", now.c_str()); } else if (you.friendly_pickup == FRIENDLY_PICKUP_FRIEND) { - mprf("Your intelligent, permanent allies may %sonly pick up items dropped by allies.", + mprf("Your intelligent allies may %sonly pick up items dropped by allies.", now.c_str()); } else if (you.friendly_pickup == FRIENDLY_PICKUP_ALL) { - mprf("Your intelligent, permanent allies may %spick up anything they need.", now.c_str()); + mprf("Your intelligent allies may %spick up anything they need.", now.c_str()); } else { diff --git a/crawl-ref/source/dat/descript/items.txt b/crawl-ref/source/dat/descript/items.txt index 9679e12c15..a36ea70016 100644 --- a/crawl-ref/source/dat/descript/items.txt +++ b/crawl-ref/source/dat/descript/items.txt @@ -1482,7 +1482,8 @@ end %%%% tome of destruction -An extremely powerful but unpredictable book of magic. +An extremely powerful but unpredictable book of wild magic. +Warning: Reading may be hazardous to you or your surroundings! %%%% trident diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 78539a2abe..ec6343346b 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1646,26 +1646,15 @@ static void _print_overview_screen_equip(column_composer& cols, int eqslot = e_order[i]; char slot_name_lwr[15]; - snprintf(slot_name_lwr, sizeof slot_name_lwr, "%s", equip_slot_to_name(eqslot)); + snprintf(slot_name_lwr, sizeof slot_name_lwr, "%s", + equip_slot_to_name(eqslot)); strlwr(slot_name_lwr); char slot[15] = ""; // uncomment (and change 42 to 33) to bring back slot names // snprintf(slot, sizeof slot, "%-7s: ", equip_slot_to_name(eqslot); - if (!you_can_wear(e_order[i], true)) - { - snprintf(buf, sizeof buf, - "%s(%s unavailable)", - slot, slot_name_lwr); - } - else if (!you_tran_can_wear(e_order[i], true)) - { - snprintf(buf, sizeof buf, - "%s(%s currently unavailable)", - slot, slot_name_lwr); - } - else if (you.equip[ e_order[i] ] != -1) + if (you.equip[ e_order[i] ] != -1) { const int item_idx = you.equip[e_order[i]]; const item_def& item = you.inv[item_idx]; @@ -1681,21 +1670,37 @@ static void _print_overview_screen_equip(column_composer& cols, colname); equip_chars.push_back(equip_char); } - else if (!you_can_wear(e_order[i])) + else if (e_order[i] == EQ_WEAPON + && you.skills[SK_UNARMED_COMBAT]) { - snprintf(buf, sizeof buf, - "%s(%s restricted)", - slot, slot_name_lwr); + snprintf(buf, sizeof buf, "%s - Unarmed", slot); } else if (e_order[i] == EQ_WEAPON && you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS) { snprintf(buf, sizeof buf, "%s - Blade Hands", slot); } - else if (e_order[i] == EQ_WEAPON - && you.skills[SK_UNARMED_COMBAT]) + else if (e_order[i] == EQ_BOOTS + && (you.species == SP_NAGA || you.species == SP_CENTAUR)) { - snprintf(buf, sizeof buf, "%s - Unarmed", slot); + snprintf(buf, sizeof buf, + "(no %s)", slot_name_lwr); + } + else if (!you_can_wear(e_order[i], true)) + { + snprintf(buf, sizeof buf, + "(%s unavailable)", slot_name_lwr); + } + else if (!you_tran_can_wear(e_order[i], true)) + { + snprintf(buf, sizeof buf, + "(%s currently unavailable)", + slot_name_lwr); + } + else if (!you_can_wear(e_order[i])) + { + snprintf(buf, sizeof buf, + "(%s restricted)", slot_name_lwr); } else { diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 966874fea0..c4b12e45f1 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -681,8 +681,11 @@ bool you_tran_can_wear(int eq, bool check_mutation) return (false); // Everyone else can wear jewellery, at least. - if (eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING || eq == EQ_AMULET) + if (eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING || eq == EQ_RINGS + || eq == EQ_AMULET) + { return (true); + } // These cannot use anything but jewellery. if (transform == TRAN_SPIDER || transform == TRAN_DRAGON @@ -998,9 +1001,11 @@ int player_regen(void) rr += 100; // troll leather (except for trolls) - if (player_equip( EQ_BODY_ARMOUR, ARM_TROLL_LEATHER_ARMOUR ) && - you.species != SP_TROLL) + if (player_equip( EQ_BODY_ARMOUR, ARM_TROLL_LEATHER_ARMOUR ) + && you.species != SP_TROLL) + { rr += 30; + } // fast heal mutation rr += player_mutation_level(MUT_REGENERATION) * 20; @@ -2028,17 +2033,16 @@ static int _player_armour_racial_bonus(const item_def& item) int player_AC(void) { int AC = 0; - int i; // loop variable - for (i = EQ_CLOAK; i <= EQ_BODY_ARMOUR; i++) + for (int eq = EQ_CLOAK; eq <= EQ_BODY_ARMOUR; ++eq) { - if (i == EQ_SHIELD) + if (eq == EQ_SHIELD) continue; - if (!player_wearing_slot(i)) + if (!player_wearing_slot(eq)) continue; - const item_def& item = you.inv[you.equip[i]]; + const item_def& item = you.inv[you.equip[eq]]; const int ac_value = property(item, PARM_AC ) * 100; int racial_bonus = _player_armour_racial_bonus(item); @@ -2048,7 +2052,7 @@ int player_AC(void) // The deformed don't fit into body armour very well. // (This includes nagas and centaurs.) - if (i == EQ_BODY_ARMOUR && player_mutation_level(MUT_DEFORMED)) + if (eq == EQ_BODY_ARMOUR && player_mutation_level(MUT_DEFORMED)) AC -= ac_value / 2; } @@ -4444,11 +4448,11 @@ bool items_give_ability(const int slot, randart_prop_type abil) { for (int i = EQ_WEAPON; i < NUM_EQUIP; i++) { - const int eq = you.equip[i]; - - if (eq == -1) + if (!player_wearing_slot(i)) continue; + const int eq = you.equip[i]; + // skip item to compare with if (eq == slot) continue; @@ -4488,10 +4492,9 @@ bool items_give_ability(const int slot, randart_prop_type abil) a given property. Slow if any randarts are worn, so avoid where possible. */ int scan_randarts(randart_prop_type which_property, bool calc_unid) { - int i = 0; int retval = 0; - for (i = EQ_WEAPON; i < NUM_EQUIP; i++) + for (int i = EQ_WEAPON; i < NUM_EQUIP; ++i) { if (!player_wearing_slot(i)) continue; @@ -6685,7 +6688,7 @@ bool player::permanent_levitation() const // in order to actually cancel levitation (by setting // DUR_LEVITATION to 1.) Note that antimagic() won't do this. return (airborne() && player_equip_ego_type(EQ_BOOTS, SPARM_LEVITATION) - && you.duration[DUR_LEVITATION] > 1); + && you.duration[DUR_LEVITATION] > 1); } bool player::permanent_flight() const diff --git a/crawl-ref/source/unrand.h b/crawl-ref/source/unrand.h index 81f492ee27..13693c4377 100644 --- a/crawl-ref/source/unrand.h +++ b/crawl-ref/source/unrand.h @@ -834,7 +834,7 @@ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, // prevent spellcasting, prevent teleport 0, 0, 0, 0, 0, - -1, 0 // cursed + -1, 0 // cursed } , "", -- cgit v1.2.3-54-g00ecf