Created
July 23, 2011 12:34
-
-
Save tobmaps/1101379 to your computer and use it in GitHub Desktop.
Pct damage reduction effects fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp | |
index cced511..39ded27 100755 | |
--- a/src/server/game/Entities/Unit/Unit.cpp | |
+++ b/src/server/game/Entities/Unit/Unit.cpp | |
@@ -10756,20 +10756,11 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32 | |
} | |
// ..taken | |
- int32 maxPositiveMod = 0; // max of the positive amount aura (that increase the damage taken) | |
- int32 sumNegativeMod = 0; // sum the negative amount aura (that reduce the damage taken) | |
- AuraEffectList const& mModDamagePercentTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); | |
- for (AuraEffectList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i) | |
- if ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto)) | |
- { | |
- if ((*i)->GetAmount() > 0) | |
- { | |
- if ((*i)->GetAmount() > maxPositiveMod) | |
- maxPositiveMod = (*i)->GetAmount(); | |
- } | |
- else | |
- sumNegativeMod += (*i)->GetAmount(); | |
- } | |
+ float TakenTotalMod = 1.0f; | |
+ | |
+ // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN | |
+ // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085) | |
+ TakenTotalMod *= victim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetSpellSchoolMask(spellProto)); | |
// .. taken pct: dummy auras | |
AuraEffectList const& mDummyAuras = victim->GetAuraEffectsByType(SPELL_AURA_DUMMY); | |
@@ -10786,16 +10777,13 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32 | |
float mod = victim->ToPlayer()->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE) * (-8.0f); | |
if (mod < (*i)->GetAmount()) | |
mod = (float)(*i)->GetAmount(); | |
- sumNegativeMod += int32(mod); | |
+ AddPctF(TakenTotalMod, mod); | |
} | |
break; | |
// Ebon Plague | |
case 1933: | |
if ((*i)->GetMiscValue() & (spellProto ? GetSpellSchoolMask(spellProto) : 0)) | |
- { | |
- if ((*i)->GetAmount() > maxPositiveMod) | |
- maxPositiveMod = (*i)->GetAmount(); | |
- } | |
+ AddPctF(TakenTotalMod, (*i)->GetAmount()); | |
break; | |
} | |
} | |
@@ -10804,7 +10792,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32 | |
AuraEffectList const& mOwnerTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); | |
for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i) | |
if ((*i)->GetCasterGUID() == GetGUID() && (*i)->IsAffectedOnSpell(spellProto)) | |
- sumNegativeMod += (*i)->GetAmount(); | |
+ AddPctF(TakenTotalMod, (*i)->GetAmount()); | |
// Mod damage from spell mechanic | |
if (uint32 mechanicMask = GetAllSpellMechanicMask(spellProto)) | |
@@ -10812,11 +10800,9 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellEntry const* spellProto, uint32 | |
AuraEffectList const& mDamageDoneMechanic = victim->GetAuraEffectsByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT); | |
for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i) | |
if (mechanicMask & uint32(1<<((*i)->GetMiscValue()))) | |
- sumNegativeMod += (*i)->GetAmount(); | |
+ AddPctF(TakenTotalMod, (*i)->GetAmount()); | |
} | |
- float TakenTotalMod = (sumNegativeMod + maxPositiveMod + 100.0f) / 100.0f; | |
- | |
// Taken/Done fixed damage bonus auras | |
int32 DoneAdvertisedBenefit = SpellBaseDamageBonus(GetSpellSchoolMask(spellProto)); | |
int32 TakenAdvertisedBenefit = SpellBaseDamageBonusForVictim(GetSpellSchoolMask(spellProto), victim); | |
@@ -11937,10 +11923,7 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT | |
} | |
// ..taken | |
- AuraEffectList const& mModDamagePercentTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN); | |
- for (AuraEffectList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i) | |
- if ((*i)->GetMiscValue() & GetMeleeDamageSchoolMask()) | |
- AddPctN(TakenTotalMod, (*i)->GetAmount()); | |
+ TakenTotalMod *= victim->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, GetMeleeDamageSchoolMask()); | |
// From caster spells | |
AuraEffectList const& mOwnerTaken = victim->GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment