Merge pull request #2580 from hacknowledge/damagemodfix

Core/Spells: Fixed weapon dependent damage mods for players as well as au
This commit is contained in:
QAston
2011-08-16 03:41:23 -07:00
3 changed files with 23 additions and 29 deletions
@@ -2553,12 +2553,10 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode,
return;
}
// if disarm aura is to be removed, remove the flag first to reapply damage/aura mods
if (!apply)
target->RemoveFlag(field, flag);
if (apply)
target->SetFlag(field, flag);
// Handle damage modification, shapeshifted druids are not affected
if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm())
{
@@ -2567,10 +2565,17 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode,
uint8 attacktype = Player::GetAttackBySlot(slot);
if (attacktype < MAX_ATTACK)
{
target->ToPlayer()->_ApplyWeaponDamage(slot, pItem->GetTemplate(), NULL, !apply);
target->ToPlayer()->_ApplyWeaponDependentAuraMods(pItem, WeaponAttackType(attacktype), !apply);
}
}
}
// if disarm effects should be applied, wait to set flag until damage mods are unapplied
if (apply)
target->SetFlag(field, flag);
if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCurrentEquipmentId())
target->UpdateDamagePhysical(attType);
}
@@ -4499,8 +4504,9 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8
if (!target)
return;
if (target->HasItemFitToSpellRequirements(GetSpellInfo()))
target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, GetAmount() / 100.0f, apply);
for(int i = 0; i < MAX_ATTACK; ++i)
if(Item* item = target->GetWeaponForAttack(WeaponAttackType(i),false))
target->_ApplyWeaponDependentAuraDamageMod(item, WeaponAttackType(i), this, apply);
}
void AuraEffect::HandleModOffhandDamagePercent(AuraApplication const* aurApp, uint8 mode, bool apply) const