Skip to content

Commit

Permalink
[10485] Check school mask for SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
Browse files Browse the repository at this point in the history
* Some spells expect this.
* Check SPELL_AURA_MOD_PET_AOE_DAMAGE_AVOIDANCE just for similarity,
  currently no spels with aura 310 with special school masks.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
  • Loading branch information
darkstalker authored and VladimirMangos committed Sep 14, 2010
1 parent 276bb1f commit 03c389d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 7 additions & 10 deletions src/game/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6397,17 +6397,14 @@ uint32 Unit::SpellDamageBonusTaken(Unit *pCaster, SpellEntry const *spellProto,
if(!spellProto || !pCaster || damagetype==DIRECT_DAMAGE )
return pdamage;

uint32 schoolMask = spellProto->SchoolMask;

// Taken total percent damage auras
float TakenTotalMod = 1.0f;
int32 TakenTotal = 0;

// ..taken
AuraList const& mModDamagePercentTaken = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i)
{
if ((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto))
TakenTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
}
TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, schoolMask);

// .. taken pct: dummy auras
if (GetTypeId() == TYPEID_PLAYER)
Expand Down Expand Up @@ -6436,9 +6433,9 @@ uint32 Unit::SpellDamageBonusTaken(Unit *pCaster, SpellEntry const *spellProto,
// Mod damage taken from AoE spells
if(IsAreaOfEffectSpell(spellProto))
{
TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE);
TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask);
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
TakenTotalMod *= GetTotalAuraMultiplier(SPELL_AURA_MOD_PET_AOE_DAMAGE_AVOIDANCE);
TakenTotalMod *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_PET_AOE_DAMAGE_AVOIDANCE, schoolMask);
}

// Taken fixed damage bonus auras
Expand Down Expand Up @@ -7363,9 +7360,9 @@ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackTyp
// ..taken pct (aoe avoidance)
if(spellProto && IsAreaOfEffectSpell(spellProto))
{
TakenPercent *= GetTotalAuraMultiplier(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE);
TakenPercent *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask);
if (GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
TakenPercent *= GetTotalAuraMultiplier(SPELL_AURA_MOD_PET_AOE_DAMAGE_AVOIDANCE);
TakenPercent *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_PET_AOE_DAMAGE_AVOIDANCE, schoolMask);
}

// special dummys/class scripts and other effects
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10484"
#define REVISION_NR "10485"
#endif // __REVISION_NR_H__

0 comments on commit 03c389d

Please sign in to comment.