Core/Spells: ported SpellInterruptFlags updates from master branch and corrected some own implementations based on these new results
This commit is contained in:
1 parent
b2ab210da9
commit
83298b52a2
8 files changed
+78
-66
No files matched your search
@@ -830,17 +830,6 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
|
||||
else
|
||||
victim->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::Damage, 0);
|
||||
|
||||
// interrupt spells with SPELL_INTERRUPT_FLAG_ABORT_ON_DMG on absorbed damage (no dots)
|
||||
if (!damage && damagetype != DOT && cleanDamage && cleanDamage->absorbed_damage)
|
||||
if (victim != this && victim->GetTypeId() == TYPEID_PLAYER)
|
||||
if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
|
||||
if (spell->getState() == SPELL_STATE_PREPARING)
|
||||
{
|
||||
uint32 interruptFlags = spell->m_spellInfo->InterruptFlags;
|
||||
if ((interruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG) != 0)
|
||||
victim->InterruptNonMeleeSpells(false);
|
||||
}
|
||||
|
||||
// We're going to call functions which can modify content of the list during iteration over it's elements
|
||||
// Let's copy the list so we can prevent iterator invalidation
|
||||
AuraEffectList vCopyDamageCopy(victim->GetAuraEffectsByType(SPELL_AURA_SHARE_DAMAGE_PCT));
|
||||
@@ -1007,28 +996,48 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
|
||||
}
|
||||
}
|
||||
|
||||
if (damagetype != NODAMAGE && damage)
|
||||
if (damagetype != NODAMAGE)
|
||||
{
|
||||
if (victim != this && victim->GetTypeId() == TYPEID_PLAYER && // does not support creature push_back
|
||||
(!spellProto || !(spellProto->HasAttribute(SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE) || spellProto->HasAttribute(SPELL_ATTR3_TREAT_AS_PERIODIC))))
|
||||
if (victim != this
|
||||
&& (!spellProto || !(spellProto->HasAttribute(SPELL_ATTR7_NO_PUSHBACK_ON_DAMAGE) || spellProto->HasAttribute(SPELL_ATTR3_TREAT_AS_PERIODIC))))
|
||||
{
|
||||
if (damagetype != DOT)
|
||||
{
|
||||
if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
|
||||
{
|
||||
if (spell->getState() == SPELL_STATE_PREPARING)
|
||||
{
|
||||
uint32 interruptFlags = spell->m_spellInfo->InterruptFlags;
|
||||
if (interruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
|
||||
auto isCastInterrupted = [&]()
|
||||
{
|
||||
if ((victim->IsPlayer() && spell->m_spellInfo->InterruptFlags.HasFlag(SpellInterruptFlags::DamageCancelsPlayerOnly)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
auto isCastDelayed = [&]()
|
||||
{
|
||||
if (!damage)
|
||||
return false;
|
||||
|
||||
if ((victim->IsPlayer() && spell->m_spellInfo->InterruptFlags.HasFlag(SpellInterruptFlags::DamagePushbackPlayerOnly)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
if (isCastInterrupted())
|
||||
victim->InterruptNonMeleeSpells(false);
|
||||
else if (interruptFlags & SPELL_INTERRUPT_FLAG_PUSH_BACK)
|
||||
else if (isCastDelayed())
|
||||
spell->Delayed();
|
||||
}
|
||||
|
||||
if (Spell* spell = victim->m_currentSpells[CURRENT_CHANNELED_SPELL])
|
||||
if (spell->getState() == SPELL_STATE_CASTING)
|
||||
{
|
||||
if (spell->getState() == SPELL_STATE_CASTING && spell->m_spellInfo->HasChannelInterruptFlag(SpellAuraInterruptFlags::DamageChannelDuration) && damagetype != DOT)
|
||||
spell->DelayedChannel();
|
||||
}
|
||||
}
|
||||
|
||||
if (damage && victim->IsPlayer())
|
||||
if (Spell* spell = victim->m_currentSpells[CURRENT_CHANNELED_SPELL])
|
||||
if (spell->getState() == SPELL_STATE_CASTING && spell->m_spellInfo->HasChannelInterruptFlag(SpellAuraInterruptFlags::DamageChannelDuration))
|
||||
spell->DelayedChannel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9055,6 +9064,10 @@ void Unit::setDeathState(DeathState s)
|
||||
|
||||
void Unit::AtEnterCombat()
|
||||
{
|
||||
if (Spell* spell = m_currentSpells[CURRENT_GENERIC_SPELL])
|
||||
if (spell->getState() == SPELL_STATE_PREPARING && spell->m_spellInfo->InterruptFlags.HasFlag(SpellInterruptFlags::Combat))
|
||||
InterruptNonMeleeSpells(false);
|
||||
|
||||
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::EnteringCombat);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user