Core/Spells: corrected a check when retrieving mechanic immunities in cast and channel packets and fixed a typo in SMSG_CHANNEL_START that was overwriting school immunities with mechanic immunities instead

This commit is contained in:
Ovahlord
2021-04-27 15:42:50 +02:00
parent 3da9d31690
commit bf28dfcf0c
2 changed files with 9 additions and 4 deletions

View File

@@ -4903,7 +4903,7 @@ void Spell::SendChannelStart(uint32 duration)
{
packet.InterruptImmunities.emplace();
packet.InterruptImmunities->SchoolImmunities = schoolImmunityMask; // CastSchoolImmunities
packet.InterruptImmunities->SchoolImmunities = mechanicImmunityMask; // CastImmunities
packet.InterruptImmunities->Immunities = mechanicImmunityMask; // CastImmunities
}
if (m_spellInfo->HasAttribute(SPELL_ATTR8_HEAL_PREDICTION))

View File

@@ -3280,12 +3280,17 @@ uint32 SpellInfo::GetAllowedMechanicMask() const
uint32 SpellInfo::GetMechanicImmunityMask(Unit* caster) const
{
if (HasAttribute(SPELL_ATTR7_CAN_ALWAYS_BE_INTERRUPTED))
return 0;
bool canBeInterrupted = [&]()
{
return HasAttribute(SPELL_ATTR7_CAN_ALWAYS_BE_INTERRUPTED)
|| HasChannelInterruptFlag(SpellAuraInterruptFlags::Damage | SpellAuraInterruptFlags::EnteringCombat)
|| (caster->IsPlayer() && InterruptFlags.HasFlag(SpellInterruptFlags::DamageCancelsPlayerOnly))
|| PreventionType & SPELL_PREVENTION_TYPE_SILENCE;
}();
uint32 casterMechanicImmunityMask = caster->GetMechanicImmunityMask();
uint32 mechanicImmunityMask = 0;
if (CanBeInterrupted(caster))
if (canBeInterrupted)
{
if (casterMechanicImmunityMask & (1 << MECHANIC_INTERRUPT))
mechanicImmunityMask |= (1 << MECHANIC_INTERRUPT);