diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-07 00:31:14 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-07 00:31:14 +0000 |
commit | 4758c6c4a6bc707b8e756b15616b1c91c5a60bff (patch) | |
tree | 970e8c22822f63535eec1ae34b0b6a04bb6dcf22 /crawl-ref/source/item_use.cc | |
parent | 6420501e4438688db41640c94c885f4cb6434d3a (diff) | |
download | crawl-ref-4758c6c4a6bc707b8e756b15616b1c91c5a60bff.tar.gz crawl-ref-4758c6c4a6bc707b8e756b15616b1c91c5a60bff.zip |
Fix bug #2569430: Throwing temporarily branded weapon makes brand permanent.
When throwing a wielded weapon, give the "you are now empty handed" message
last.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8941 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r-- | crawl-ref/source/item_use.cc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 266d4fef52..f6bbc3fe26 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -2277,11 +2277,20 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, item_def& thrown = you.inv[throw_2]; ASSERT(is_valid_item(thrown)); + // Figure out if we're thrown or launched. + const launch_retval projected = is_launched(&you, you.weapon(), thrown); + // Making a copy of the item: changed only for venom launchers. item_def item = thrown; item.quantity = 1; item.slot = index_to_letter(item.link); + // Items that get a temporary brand from a player spell lose the + // brand as soon as the player lets go of the item. Can't call + // unwield_item() yet since the beam might get canceled. + if (you.duration[DUR_WEAPON_BRAND] && projected == LRET_THROWN) + set_item_ego_type( item, OBJ_WEAPONS, SPWPN_NORMAL ); + std::string ammo_name; setup_missile_beam(&you, pbolt, item, ammo_name, returning); @@ -2292,9 +2301,6 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, const object_class_type wepClass = thrown.base_type; const int wepType = thrown.sub_type; - // Figure out if we're thrown or launched. - const launch_retval projected = is_launched(&you, you.weapon(), thrown); - // Determine range. int max_range = 0; int range = 0; @@ -2359,12 +2365,11 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, // Use real range for firing. pbolt.range = range; - // Must unwield before making a copy in order to remove things - // like temporary branding. + bool unwielded = false; if (throw_2 == you.equip[EQ_WEAPON] && thrown.quantity == 1) { unwield_item(); - canned_msg(MSG_EMPTY_HANDED); + unwielded = true; } // Now start real firing! @@ -2991,6 +2996,8 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, << " fails to return to your pack!" << std::endl; } dec_inv_item_quantity(throw_2, 1); + if (unwielded) + canned_msg(MSG_EMPTY_HANDED); } // Throwing and blowguns are silent... |