Core/Spells: Fixed weapon dependent damage mods for players as well as autohit damage mods for NPCs and pets. This fixes also meta sockel effects. Also fixed displaying the correct values in the char info. I also took care of applying and unapplying the weapon based damage mods when the player is being disarmed and equips/unequips his weapon.

Fixes #178, #418, #1276, #259 and possible a few other issues.
This commit is contained in:
hacknowledge
2011-08-13 23:26:16 +02:00
parent 0cb68815ec
commit 0c500486f3
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