From f07f08abcbc5c34a01a94812d2599831d5d3b063 Mon Sep 17 00:00:00 2001 From: dolorous Date: Mon, 2 Mar 2009 23:47:12 +0000 Subject: Display the proper message when using a scroll of Enchant Weapon III on missiles. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9319 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/item_use.cc | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'crawl-ref/source/item_use.cc') 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 { -- cgit v1.2.3-54-g00ecf