From df96e053a554692127cce7148447147477351da8 Mon Sep 17 00:00:00 2001 From: ccrs Date: Thu, 27 Apr 2017 14:16:40 +0200 Subject: Core/Spell: move creature focus bellow the possible interruptions --- src/server/game/Spells/Spell.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3145f12d0b2..ff9ac128abd 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2945,15 +2945,6 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered else m_casttime = m_spellInfo->CalcCastTime(this); - if (m_caster->GetTypeId() == TYPEID_UNIT && !m_caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) // _UNIT actually means creature. for some reason. - if (!(m_spellInfo->IsNextMeleeSwingSpell() || IsAutoRepeat() || (_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING))) - { - if (m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget()) - m_caster->ToCreature()->FocusTarget(this, m_targets.GetObjectTarget()); - else if (m_spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST)) - m_caster->ToCreature()->FocusTarget(this, nullptr); - } - // don't allow channeled spells / spells with cast time to be cast while moving // exception are only channeled spells that have no casttime and SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING // (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in) @@ -2968,6 +2959,18 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered } } + // focus if not controlled creature + if (m_caster->GetTypeId() == TYPEID_UNIT && !m_caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) + { + if (!(m_spellInfo->IsNextMeleeSwingSpell() || IsAutoRepeat() || (_triggeredCastFlags & TRIGGERED_IGNORE_SET_FACING))) + { + if (m_targets.GetObjectTarget() && m_caster != m_targets.GetObjectTarget()) + m_caster->ToCreature()->FocusTarget(this, m_targets.GetObjectTarget()); + else if (m_spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST)) + m_caster->ToCreature()->FocusTarget(this, nullptr); + } + } + // set timer base at cast time ReSetTimer(); -- cgit v1.2.3