Description |
I found some strange messages while playing and when I checked them in the source, I found a few other trivial problems.
(1) When cursed jewellery is unmelded, the "Oops, that (ring|amulet) feels deathly cold." message is displayed. Cursed armour only displays a similar message when it is actually worn (and not only unmelded), and I think that would be a better behavior here, as this message is unnecessary (meld/unmeld doesn't change curse status).
Also, Xom is amused by unmelded cursed jewellery, and this is probably also a bug -- fortunately I think only Octopodes can exploit it reliably and repeatedly (they meld rings in most forms while most other characters meld jewellery only in bad forms like pig form).
(2) The inventory letter is printed for each piece of equipped/unmelded jewellry by a mprf_nocap("%s", item.name(DESC_INVENTORY_EQUIP).c_str()) call at the end of _equip_jewellery_effect(). While this is useful after actual equipping, melding/unmelding is normally not related to jewellery handling and printing jewellery letters at unmelding is not more useful than printing them at the end of any other enchantment. Also, this can generate lots of spammy messages for transmutation-using Octopodes who frequently meld and unmeld rings.
(3) In _equip_armour_effect() equipping cursed gloves/cloaks gives more Xom amusement, because (the comment next to it says) they interfere with ring/body armour handling. As these effects of cursed gloves/cloaks were removed, this special case is completely unnecessary.
(4) When a weapon of protection or evasion is temporarily rebranded (or when its branding ends), the AC/EV display is not redrawn.
(5) Rebranding a distortion weapon causes a miscast with source "a distortion unwield", but it should be "a distortion rebranding" or "rebranding a weapon of distortion".
I uploaded a patch fixing all these problems. (Is it better to report trivial problems like these in separate bug reports/patches or in a collection like this?) |
Attached Files |
0001-Trivial-fixes-in-player-equip.cc-and-spl-wpnench.cc.patch [^] (5,910 bytes) 2014-09-27 15:23 [Show Content] [Hide Content]From 6f3e3a9180e0275cb68e53ffd1ac3b390edec8c6 Mon Sep 17 00:00:00 2001
From: nagdon <m1nagdon@gmail.com>
Date: Sat, 27 Sep 2014 15:16:15 +0200
Subject: [PATCH] Trivial fixes in player-equip.cc and spl-wpnench.cc
This commit fixes the following five trivial problems:
* When cursed jewellery is unmelded, unneccessary messages are printed and Xom
is stimulated.
* The message displaying the inventory letter of a just equipped piece of
jewellery is also printed after unmelding.
* Cursed gloves/cloaks give more Xom amusement than other armour pieces
(because they used to block handling of rings/body armour).
* Rebranding a weapon of protection or evasion doesn't redraw AC/EV.
* Rebranding a weapon of distortion causes a miscast with a bad source name.
---
crawl-ref/source/player-equip.cc | 13 +++----------
crawl-ref/source/spl-wpnench.cc | 28 +++++++++++++++++++++-------
2 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/crawl-ref/source/player-equip.cc b/crawl-ref/source/player-equip.cc
index f25afda..7f546d7 100644
--- a/crawl-ref/source/player-equip.cc
+++ b/crawl-ref/source/player-equip.cc
@@ -929,14 +929,6 @@ static void _equip_armour_effect(item_def& arm, bool unmeld,
{
int amusement = 64;
- // Cursed cloaks prevent you from removing body armour.
- // Cursed gloves prevent switching of rings.
- if (get_armour_slot(arm) == EQ_CLOAK
- || get_armour_slot(arm) == EQ_GLOVES)
- {
- amusement *= 2;
- }
-
god_type god;
if (origin_is_god_gift(arm, &god) && god == GOD_XOM)
amusement *= 2;
@@ -1252,7 +1244,7 @@ static void _equip_jewellery_effect(item_def &item, bool unmeld,
set_ident_flags(item, ISFLAG_IDENT_MASK);
}
- if (item.cursed())
+ if (item.cursed() && !unmeld)
{
mprf("Oops, that %s feels deathly cold.",
jewellery_is_amulet(item)? "amulet" : "ring");
@@ -1273,7 +1265,8 @@ static void _equip_jewellery_effect(item_def &item, bool unmeld,
// Cursed or not, we know that since we've put the ring on.
set_ident_flags(item, ISFLAG_KNOW_CURSE);
- mprf_nocap("%s", item.name(DESC_INVENTORY_EQUIP).c_str());
+ if (!unmeld)
+ mprf_nocap("%s", item.name(DESC_INVENTORY_EQUIP).c_str());
}
static void _unequip_jewellery_effect(item_def &item, bool mesg, bool meld,
diff --git a/crawl-ref/source/spl-wpnench.cc b/crawl-ref/source/spl-wpnench.cc
index eb32c52..c4e8791 100644
--- a/crawl-ref/source/spl-wpnench.cc
+++ b/crawl-ref/source/spl-wpnench.cc
@@ -108,10 +108,18 @@ void end_weapon_brand(item_def &weapon, bool verbose)
ASSERT(you.duration[DUR_WEAPON_BRAND]);
const int temp_effect = get_weapon_brand(weapon);
- set_item_ego_type(weapon, OBJ_WEAPONS, you.props[ORIGINAL_BRAND_KEY]);
- you.wield_change = true;
+ const int original_brand = you.props[ORIGINAL_BRAND_KEY];
+ set_item_ego_type(weapon, OBJ_WEAPONS, original_brand);
+
+ you.wield_change = true;
+ if (temp_effect == SPWPN_PROTECTION || original_brand == SPWPN_PROTECTION)
+ you.redraw_armour_class = true;
+ if (temp_effect == SPWPN_EVASION || original_brand == SPWPN_EVASION)
+ you.redraw_evasion = true;
+
you.props.erase(ORIGINAL_BRAND_KEY);
you.duration[DUR_WEAPON_BRAND] = 0;
+
if (verbose)
{
const char *msg = nullptr;
@@ -187,6 +195,7 @@ spret_type brand_weapon(brand_type which_brand, int power, bool fail)
}
item_def& weapon = *you.weapon();
+ const brand_type old_brand = get_weapon_brand(weapon);
if (!is_brandable_weapon(weapon, true))
{
@@ -199,7 +208,7 @@ spret_type brand_weapon(brand_type which_brand, int power, bool fail)
bool has_temp_brand = you.duration[DUR_WEAPON_BRAND];
// No need to brand with a brand it's already branded with.
- if (!has_temp_brand && get_weapon_brand(weapon) == which_brand)
+ if (!has_temp_brand && old_brand == which_brand)
{
mpr("This weapon is already enchanted with that brand.");
return SPRET_ABORT;
@@ -232,7 +241,7 @@ spret_type brand_weapon(brand_type which_brand, int power, bool fail)
}
// Can't get out of it that easily...
- if (get_weapon_brand(weapon) == SPWPN_DISTORTION
+ if (old_brand == SPWPN_DISTORTION
&& !has_temp_brand
&& !you_worship(GOD_LUGONU))
{
@@ -244,18 +253,23 @@ spret_type brand_weapon(brand_type which_brand, int power, bool fail)
return SPRET_ABORT;
}
MiscastEffect(&you, WIELD_MISCAST, SPTYP_TRANSLOCATION,
- 9, 90, "a distortion unwield");
+ 9, 90, "a distortion rebranding");
}
fail_check();
string msg = weapon.name(DESC_YOUR);
- bool extending = has_temp_brand && get_weapon_brand(weapon) == which_brand;
+ bool extending = has_temp_brand && old_brand == which_brand;
bool emit_special_message = !extending;
int duration_affected = _get_brand_duration(which_brand);
msg += _get_brand_msg(which_brand, is_range_weapon(weapon));
+ if (which_brand == SPWPN_PROTECTION || old_brand == SPWPN_PROTECTION)
+ you.redraw_armour_class = true;
+ if (which_brand == SPWPN_EVASION || old_brand == SPWPN_EVASION)
+ you.redraw_evasion = true;
+
if (which_brand == SPWPN_DISTORTION)
power /= 2;
else if (which_brand == SPWPN_PAIN && !silenced(you.pos()))
@@ -269,7 +283,7 @@ spret_type brand_weapon(brand_type which_brand, int power, bool fail)
{
if (has_temp_brand)
end_weapon_brand(weapon);
- you.props[ORIGINAL_BRAND_KEY] = get_weapon_brand(weapon);
+ you.props[ORIGINAL_BRAND_KEY] = old_brand;
set_item_ego_type(weapon, OBJ_WEAPONS, which_brand);
you.wield_change = true;
}
--
1.7.10.4
|