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:
@@ -8033,13 +8033,9 @@ void Player::_ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackTy
|
|||||||
for (AuraEffectList::const_iterator itr = auraDamageFlatList.begin(); itr != auraDamageFlatList.end(); ++itr)
|
for (AuraEffectList::const_iterator itr = auraDamageFlatList.begin(); itr != auraDamageFlatList.end(); ++itr)
|
||||||
_ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
|
_ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
|
||||||
|
|
||||||
float mod = 100.0f;
|
|
||||||
AuraEffectList const& auraDamagePctList = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
AuraEffectList const& auraDamagePctList = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||||
for (AuraEffectList::const_iterator itr = auraDamagePctList.begin(); itr != auraDamagePctList.end(); ++itr)
|
for (AuraEffectList::const_iterator itr = auraDamagePctList.begin(); itr != auraDamagePctList.end(); ++itr)
|
||||||
if ((apply && item->IsFitToSpellRequirements((*itr)->GetSpellInfo())) || HasItemFitToSpellRequirements((*itr)->GetSpellInfo(), item))
|
_ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
|
||||||
mod += (*itr)->GetAmount();
|
|
||||||
|
|
||||||
SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, mod/100.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const* aura, bool apply)
|
void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const* aura, bool apply)
|
||||||
@@ -8088,13 +8084,17 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att
|
|||||||
switch (aura->GetAuraType())
|
switch (aura->GetAuraType())
|
||||||
{
|
{
|
||||||
case SPELL_AURA_MOD_DAMAGE_DONE: unitModType = TOTAL_VALUE; break;
|
case SPELL_AURA_MOD_DAMAGE_DONE: unitModType = TOTAL_VALUE; break;
|
||||||
|
case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE: unitModType = TOTAL_PCT; break;
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->IsFitToSpellRequirements(aura->GetSpellInfo()))
|
if (item->IsFitToSpellRequirements(aura->GetSpellInfo()))
|
||||||
{
|
{
|
||||||
HandleStatModifier(unitMod, unitModType, float(aura->GetAmount()), apply);
|
HandleStatModifier(unitMod, unitModType, float(aura->GetAmount()), apply);
|
||||||
ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply);
|
if (unitModType == TOTAL_VALUE)
|
||||||
|
ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply);
|
||||||
|
else
|
||||||
|
ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, aura->GetAmount() / 100.0f, apply);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11761,6 +11761,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
|
|||||||
// ..done
|
// ..done
|
||||||
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||||
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||||
|
{
|
||||||
if (spellProto)
|
if (spellProto)
|
||||||
{
|
{
|
||||||
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
|
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
|
||||||
@@ -11778,28 +11779,15 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
|
|||||||
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (player)
|
else
|
||||||
{
|
{
|
||||||
if (!((*i)->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
|
if ((*i)->GetMiscValue() & GetMeleeDamageSchoolMask() &&
|
||||||
|
(*i)->GetSpellInfo()->EquippedItemClass == -1)
|
||||||
{
|
{
|
||||||
EquipmentSlots slot;
|
|
||||||
|
|
||||||
switch (attType)
|
|
||||||
{
|
|
||||||
case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
|
|
||||||
case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break;
|
|
||||||
case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break;
|
|
||||||
default: return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
|
|
||||||
|
|
||||||
if (item && !item->IsBroken() && item->IsFitToSpellRequirements((*i)->GetSpellInfo()))
|
|
||||||
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
|
||||||
}
|
|
||||||
else if (player->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
|
|
||||||
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
AddPctN(DoneTotalMod, (*i)->GetAmount());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
|
AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
|
||||||
for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
|
for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
|
||||||
|
|||||||
@@ -2553,12 +2553,10 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if disarm aura is to be removed, remove the flag first to reapply damage/aura mods
|
||||||
if (!apply)
|
if (!apply)
|
||||||
target->RemoveFlag(field, flag);
|
target->RemoveFlag(field, flag);
|
||||||
|
|
||||||
if (apply)
|
|
||||||
target->SetFlag(field, flag);
|
|
||||||
|
|
||||||
// Handle damage modification, shapeshifted druids are not affected
|
// Handle damage modification, shapeshifted druids are not affected
|
||||||
if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm())
|
if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm())
|
||||||
{
|
{
|
||||||
@@ -2567,10 +2565,17 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode,
|
|||||||
uint8 attacktype = Player::GetAttackBySlot(slot);
|
uint8 attacktype = Player::GetAttackBySlot(slot);
|
||||||
|
|
||||||
if (attacktype < MAX_ATTACK)
|
if (attacktype < MAX_ATTACK)
|
||||||
|
{
|
||||||
target->ToPlayer()->_ApplyWeaponDamage(slot, pItem->GetTemplate(), NULL, !apply);
|
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())
|
if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->GetCurrentEquipmentId())
|
||||||
target->UpdateDamagePhysical(attType);
|
target->UpdateDamagePhysical(attType);
|
||||||
}
|
}
|
||||||
@@ -4499,8 +4504,9 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8
|
|||||||
if (!target)
|
if (!target)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (target->HasItemFitToSpellRequirements(GetSpellInfo()))
|
for(int i = 0; i < MAX_ATTACK; ++i)
|
||||||
target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, GetAmount() / 100.0f, apply);
|
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
|
void AuraEffect::HandleModOffhandDamagePercent(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||||
|
|||||||
Reference in New Issue
Block a user