From 6b55faba065cd5d0519fb6e3e070a4a41d305cca Mon Sep 17 00:00:00 2001 From: ariel- Date: Sun, 22 Jan 2017 02:24:48 -0300 Subject: Core/Creature: don't allow turning if spell would cancel due to turning to face target Closes #18549 --- src/server/game/Entities/Creature/Creature.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 3883fdf1e6a..81bfdde8d19 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2848,8 +2848,10 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) if (m_focusSpell) return; + SpellInfo const* spellInfo = focusSpell->GetSpellInfo(); + // don't use spell focus for vehicle spells - if (focusSpell->GetSpellInfo()->HasAura(SPELL_AURA_CONTROL_VEHICLE)) + if (spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE)) return; if ((!target || target == this) && !focusSpell->GetCastTime()) // instant cast, untargeted (or self-targeted) spell doesn't need any facing updates @@ -2872,15 +2874,15 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) if ( // here we determine if the (relatively expensive) forced update is worth it, or whether we can afford to wait until the scheduled update tick ( // only require instant update for spells that actually have a visual - focusSpell->GetSpellInfo()->SpellVisual[0] || - focusSpell->GetSpellInfo()->SpellVisual[1] + spellInfo->SpellVisual[0] || + spellInfo->SpellVisual[1] ) && ( !focusSpell->GetCastTime() || // if the spell is instant cast - focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST) // client gets confused if we attempt to turn at the regularly scheduled update packet + spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST) // client gets confused if we attempt to turn at the regularly scheduled update packet ) ) { - std::list playersNearby; + std::vector playersNearby; GetPlayerListInGrid(playersNearby, GetVisibilityRange()); for (Player* player : playersNearby) { @@ -2891,7 +2893,7 @@ void Creature::FocusTarget(Spell const* focusSpell, WorldObject const* target) } } - bool canTurnDuringCast = !focusSpell->GetSpellInfo()->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST); + bool const canTurnDuringCast = !spellInfo->HasAttribute(SPELL_ATTR5_DONT_TURN_DURING_CAST) && !(spellInfo->ChannelInterruptFlags & AURA_INTERRUPT_FLAG_TURNING); // Face the target - we need to do this before the unit state is modified for no-turn spells if (target) SetFacingToObject(target); -- cgit v1.2.3