Core/Spells: dropped old dot clipping implementation and restored TC period and duration calculations in preparation of re-implementing it
This commit is contained in:
1 parent
6d89d242a7
commit
e3e4b2cf16
15 files changed
+227
-242
No files matched your search
@@ -2750,17 +2750,17 @@ void Unit::_UpdateAutoRepeatSpell()
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::SetCurrentCastSpell(Spell* pSpell)
|
||||
void Unit::SetCurrentCastSpell(Spell* spell)
|
||||
{
|
||||
ASSERT(pSpell); // nullptr may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
|
||||
ASSERT(spell); // nullptr may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
|
||||
|
||||
CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
|
||||
CurrentSpellTypes CSpellType = spell->GetCurrentContainer();
|
||||
|
||||
if (pSpell == m_currentSpells[CSpellType]) // avoid breaking self
|
||||
if (spell == m_currentSpells[CSpellType]) // avoid breaking self
|
||||
return;
|
||||
|
||||
// break same type spell if it is not delayed
|
||||
InterruptSpell(CSpellType, false, true, pSpell);
|
||||
InterruptSpell(CSpellType, false, true);
|
||||
|
||||
// special breakage effects:
|
||||
switch (CSpellType)
|
||||
@@ -2778,7 +2778,7 @@ void Unit::SetCurrentCastSpell(Spell* pSpell)
|
||||
InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
|
||||
m_AutoRepeatFirstCast = true;
|
||||
}
|
||||
if (pSpell->GetCastTime() > 0)
|
||||
if (spell->GetCastTime() > 0)
|
||||
AddUnitState(UNIT_STATE_CASTING);
|
||||
|
||||
break;
|
||||
@@ -2800,7 +2800,7 @@ void Unit::SetCurrentCastSpell(Spell* pSpell)
|
||||
case CURRENT_AUTOREPEAT_SPELL:
|
||||
{
|
||||
// only Auto Shoot does not break anything
|
||||
if (pSpell->GetSpellInfo()->Id != 75)
|
||||
if (spell->GetSpellInfo()->Id != 75)
|
||||
{
|
||||
// generic autorepeats break generic non-delayed and channeled non-delayed spells
|
||||
InterruptSpell(CURRENT_GENERIC_SPELL, false);
|
||||
@@ -2820,13 +2820,13 @@ void Unit::SetCurrentCastSpell(Spell* pSpell)
|
||||
m_currentSpells[CSpellType]->SetReferencedFromCurrent(false);
|
||||
|
||||
// set new current spell
|
||||
m_currentSpells[CSpellType] = pSpell;
|
||||
pSpell->SetReferencedFromCurrent(true);
|
||||
m_currentSpells[CSpellType] = spell;
|
||||
spell->SetReferencedFromCurrent(true);
|
||||
|
||||
pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]);
|
||||
spell->m_selfContainer = &(m_currentSpells[spell->GetCurrentContainer()]);
|
||||
}
|
||||
|
||||
void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool withInstant, Spell* interruptingSpell /* = nullptr */)
|
||||
void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool withInstant)
|
||||
{
|
||||
Spell* spell = m_currentSpells[spellType];
|
||||
if (!spell)
|
||||
@@ -2844,7 +2844,7 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi
|
||||
ToPlayer()->SendAutoRepeatCancel(this);
|
||||
|
||||
if (spell->getState() != SPELL_STATE_FINISHED)
|
||||
spell->cancel(interruptingSpell);
|
||||
spell->cancel();
|
||||
else
|
||||
{
|
||||
m_currentSpells[spellType] = nullptr;
|
||||
@@ -2898,19 +2898,19 @@ bool Unit::IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled, bool skipAu
|
||||
return false;
|
||||
}
|
||||
|
||||
void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id, bool withInstant /* = true */, Spell* interruptingSpell /* = nullptr */)
|
||||
void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id, bool withInstant /* = true */)
|
||||
{
|
||||
// generic spells are interrupted if they are not finished or delayed
|
||||
if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id == spell_id))
|
||||
InterruptSpell(CURRENT_GENERIC_SPELL, withDelayed, withInstant, interruptingSpell);
|
||||
InterruptSpell(CURRENT_GENERIC_SPELL, withDelayed, withInstant);
|
||||
|
||||
// autorepeat spells are interrupted if they are not finished or delayed
|
||||
if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id == spell_id))
|
||||
InterruptSpell(CURRENT_AUTOREPEAT_SPELL, withDelayed, withInstant, interruptingSpell);
|
||||
InterruptSpell(CURRENT_AUTOREPEAT_SPELL, withDelayed, withInstant);
|
||||
|
||||
// channeled spells are interrupted if they are not finished, even if they are delayed
|
||||
if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id == spell_id))
|
||||
InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, interruptingSpell);
|
||||
InterruptSpell(CURRENT_CHANNELED_SPELL, true, true);
|
||||
}
|
||||
|
||||
Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const
|
||||
@@ -3068,7 +3068,7 @@ Aura* Unit::_TryStackingOrRefreshingExistingAura(AuraCreateInfo& createInfo)
|
||||
}
|
||||
|
||||
// try to increase stack amount
|
||||
foundAura->ModStackAmount(1, AuraRemoveFlags::ByDefault);
|
||||
foundAura->ModStackAmount(1, AuraRemoveFlags::ByDefault, createInfo.ResetPeriodicTimer);
|
||||
return foundAura;
|
||||
}
|
||||
}
|
||||
@@ -3841,7 +3841,7 @@ bool IsInterruptFlagIgnoredForSpell(SpellAuraInterruptFlags flag, Unit const* un
|
||||
}
|
||||
|
||||
template <typename InterruptFlags>
|
||||
void Unit::RemoveAurasWithInterruptFlags(InterruptFlags flag, uint32 except, Spell* interruptingSpell /* = nullptr */)
|
||||
void Unit::RemoveAurasWithInterruptFlags(InterruptFlags flag, uint32 except)
|
||||
{
|
||||
if (!HasInterruptFlag(flag))
|
||||
return;
|
||||
@@ -3868,13 +3868,13 @@ void Unit::RemoveAurasWithInterruptFlags(InterruptFlags flag, uint32 except, Spe
|
||||
&& spell->GetSpellInfo()->HasChannelInterruptFlag(flag)
|
||||
&& spell->GetSpellInfo()->Id != except
|
||||
&& !IsInterruptFlagIgnoredForSpell(flag, this, spell->GetSpellInfo()))
|
||||
InterruptNonMeleeSpells(false, 0, true, interruptingSpell);
|
||||
InterruptNonMeleeSpells(false, 0, true);
|
||||
|
||||
UpdateInterruptMask();
|
||||
}
|
||||
|
||||
template TC_GAME_API void Unit::RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags flag, uint32 except, Spell* interruptingSpell);
|
||||
template TC_GAME_API void Unit::RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2 flag, uint32 except, Spell* interruptingSpell);
|
||||
template TC_GAME_API void Unit::RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags flag, uint32 except);
|
||||
template TC_GAME_API void Unit::RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2 flag, uint32 except);
|
||||
|
||||
void Unit::RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user