diff options
-rw-r--r-- | crawl-ref/source/item_use.cc | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index aead71c75a..2a38a066b2 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -4955,19 +4955,39 @@ void read_scroll(int slot) if (you.weapon()) { item_def& wpn = *you.weapon(); - mprf("%s glows bright yellow for a while.", - wpn.name(DESC_CAP_YOUR).c_str() ); - do_uncurse_item(wpn); - _handle_enchant_weapon( ENCHANT_TO_HIT, true ); + const bool is_cursed = item_cursed(wpn); + + // Get item name now before changing enchantment. + std::string iname = wpn.name(DESC_CAP_YOUR); + + if (wpn.base_type == OBJ_WEAPONS) + { + mprf("%s glows bright yellow for a while.", iname.c_str()); - if (coinflip()) _handle_enchant_weapon( ENCHANT_TO_HIT, true ); - _handle_enchant_weapon( ENCHANT_TO_DAM, true ); + if (coinflip()) + _handle_enchant_weapon( ENCHANT_TO_HIT, true ); - if (coinflip()) _handle_enchant_weapon( ENCHANT_TO_DAM, true ); + + if (coinflip()) + _handle_enchant_weapon( ENCHANT_TO_DAM, true ); + } + else if (wpn.base_type == OBJ_MISSILES) + { + mprf("%s glow%s bright yellow for a while.", iname.c_str(), + wpn.quantity > 1 ? "" : "s"); + + _handle_enchant_weapon( ENCHANT_TO_HIT, true ); + + if (coinflip()) + _handle_enchant_weapon( ENCHANT_TO_HIT, true ); + } + + if (is_cursed) + do_uncurse_item( wpn ); } else { |