mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 22:37:02 +00:00
[8381] Some refactoring work in Unit::m_currentSpells code.
* Restrict access, use enum args, move some repeated code parts to function. * Make m_selfContainer set only part of Unit::SetCurrentCastedSpell
This commit is contained in:
parent
1b1d013623
commit
74d27294aa
10 changed files with 70 additions and 69 deletions
|
|
@ -4681,15 +4681,16 @@ void Spell::EffectInterruptCast(uint32 /*i*/)
|
|||
|
||||
// TODO: not all spells that used this effect apply cooldown at school spells
|
||||
// also exist case: apply cooldown to interrupted cast only and to all spells
|
||||
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
|
||||
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
|
||||
{
|
||||
if (unitTarget->m_currentSpells[i])
|
||||
if (Spell* spell = unitTarget->GetCurrentSpell(CurrentSpellTypes(i)))
|
||||
{
|
||||
SpellEntry const* curSpellInfo = spell->m_spellInfo;
|
||||
// check if we can interrupt spell
|
||||
if ( unitTarget->m_currentSpells[i]->m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT && unitTarget->m_currentSpells[i]->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE )
|
||||
if ((curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT) && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE )
|
||||
{
|
||||
unitTarget->ProhibitSpellScholl(GetSpellSchoolMask(unitTarget->m_currentSpells[i]->m_spellInfo), GetSpellDuration(m_spellInfo));
|
||||
unitTarget->InterruptSpell(i,false);
|
||||
unitTarget->ProhibitSpellScholl(GetSpellSchoolMask(curSpellInfo), GetSpellDuration(m_spellInfo));
|
||||
unitTarget->InterruptSpell(CurrentSpellTypes(i),false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue