Core/Unit: fix some SPELL_AURA_MOD_DAMAGE_PERCENT_DONE effects being …
…applied more than once No more overpowered dps for you
This commit is contained in:
1 parent
227dc4d907
commit
6c76eff031
3 files changed
+78
-72
No files matched your search
@@ -8717,23 +8717,22 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
|
||||
// Pets just add their bonus damage to their spell damage
|
||||
// note that their spell damage is just gain of their own auras
|
||||
if (HasUnitTypeMask(UNIT_MASK_GUARDIAN))
|
||||
DoneAdvertisedBenefit += ((Guardian*)this)->GetBonusDamage();
|
||||
DoneAdvertisedBenefit += static_cast<Guardian const*>(this)->GetBonusDamage();
|
||||
|
||||
// Check for table values
|
||||
float coeff = 0;
|
||||
float coeff = 0.f;
|
||||
SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
|
||||
if (bonus)
|
||||
{
|
||||
WeaponAttackType const attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
|
||||
float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS));
|
||||
APbonus += GetTotalAttackPowerValue(attType);
|
||||
|
||||
if (damagetype == DOT)
|
||||
{
|
||||
coeff = bonus->dot_damage;
|
||||
if (bonus->ap_dot_bonus > 0)
|
||||
{
|
||||
WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
|
||||
float APbonus = float(victim->GetTotalAuraModifier(attType == BASE_ATTACK ? SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS : SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS));
|
||||
APbonus += GetTotalAttackPowerValue(attType);
|
||||
DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -8794,19 +8793,21 @@ float Unit::SpellDamagePctDone(Unit* victim, SpellInfo const* spellProto, Damage
|
||||
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
|
||||
|
||||
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
for (AuraEffect const* aurEff : mModDamagePercentDone)
|
||||
{
|
||||
if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization)
|
||||
SpellInfo const* aurSpellInfo = aurEff->GetSpellInfo();
|
||||
|
||||
if (spellProto->EquippedItemClass == -1 && aurSpellInfo->EquippedItemClass != -1) // prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization)
|
||||
continue;
|
||||
|
||||
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
|
||||
if ((aurEff->GetMiscValue() & spellProto->GetSchoolMask()) != 0)
|
||||
{
|
||||
if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
else if (!(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
if (aurSpellInfo->EquippedItemClass == -1)
|
||||
AddPct(DoneTotalMod, aurEff->GetAmount());
|
||||
else if (!aurSpellInfo->HasAttribute(SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && (aurSpellInfo->EquippedItemSubClassMask == 0))
|
||||
AddPct(DoneTotalMod, aurEff->GetAmount());
|
||||
else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements(aurSpellInfo))
|
||||
AddPct(DoneTotalMod, aurEff->GetAmount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9063,13 +9064,15 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const
|
||||
int32 DoneAdvertisedBenefit = 0;
|
||||
|
||||
AuraEffectList const& mDamageDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE);
|
||||
for (AuraEffectList::const_iterator i = mDamageDone.begin(); i != mDamageDone.end(); ++i)
|
||||
if (((*i)->GetMiscValue() & schoolMask) != 0 &&
|
||||
(*i)->GetSpellInfo()->EquippedItemClass == -1 &&
|
||||
// -1 == any item class (not wand then)
|
||||
(*i)->GetSpellInfo()->EquippedItemInventoryTypeMask == 0)
|
||||
// 0 == any inventory type (not wand then)
|
||||
DoneAdvertisedBenefit += (*i)->GetAmount();
|
||||
for (AuraEffect const* aurEff : mDamageDone)
|
||||
{
|
||||
if (!(aurEff->GetMiscValue() & schoolMask))
|
||||
continue;
|
||||
|
||||
// only apply generic bonus here, weapon requiring mods are not applicable to non-melee spells
|
||||
if (aurEff->GetSpellInfo()->EquippedItemClass == -1 && aurEff->GetSpellInfo()->EquippedItemInventoryTypeMask == 0)
|
||||
DoneAdvertisedBenefit += aurEff->GetAmount();
|
||||
}
|
||||
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
@@ -9082,22 +9085,21 @@ int32 Unit::SpellBaseDamageBonusDone(SpellSchoolMask schoolMask) const
|
||||
|
||||
// Damage bonus from stats
|
||||
AuraEffectList const& mDamageDoneOfStatPercent = GetAuraEffectsByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT);
|
||||
for (AuraEffectList::const_iterator i = mDamageDoneOfStatPercent.begin(); i != mDamageDoneOfStatPercent.end(); ++i)
|
||||
for (AuraEffect const* aurEff : mDamageDoneOfStatPercent)
|
||||
{
|
||||
if ((*i)->GetMiscValue() & schoolMask)
|
||||
if ((aurEff->GetMiscValue() & schoolMask) != 0)
|
||||
{
|
||||
// stat used stored in miscValueB for this aura
|
||||
Stats usedStat = Stats((*i)->GetMiscValueB());
|
||||
DoneAdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
|
||||
Stats const usedStat = static_cast<Stats>(aurEff->GetMiscValueB());
|
||||
DoneAdvertisedBenefit += static_cast<int32>(CalculatePct(GetStat(usedStat), aurEff->GetAmount()));
|
||||
}
|
||||
}
|
||||
|
||||
// ... and attack power
|
||||
AuraEffectList const& mDamageDonebyAP = GetAuraEffectsByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER);
|
||||
for (AuraEffectList::const_iterator i =mDamageDonebyAP.begin(); i != mDamageDonebyAP.end(); ++i)
|
||||
if ((*i)->GetMiscValue() & schoolMask)
|
||||
DoneAdvertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
|
||||
DoneAdvertisedBenefit += static_cast<int32>(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER, schoolMask)));
|
||||
|
||||
}
|
||||
|
||||
return DoneAdvertisedBenefit;
|
||||
}
|
||||
|
||||
@@ -9902,38 +9904,45 @@ uint32 Unit::MeleeDamageBonusDone(Unit* victim, uint32 pdamage, WeaponAttackType
|
||||
|
||||
if (APbonus != 0) // Can be negative
|
||||
{
|
||||
bool normalized = false;
|
||||
if (spellProto)
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if (spellProto->Effects[i].Effect == SPELL_EFFECT_NORMALIZED_WEAPON_DMG)
|
||||
{
|
||||
normalized = true;
|
||||
break;
|
||||
}
|
||||
DoneFlatBenefit += int32(APbonus/14.0f * GetAPMultiplier(attType, normalized));
|
||||
bool const normalized = spellProto && spellProto->HasEffect(SPELL_EFFECT_NORMALIZED_WEAPON_DMG);
|
||||
DoneFlatBenefit += int32(APbonus / 14.0f * GetAPMultiplier(attType, normalized));
|
||||
}
|
||||
|
||||
// Done total percent damage auras
|
||||
float DoneTotalMod = 1.0f;
|
||||
|
||||
// Some spells don't benefit from pct done mods
|
||||
if (spellProto)
|
||||
if (!spellProto->HasAttribute(SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS))
|
||||
if (spellProto && !spellProto->HasAttribute(SPELL_ATTR6_NO_DONE_PCT_DAMAGE_MODS))
|
||||
{
|
||||
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for (AuraEffect const* aurEff : mModDamagePercentDone)
|
||||
{
|
||||
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
// Apply mod if schoolmask matches...
|
||||
if ((aurEff->GetMiscValue() & spellProto->GetSchoolMask()) != 0)
|
||||
{
|
||||
if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL))
|
||||
{
|
||||
if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
else if (!(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
|
||||
AddPct(DoneTotalMod, (*i)->GetAmount());
|
||||
}
|
||||
SpellInfo const* aurSpellInfo = aurEff->GetSpellInfo();
|
||||
|
||||
// ... but not for SCHOOL_MASK_NORMAL, or generic weapon bonus, or creatures (creatures don't have equiped items check)
|
||||
// for these types the damage was already calculated in AuraEffect handler, and stored into TOTAL_PCT
|
||||
// if we include them, we'll be multiplying twice (one in Unit::CalculateDamage, the other here)
|
||||
if ((aurEff->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) && (aurSpellInfo->EquippedItemClass == -1 || GetTypeId() != TYPEID_PLAYER))
|
||||
continue;
|
||||
|
||||
// generic weapon bonus (magic)
|
||||
if (aurSpellInfo->EquippedItemClass == -1)
|
||||
AddPct(DoneTotalMod, aurEff->GetAmount());
|
||||
// skips subclassmask check/has generic subclassmask set
|
||||
else if (!aurSpellInfo->HasAttribute(SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK) && (aurSpellInfo->EquippedItemSubClassMask == 0))
|
||||
AddPct(DoneTotalMod, aurEff->GetAmount());
|
||||
|
||||
// This one is already applied in Player::_ApplyWeaponDependentAuraDamageMod
|
||||
/*
|
||||
else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements(aurSpellInfo))
|
||||
AddPct(DoneTotalMod, aurEff->GetAmount());
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AuraEffectList const& mDamageDoneVersus = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
|
||||
for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
|
||||
|
||||
Reference in new issue
Block a user