mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
*Do not allow client to interrupt instant spells. By thenecromancer
--HG-- branch : trunk
This commit is contained in:
@@ -3433,12 +3433,14 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell )
|
||||
pSpell->SetReferencedFromCurrent(true);
|
||||
}
|
||||
|
||||
void Unit::InterruptSpell(uint32 spellType, bool withDelayed)
|
||||
void Unit::InterruptSpell(uint32 spellType, bool withDelayed, bool withInstant)
|
||||
{
|
||||
assert(spellType < CURRENT_MAX_SPELL);
|
||||
|
||||
Spell *spell = m_currentSpells[spellType];
|
||||
if(spell && (withDelayed || spell->getState() != SPELL_STATE_DELAYED) )
|
||||
if(spell
|
||||
&& (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
|
||||
&& (withInstant || spell->GetCastTime() > 0))
|
||||
{
|
||||
// for example, do not let self-stun aura interrupt itself
|
||||
if(!spell->IsInterruptable())
|
||||
@@ -3482,19 +3484,19 @@ bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skip
|
||||
return(false);
|
||||
}
|
||||
|
||||
void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
|
||||
void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id, bool withInstant)
|
||||
{
|
||||
// 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);
|
||||
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);
|
||||
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);
|
||||
InterruptSpell(CURRENT_CHANNELED_SPELL,true,true);
|
||||
}
|
||||
|
||||
Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const
|
||||
|
||||
Reference in New Issue
Block a user