[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

@ -246,7 +246,7 @@ void Unit::Update( uint32 p_time )
bool Unit::haveOffhandWeapon() const
{
if(GetTypeId() == TYPEID_PLAYER)
return ((Player*)this)->GetWeaponForAttack(OFF_ATTACK,true);
return ((Player*)this)->GetWeaponForAttack(OFF_ATTACK,true,true);
else
return false;
}
@ -2950,9 +2950,9 @@ float Unit::GetUnitParryChance() const
Player const* player = (Player const*)this;
if(player->CanParry() )
{
Item *tmpitem = player->GetWeaponForAttack(BASE_ATTACK,true);
Item *tmpitem = player->GetWeaponForAttack(BASE_ATTACK,true,true);
if(!tmpitem)
tmpitem = player->GetWeaponForAttack(OFF_ATTACK,true);
tmpitem = player->GetWeaponForAttack(OFF_ATTACK,true,true);
if(tmpitem)
chance = GetFloatValue(PLAYER_PARRY_PERCENTAGE);
@ -3056,7 +3056,7 @@ uint32 Unit::GetWeaponSkillValue (WeaponAttackType attType, Unit const* target)
uint32 value = 0;
if(GetTypeId() == TYPEID_PLAYER)
{
Item* item = ((Player*)this)->GetWeaponForAttack(attType,true);
Item* item = ((Player*)this)->GetWeaponForAttack(attType,true,true);
// feral or unarmed skill only for base attack
if(attType != BASE_ATTACK && !item )
@ -9510,7 +9510,7 @@ uint32 Unit::MeleeDamageBonus(Unit *pVictim, uint32 pdamage,WeaponAttackType att
// differentiate for weapon damage based spells
bool isWeaponDamageBasedSpell = !(spellProto && (damagetype == DOT || IsSpellHaveEffect(spellProto, SPELL_EFFECT_SCHOOL_DAMAGE)));
Item* pWeapon = GetTypeId() == TYPEID_PLAYER ? ((Player*)this)->GetWeaponForAttack(attType) : NULL;
Item* pWeapon = GetTypeId() == TYPEID_PLAYER ? ((Player*)this)->GetWeaponForAttack(attType,true,false) : NULL;
uint32 creatureTypeMask = pVictim->GetCreatureTypeMask();
uint32 schoolMask = spellProto ? spellProto->SchoolMask : GetMeleeDamageSchoolMask();
uint32 mechanicMask = spellProto ? GetAllSpellMechanicMask(spellProto) : 0;
@ -12611,7 +12611,7 @@ float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized)
if (!normalized || GetTypeId() != TYPEID_PLAYER)
return float(GetAttackTime(attType))/1000.0f;
Item *Weapon = ((Player*)this)->GetWeaponForAttack(attType);
Item *Weapon = ((Player*)this)->GetWeaponForAttack(attType, true, false);
if (!Weapon)
return 2.4; // fist attack