[8978] Fix wrongly apply weapon damage mods to broken weapon.

This commit is contained in:
VladimirMangos 2009-12-12 20:39:04 +03:00
parent f47492ad24
commit 1d608c482f
7 changed files with 42 additions and 38 deletions

View file

@ -2223,10 +2223,10 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
// main hand weapon required
if (spellInfo->AttributesEx3 & SPELL_ATTR_EX3_MAIN_HAND)
{
Item* item = ((Player*)m_caster)->GetWeaponForAttack(BASE_ATTACK);
Item* item = ((Player*)m_caster)->GetWeaponForAttack(BASE_ATTACK, true, false);
// skip spell if no weapon in slot or broken
if (!item || item->IsBroken() )
if (!item)
return;
// skip spell if weapon not fit to triggered spell
@ -2237,10 +2237,10 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
// offhand hand weapon required
if (spellInfo->AttributesEx3 & SPELL_ATTR_EX3_REQ_OFFHAND)
{
Item* item = ((Player*)m_caster)->GetWeaponForAttack(OFF_ATTACK);
Item* item = ((Player*)m_caster)->GetWeaponForAttack(OFF_ATTACK, true, false);
// skip spell if no weapon in slot or broken
if (!item || item->IsBroken() )
if (!item)
return;
// skip spell if weapon not fit to triggered spell
@ -4586,7 +4586,7 @@ void Spell::EffectWeaponDmg(uint32 i)
// Whirlwind, single only spell with 2 weapon white damage apply if have
if(m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x00000400000000)))
{
if(((Player*)m_caster)->GetWeaponForAttack(OFF_ATTACK,true))
if(((Player*)m_caster)->GetWeaponForAttack(OFF_ATTACK, true, true))
spell_bonus += m_caster->CalculateDamage (OFF_ATTACK, normalized);
}
// Devastate bonus and sunder armor refresh
@ -4646,7 +4646,7 @@ void Spell::EffectWeaponDmg(uint32 i)
// Fan of Knives
else if (m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0004000000000000)))
{
Item* weapon = ((Player*)m_caster)->GetWeaponForAttack(m_attackType,true);
Item* weapon = ((Player*)m_caster)->GetWeaponForAttack(m_attackType,true,true);
if (weapon && weapon->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER)
totalDamagePercentMod *= 1.5f; // 150% to daggers
}
@ -4821,13 +4821,13 @@ void Spell::EffectWeaponDmg(uint32 i)
// take ammo
if(m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER)
{
Item *pItem = ((Player*)m_caster)->GetWeaponForAttack( RANGED_ATTACK );
Item *pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK, true, false);
// wands don't have ammo
if(!pItem || pItem->IsBroken() || pItem->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_WAND)
if (!pItem || pItem->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_WAND)
return;
if( pItem->GetProto()->InventoryType == INVTYPE_THROWN )
if (pItem->GetProto()->InventoryType == INVTYPE_THROWN)
{
if(pItem->GetMaxStackCount()==1)
{