mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
Allow state/effect immunities ignore whole spell when one effect is immuned
(Fixes getting part of CC auras with some immunities) --HG-- branch : trunk
This commit is contained in:
@@ -1598,12 +1598,12 @@ bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo)
|
||||
return Unit::IsImmunedToSpell(spellInfo);
|
||||
}
|
||||
|
||||
bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
|
||||
bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bool checkMechanic) const
|
||||
{
|
||||
if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->EffectMechanic[index] - 1)))
|
||||
return true;
|
||||
|
||||
return Unit::IsImmunedToSpellEffect(spellInfo, index);
|
||||
return Unit::IsImmunedToSpellEffect(spellInfo, index, checkMechanic);
|
||||
}
|
||||
|
||||
SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
|
||||
|
||||
@@ -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) const;
|
||||
bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bool checkMechanic) const;
|
||||
// redefine Unit::IsImmunedToSpellEffect
|
||||
bool isElite() const
|
||||
{
|
||||
|
||||
@@ -145,7 +145,7 @@ void Totem::UnSummon()
|
||||
AddObjectToRemoveList();
|
||||
}
|
||||
|
||||
bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
|
||||
bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bool checkMechanic) const
|
||||
{
|
||||
// TODO: possibly all negative auras immune?
|
||||
if(GetEntry() == 5925)
|
||||
@@ -160,5 +160,5 @@ bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) co
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return Creature::IsImmunedToSpellEffect(spellInfo, index);
|
||||
return Creature::IsImmunedToSpellEffect(spellInfo, index, checkMechanic);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class Totem : public Minion
|
||||
void UpdateAttackPowerAndDamage(bool /*ranged*/ ) {}
|
||||
void UpdateDamagePhysical(WeaponAttackType /*attType*/) {}
|
||||
|
||||
bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
|
||||
bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bool checkMechanic) const;
|
||||
|
||||
protected:
|
||||
TotemType m_type;
|
||||
|
||||
@@ -10653,6 +10653,14 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
|
||||
if (itr->type == spellInfo->Mechanic)
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (spellInfo->Id != 42292 && spellInfo->Id !=59752)
|
||||
{
|
||||
@@ -10667,7 +10675,7 @@ bool Unit::IsImmunedToSpell(SpellEntry const* spellInfo)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
|
||||
bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bool checkMechanic) const
|
||||
{
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
@@ -10678,12 +10686,15 @@ bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) con
|
||||
if (itr->type == effect)
|
||||
return true;
|
||||
|
||||
if (uint32 mechanic = spellInfo->EffectMechanic[index])
|
||||
if (checkMechanic)
|
||||
{
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
|
||||
if (uint32 aura = spellInfo->EffectApplyAuraName[index])
|
||||
|
||||
@@ -1817,7 +1817,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) const;
|
||||
virtual bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index, bool checkMechanic=true) const;
|
||||
// redefined in Creature
|
||||
uint32 CalcNotIgnoreDamageRedunction( uint32 damage, SpellSchoolMask damageSchoolMask);
|
||||
uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType=MAX_ATTACK);
|
||||
|
||||
Reference in New Issue
Block a user