diff options
author | Shauren <shauren.trinity@gmail.com> | 2022-02-06 21:59:41 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-02-06 21:59:41 +0100 |
commit | a8cace4c7086c65b760cca38c922410b7400130c (patch) | |
tree | cf86e39cfbd37f97d54dd0958136120d8ffd6e82 /src | |
parent | fa3cba3a00bbb6286499818f6a1f8675579a9d78 (diff) |
Core/Spells: Do not register instant spells in Unit current spell containers when cast with TRIGGERED_IGNORE_CAST_IN_PROGRESS
This lets these spells be cast without interrupting the other spell that is currently being cast
Side effect of this change is that these instant spells cannot be interrupted
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index a2d737bb26c..891b3b060aa 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -562,7 +562,7 @@ m_spellValue(new SpellValue(m_spellInfo, caster)), _spellEvent(nullptr) m_spellState = SPELL_STATE_NULL; _triggeredCastFlags = triggerFlags; if (info->HasAttribute(SPELL_ATTR4_CAN_CAST_WHILE_CASTING)) - _triggeredCastFlags = TriggerCastFlags(uint32(_triggeredCastFlags) | TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_CAST_DIRECTLY); + _triggeredCastFlags = TriggerCastFlags(uint32(_triggeredCastFlags) | TRIGGERED_IGNORE_CAST_IN_PROGRESS); m_CastItem = nullptr; m_castItemGUID.Clear(); @@ -3336,6 +3336,12 @@ SpellCastResult Spell::prepare(SpellCastTargets const& targets, AuraEffect const cast(true); else { + // commented out !m_spellInfo->StartRecoveryTime, it forces instant spells with global cooldown to be processed in spell::update + // as a result a spell that passed CheckCast and should be processed instantly may suffer from this delayed process + // the easiest bug to observe is LoS check in AddUnitTarget, even if spell passed the CheckCast LoS check the situation can change in spell::update + // because target could be relocated in the meantime, making the spell fly to the air (no targets can be registered, so no effects processed, nothing in combat log) + bool willCastDirectly = !m_casttime && /*!m_spellInfo->StartRecoveryTime && */ GetCurrentContainer() == CURRENT_GENERIC_SPELL; + if (Unit* unitCaster = m_caster->ToUnit()) { // stealth must be removed at cast starting (at show channel bar) @@ -3343,18 +3349,17 @@ SpellCastResult Spell::prepare(SpellCastTargets const& targets, AuraEffect const if (!(_triggeredCastFlags & TRIGGERED_IGNORE_AURA_INTERRUPT_FLAGS) && m_spellInfo->IsBreakingStealth() && !m_spellInfo->HasAttribute(SPELL_ATTR2_IGNORE_ACTION_AURA_INTERRUPT_FLAGS)) unitCaster->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags::Action); - unitCaster->SetCurrentCastSpell(this); + // Do not register as current spell when requested to ignore cast in progress + // We don't want to interrupt that other spell with cast time + if (!willCastDirectly || !(_triggeredCastFlags & TRIGGERED_IGNORE_CAST_IN_PROGRESS)) + unitCaster->SetCurrentCastSpell(this); } SendSpellStart(); if (!(_triggeredCastFlags & TRIGGERED_IGNORE_GCD)) TriggerGlobalCooldown(); - // commented out !m_spellInfo->StartRecoveryTime, it forces instant spells with global cooldown to be processed in spell::update - // as a result a spell that passed CheckCast and should be processed instantly may suffer from this delayed process - // the easiest bug to observe is LoS check in AddUnitTarget, even if spell passed the CheckCast LoS check the situation can change in spell::update - // because target could be relocated in the meantime, making the spell fly to the air (no targets can be registered, so no effects processed, nothing in combat log) - if (!m_casttime && /*!m_spellInfo->StartRecoveryTime && */ GetCurrentContainer() == CURRENT_GENERIC_SPELL) + if (willCastDirectly) cast(true); } |