From 1ae786a89983b2c5511028e1ef894f5b7504eb04 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 3 Jul 2008 14:41:49 +0000 Subject: Fix 2005590: Branded darts unbranded when thrown. Thrown darts of ice or flame will correctly be displayed as puffs of frost/flame, will do the appropriate damage both to player and monsters and will be identified when thrown by a monster. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6367 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/item_use.cc | 117 ++++++++++++++++++++++--------------------- 1 file changed, 61 insertions(+), 56 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 2eb1259aa8..9ac66044ca 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1989,24 +1989,26 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, if (wepClass == OBJ_WEAPONS) baseDam = std::max(0, property(item, PWPN_DAMAGE) - 4); - // Extract launcher bonuses due to magic. - if (projected == LRET_LAUNCHED) - { - lnchHitBonus = you.inv[you.equip[EQ_WEAPON]].plus; - lnchDamBonus = you.inv[you.equip[EQ_WEAPON]].plus2; - } - // Extract weapon/ammo bonuses due to magic. ammoHitBonus = item.plus; ammoDamBonus = item.plus2; + int bow_brand = SPWPN_NORMAL; + + if (projected == LRET_LAUNCHED) + bow_brand = get_weapon_brand(you.inv[you.equip[EQ_WEAPON]]); + + const int ammo_brand = get_ammo_brand( item ); + bool poisoned = (ammo_brand == SPMSL_POISONED); + // CALCULATIONS FOR LAUNCHED WEAPONS if (projected == LRET_LAUNCHED) { const item_def &launcher = you.inv[you.equip[EQ_WEAPON]]; - const int bow_brand = get_weapon_brand( launcher ); - const int ammo_brand = get_ammo_brand( item ); - bool poisoned = (ammo_brand == SPMSL_POISONED); + + // Extract launcher bonuses due to magic. + lnchHitBonus = launcher.plus; + lnchDamBonus = launcher.plus2; const int item_base_dam = property( item, PWPN_DAMAGE ); const int lnch_base_dam = property( launcher, PWPN_DAMAGE ); @@ -2229,52 +2231,6 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, pbolt.name = item.name(DESC_PLAIN); } - // Note that bow_brand is known since the bow is equipped. - if ((bow_brand == SPWPN_FLAME || ammo_brand == SPMSL_FLAME) - && ammo_brand != SPMSL_ICE && bow_brand != SPWPN_FROST) - { - // [dshaligram] Branded arrows are much stronger. - dice_mult = (dice_mult * 150) / 100; - - pbolt.flavour = BEAM_FIRE; - pbolt.name = "bolt of "; - - if (poisoned) - pbolt.name += "poison "; - - pbolt.name += "flame"; - pbolt.colour = RED; - pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT); - pbolt.thrower = KILL_YOU_MISSILE; - pbolt.aux_source.clear(); - } - - if ((bow_brand == SPWPN_FROST || ammo_brand == SPMSL_ICE) - && ammo_brand != SPMSL_FLAME && bow_brand != SPWPN_FLAME) - { - // [dshaligram] Branded arrows are much stronger. - dice_mult = (dice_mult * 150) / 100; - - pbolt.flavour = BEAM_COLD; - pbolt.name = "bolt of "; - - if (poisoned) - pbolt.name += "poison "; - - pbolt.name += "frost"; - pbolt.colour = WHITE; - pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT); - pbolt.thrower = KILL_YOU_MISSILE; - pbolt.aux_source.clear(); - } - - // The chief advantage here is the extra damage this does - // against susceptible creatures. - - // Note: weapons & ammo of eg fire are not cumulative - // ammo of fire and weapons of frost don't work together, - // and vice versa. - // ID check. Can't ID off teleported projectiles, uh, because // it's too weird. Also it messes up the messages. if (item_ident(you.inv[you.equip[EQ_WEAPON]], ISFLAG_KNOW_PLUSES)) @@ -2463,6 +2419,55 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, } } + mprf(MSGCH_DIAGNOSTICS, "bow_brand: %d, ammo_brand: %d", + bow_brand, ammo_brand); + + // The chief advantage here is the extra damage this does + // against susceptible creatures. + + // Note: weapons & ammo of eg fire are not cumulative + // ammo of fire and weapons of frost don't work together, + // and vice versa. + + // Note that bow_brand is known since the bow is equipped. + if ((bow_brand == SPWPN_FLAME || ammo_brand == SPMSL_FLAME) + && ammo_brand != SPMSL_ICE && bow_brand != SPWPN_FROST) + { + // [dshaligram] Branded arrows are much stronger. + dice_mult = (dice_mult * 150) / 100; + + pbolt.flavour = BEAM_FIRE; + pbolt.name = "bolt of "; + + if (poisoned) + pbolt.name += "poison "; + + pbolt.name += "flame"; + pbolt.colour = RED; + pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT); + pbolt.thrower = KILL_YOU_MISSILE; + pbolt.aux_source.clear(); + } + + if ((bow_brand == SPWPN_FROST || ammo_brand == SPMSL_ICE) + && ammo_brand != SPMSL_FLAME && bow_brand != SPWPN_FLAME) + { + // [dshaligram] Branded arrows are much stronger. + dice_mult = (dice_mult * 150) / 100; + + pbolt.flavour = BEAM_COLD; + pbolt.name = "bolt of "; + + if (poisoned) + pbolt.name += "poison "; + + pbolt.name += "frost"; + pbolt.colour = WHITE; + pbolt.type = dchar_glyph(DCHAR_FIRED_BOLT); + pbolt.thrower = KILL_YOU_MISSILE; + pbolt.aux_source.clear(); + } + // Dexterity bonus, and possible skill increase for silly throwing. if (projected) { -- cgit v1.2.3-54-g00ecf