aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/Creature.cpp4
-rw-r--r--src/game/Creature.h2
-rw-r--r--src/game/Totem.cpp4
-rw-r--r--src/game/Totem.h2
-rw-r--r--src/game/Unit.cpp22
-rw-r--r--src/game/Unit.h2
6 files changed, 17 insertions, 19 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index d1149a44c03..29ed9983cd2 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -1620,12 +1620,12 @@ bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo)
return Unit::IsImmunedToSpell(spellInfo);
}
-bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bool checkMechanic) const
+bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
{
if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->EffectMechanic[index] - 1)))
return true;
- return Unit::IsImmunedToSpellEffect(spellInfo, index, checkMechanic);
+ return Unit::IsImmunedToSpellEffect(spellInfo, index);
}
SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
diff --git a/src/game/Creature.h b/src/game/Creature.h
index b0447a31156..ad8dfc2b01c 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -448,7 +448,7 @@ class TRINITY_DLL_SPEC Creature : public Unit, public GridObject<Creature>
bool canCreatureAttack(Unit const *pVictim, bool force = true) const;
bool IsImmunedToSpell(SpellEntry const* spellInfo);
// redefine Unit::IsImmunedToSpell
- bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bool checkMechanic) const;
+ bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
// redefine Unit::IsImmunedToSpellEffect
bool isElite() const
{
diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp
index 027d6da731a..0358cc0c990 100644
--- a/src/game/Totem.cpp
+++ b/src/game/Totem.cpp
@@ -145,7 +145,7 @@ void Totem::UnSummon()
AddObjectToRemoveList();
}
-bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bool checkMechanic) const
+bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
{
// TODO: possibly all negative auras immune?
if(GetEntry() == 5925)
@@ -160,5 +160,5 @@ bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bo
default:
break;
}
- return Creature::IsImmunedToSpellEffect(spellInfo, index, checkMechanic);
+ return Creature::IsImmunedToSpellEffect(spellInfo, index);
}
diff --git a/src/game/Totem.h b/src/game/Totem.h
index b48786b139a..1234f3549f8 100644
--- a/src/game/Totem.h
+++ b/src/game/Totem.h
@@ -54,7 +54,7 @@ class Totem : public Minion
void UpdateAttackPowerAndDamage(bool /*ranged*/ ) {}
void UpdateDamagePhysical(WeaponAttackType /*attType*/) {}
- bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bool checkMechanic) const;
+ bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
protected:
TotemType m_type;
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 070cabbe563..915410430f3 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -10743,9 +10743,10 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
for (int i=0;i<3;++i)
{
// State/effect immunities applied by aura expect full spell immunity
- // However function also check for mechanic, so ignore that for now
- if (IsImmunedToSpellEffect(spellInfo, i, false))
- return true;
+ // Ignore effects with mechanic, they are supposed to be checked separately
+ if (!spellInfo->EffectMechanic[i])
+ if (IsImmunedToSpellEffect(spellInfo, i))
+ return true;
}
if (spellInfo->Id != 42292 && spellInfo->Id !=59752)
@@ -10761,7 +10762,7 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
return false;
}
-bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bool checkMechanic) const
+bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
{
if (!spellInfo)
return false;
@@ -10772,15 +10773,12 @@ bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, boo
if (itr->type == effect)
return true;
- if (checkMechanic)
+ if (uint32 mechanic = spellInfo->EffectMechanic[index])
{
- if (uint32 mechanic = spellInfo->EffectMechanic[index])
- {
- SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
- for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
- if (itr->type == spellInfo->EffectMechanic[index])
- return true;
- }
+ SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
+ for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
+ if (itr->type == spellInfo->EffectMechanic[index])
+ return true;
}
if (uint32 aura = spellInfo->EffectApplyAuraName[index])
diff --git a/src/game/Unit.h b/src/game/Unit.h
index b1581c6a329..a0614298484 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1824,7 +1824,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
// redefined in Creature
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask);
bool IsImmunedToDamage(SpellEntry const* spellInfo);
- virtual bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bool checkMechanic=true) const;
+ virtual bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
// redefined in Creature
uint32 CalcNotIgnoreDamageRedunction( uint32 damage, SpellSchoolMask damageSchoolMask);
uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType=MAX_ATTACK);