diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-10-02 08:18:53 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-10-02 08:18:53 +0000 |
commit | 65b90b3a218495b887fa9053b4d90a74382cc71e (patch) | |
tree | 07805946780d489564ff2b8841520dd91676cad8 | |
parent | 2a39c829eb24d9187fa752ec2257951eb97de238 (diff) | |
download | crawl-ref-65b90b3a218495b887fa9053b4d90a74382cc71e.tar.gz crawl-ref-65b90b3a218495b887fa9053b4d90a74382cc71e.zip |
Fix 2141314: branding stays on thrown weapons.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7079 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/item_use.cc | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 73e21523d9..fa9718ea2b 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1854,22 +1854,19 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, } pbolt.set_target(thr); - // Making a copy of the item: changed only for venom launchers. - item_def item = you.inv[throw_2]; - item.quantity = 1; - item.slot = index_to_letter(item.link); + const item_def& thrown = you.inv[throw_2]; // Get the ammo/weapon type. Convenience. - const object_class_type wepClass = item.base_type; - const int wepType = item.sub_type; + 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(), item); + const launch_retval projected = is_launched(&you, you.weapon(), thrown); - pbolt.name = item.name(DESC_PLAIN, false, false, false); + pbolt.name = thrown.name(DESC_PLAIN, false, false, false); pbolt.thrower = KILL_YOU_MISSILE; pbolt.source = you.pos(); - pbolt.colour = item.colour; + pbolt.colour = thrown.colour; pbolt.flavour = BEAM_MISSILE; pbolt.aux_source.clear(); // pbolt.range is set below @@ -1901,7 +1898,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, else { // Range based on mass & strength, between 1 and 9. - max_range = range = std::max(you.strength - item_mass(item)/10 + 3, 1); + max_range = range = std::max(you.strength-item_mass(thrown)/10 + 3, 1); } range = std::min(range, LOS_RADIUS); @@ -1942,17 +1939,22 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, // Use real range for firing. pbolt.range = range; - // Now start real firing! - origin_set_unknown(item); - - // Must unwield before fire_beam() makes a copy in order to remove things - // like temporary branding. -- bwr - if (throw_2 == you.equip[EQ_WEAPON] && you.inv[throw_2].quantity == 1) + // Must unwield before making a copy in order to remove things + // like temporary branding. + if (throw_2 == you.equip[EQ_WEAPON] && thrown.quantity == 1) { unwield_item(); canned_msg(MSG_EMPTY_HANDED); } + // 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); + + // Now start real firing! + origin_set_unknown(item); + if (is_blood_potion(item) && you.inv[throw_2].quantity > 1) { // Initialize thrown potion with oldest potion in stack. |