mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 07:48:02 +00:00
fix(Core/Spells): allow friendly auras during Divine Shield (#26052)
This commit is contained in:
@@ -10017,7 +10017,12 @@ bool Unit::IsImmunedToAuraPeriodicTick(Unit const* caster, SpellInfo const* spel
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell)
|
bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Unit const* caster)
|
||||||
|
{
|
||||||
|
return IsImmunedToSpell(spellInfo, caster, spellInfo ? spellInfo->GetSchoolMask() : SPELL_SCHOOL_MASK_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Unit const* caster, SpellSchoolMask spellSchoolMask)
|
||||||
{
|
{
|
||||||
if (!spellInfo)
|
if (!spellInfo)
|
||||||
return false;
|
return false;
|
||||||
@@ -10063,7 +10068,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Xinef: if target is immune to one effect, and the spell has transform aura - it is immune to whole spell
|
// Xinef: if target is immune to one effect, and the spell has transform aura - it is immune to whole spell
|
||||||
if (IsImmunedToSpellEffect(spellInfo, i))
|
if (IsImmunedToSpellEffect(spellInfo, i, caster))
|
||||||
{
|
{
|
||||||
if (spellInfo->HasAura(SPELL_AURA_TRANSFORM))
|
if (spellInfo->HasAura(SPELL_AURA_TRANSFORM))
|
||||||
return true;
|
return true;
|
||||||
@@ -10078,13 +10083,6 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell)
|
|||||||
|
|
||||||
if (!spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
|
if (!spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
|
||||||
{
|
{
|
||||||
SpellSchoolMask spellSchoolMask = spellInfo->GetSchoolMask();
|
|
||||||
Unit const* spellCaster = spell ? spell->GetCaster() : nullptr;
|
|
||||||
if (spell)
|
|
||||||
{
|
|
||||||
spellSchoolMask = spell->GetSpellSchoolMask();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (spellSchoolMask != SPELL_SCHOOL_MASK_NONE)
|
if (spellSchoolMask != SPELL_SCHOOL_MASK_NONE)
|
||||||
{
|
{
|
||||||
SpellImmuneContainer const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
|
SpellImmuneContainer const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
|
||||||
@@ -10097,7 +10095,7 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell)
|
|||||||
if (!(itr->first & spellSchoolMask))
|
if (!(itr->first & spellSchoolMask))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (IgnoresSchoolImmunityFromFriendlyCaster(spellCaster, itr->second, immuneSpellInfo))
|
if (IgnoresSchoolImmunityFromFriendlyCaster(caster, itr->second, immuneSpellInfo))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (spellInfo->CanPierceImmuneAura(immuneSpellInfo))
|
if (spellInfo->CanPierceImmuneAura(immuneSpellInfo))
|
||||||
@@ -10111,6 +10109,16 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell)
|
||||||
|
{
|
||||||
|
if (!spellInfo)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Unit const* spellCaster = spell ? spell->GetCaster() : nullptr;
|
||||||
|
SpellSchoolMask spellSchoolMask = spell ? spell->GetSpellSchoolMask() : spellInfo->GetSchoolMask();
|
||||||
|
return IsImmunedToSpell(spellInfo, spellCaster, spellSchoolMask);
|
||||||
|
}
|
||||||
|
|
||||||
bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit const* caster /*= nullptr*/) const
|
bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index, Unit const* caster /*= nullptr*/) const
|
||||||
{
|
{
|
||||||
if (!spellInfo || !spellInfo->Effects[index].IsEffect())
|
if (!spellInfo || !spellInfo->Effects[index].IsEffect())
|
||||||
|
|||||||
@@ -1637,6 +1637,8 @@ public:
|
|||||||
// Spells immunities
|
// Spells immunities
|
||||||
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType = SPELL_BLOCK_TYPE_ALL);
|
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType = SPELL_BLOCK_TYPE_ALL);
|
||||||
virtual bool IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell = nullptr);
|
virtual bool IsImmunedToSpell(SpellInfo const* spellInfo, Spell const* spell = nullptr);
|
||||||
|
bool IsImmunedToSpell(SpellInfo const* spellInfo, Unit const* caster);
|
||||||
|
bool IsImmunedToSpell(SpellInfo const* spellInfo, Unit const* caster, SpellSchoolMask spellSchoolMask);
|
||||||
bool IsImmunedToSpell(SpellInfo const* spellInfo, uint32 effectMask, Unit const* caster = nullptr);
|
bool IsImmunedToSpell(SpellInfo const* spellInfo, uint32 effectMask, Unit const* caster = nullptr);
|
||||||
bool IgnoresSchoolImmunityFromFriendlyCaster(Unit const* caster, uint32 immunityAuraId, SpellInfo const* immunitySpellInfo) const;
|
bool IgnoresSchoolImmunityFromFriendlyCaster(Unit const* caster, uint32 immunityAuraId, SpellInfo const* immunitySpellInfo) const;
|
||||||
[[nodiscard]] bool IsImmunedToDamage(SpellSchoolMask schoolMask) const;
|
[[nodiscard]] bool IsImmunedToDamage(SpellSchoolMask schoolMask) const;
|
||||||
|
|||||||
@@ -597,7 +597,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
|
|||||||
if ((itr->second & (1 << effIndex)) && itr->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex, GetCaster()))
|
if ((itr->second & (1 << effIndex)) && itr->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex, GetCaster()))
|
||||||
itr->second &= ~(1 << effIndex);
|
itr->second &= ~(1 << effIndex);
|
||||||
}
|
}
|
||||||
if (!itr->second || itr->first->IsImmunedToSpell(GetSpellInfo()) || !CanBeAppliedOn(itr->first))
|
if (!itr->second || itr->first->IsImmunedToSpell(GetSpellInfo(), GetCaster()) || !CanBeAppliedOn(itr->first))
|
||||||
addUnit = false;
|
addUnit = false;
|
||||||
|
|
||||||
if (addUnit && !itr->first->IsHighestExclusiveAura(this, true))
|
if (addUnit && !itr->first->IsHighestExclusiveAura(this, true))
|
||||||
|
|||||||
Reference in New Issue
Block a user