Core/Auras: Defined and implemented many new interrupt flags

This commit is contained in:
Shauren authored and Ovahlord committed 2021-03-24 14:53:30 +01:00
1 parent 45df49c826
commit fed82c1002
23 files changed
+264 -169

No files matched your search

+20 -6
View File
@@ -988,9 +988,11 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry, SpellEffectEntry const** effe
// SpellInterruptsEntry
SpellInterruptsEntry const* _interrupt = GetSpellInterrupts();
InterruptFlags = _interrupt ? _interrupt->InterruptFlags : 0;
AuraInterruptFlags = _interrupt ? _interrupt->AuraInterruptFlags[0] : 0;
ChannelInterruptFlags = _interrupt ? _interrupt->ChannelInterruptFlags[0] : 0;
AuraInterruptFlags = _interrupt ? SpellAuraInterruptFlags(_interrupt->AuraInterruptFlags[0]) : SpellAuraInterruptFlags::None;
AuraInterruptFlags2 = _interrupt? SpellAuraInterruptFlags2(_interrupt->AuraInterruptFlags[1]) : SpellAuraInterruptFlags2::None;
ChannelInterruptFlags = _interrupt ? SpellAuraInterruptFlags(_interrupt->ChannelInterruptFlags[0] ) : SpellAuraInterruptFlags::None;
ChannelInterruptFlags2 = _interrupt? SpellAuraInterruptFlags2(_interrupt->ChannelInterruptFlags[1]) : SpellAuraInterruptFlags2::None;
// SpellLevelsEntry
SpellLevelsEntry const* _levels = GetSpellLevels();
@@ -1109,6 +1111,11 @@ bool SpellInfo::HasOnlyDamageEffects() const
return true;
}
bool SpellInfo::HasAnyAuraInterruptFlag() const
{
return AuraInterruptFlags != SpellAuraInterruptFlags::None || AuraInterruptFlags2 != SpellAuraInterruptFlags2::None;
}
bool SpellInfo::IsExplicitDiscovery() const
{
return ((Effects[0].Effect == SPELL_EFFECT_CREATE_RANDOM_ITEM
@@ -1434,7 +1441,7 @@ bool SpellInfo::IsChanneled() const
bool SpellInfo::IsMoveAllowedChannel() const
{
return IsChanneled() && ((HasAttribute(SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING) && !(ChannelInterruptFlags & AURA_INTERRUPT_FLAG_MOVE)) || (!(ChannelInterruptFlags & (AURA_INTERRUPT_FLAG_MOVE | AURA_INTERRUPT_FLAG_TURNING))));
return IsChanneled() && ((HasAttribute(SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING) && !ChannelInterruptFlags.HasFlag(SpellAuraInterruptFlags::Moving | SpellAuraInterruptFlags::Turning)));
}
bool SpellInfo::NeedsComboPoints() const
@@ -2265,7 +2272,7 @@ void SpellInfo::_LoadSpellSpecific()
case SPELLFAMILY_GENERIC:
{
// Food / Drinks (mostly)
if (AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED)
if (HasAuraInterruptFlag(SpellAuraInterruptFlags::Standing))
{
bool food = false;
bool drink = false;
@@ -3079,6 +3086,8 @@ void SpellInfo::ApplyAllSpellImmunitiesTo(Unit* target, uint8 effIndex, bool app
auraSpellInfo->Id != Id); // Don't remove self
});
}
if (apply && schoolImmunity & SPELL_SCHOOL_MASK_NORMAL)
target->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::InvulnerabilityBuff);
}
if (uint32 mechanicImmunity = immuneInfo->MechanicImmuneMask)
@@ -3109,8 +3118,13 @@ void SpellInfo::ApplyAllSpellImmunitiesTo(Unit* target, uint8 effIndex, bool app
}
if (uint32 damageImmunity = immuneInfo->DamageSchoolMask)
{
target->ApplySpellImmune(Id, IMMUNITY_DAMAGE, damageImmunity, apply);
if (apply && damageImmunity & SPELL_SCHOOL_MASK_NORMAL)
target->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::InvulnerabilityBuff);
}
for (AuraType auraType : immuneInfo->AuraTypeImmune)
{
target->ApplySpellImmune(Id, IMMUNITY_STATE, auraType, apply);
@@ -3257,7 +3271,7 @@ uint32 SpellInfo::GetMechanicImmunityMask(Unit* caster, bool channeled) const
{
uint32 casterMechanicImmunityMask = caster->GetMechanicImmunityMask();
uint32 mechanicImmunityMask = 0;
uint32 flags = channeled ? ChannelInterruptFlags : InterruptFlags;
uint32 flags = channeled ? ChannelInterruptFlags.AsUnderlyingType() : InterruptFlags;
// @todo: research other interrupt flags
if (flags & SPELL_INTERRUPT_FLAG_INTERRUPT)