Core/Spells: Set UNIT_FIELD_TARGET to current spell cast target for proper facing the target

This commit is contained in:
Shauren
2011-07-15 12:33:03 +02:00
parent 944fb4c1b7
commit 1e3c23a4e8
27 changed files with 125 additions and 96 deletions
+10 -1
View File
@@ -528,7 +528,7 @@ m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
// Determine if spell can be reflected back to the caster
// Patch 1.2 notes: Spell Reflection no longer reflects abilities
m_canReflect = m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->Attributes & SPELL_ATTR0_ABILITY)
m_canReflect = m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->Attributes & SPELL_ATTR0_ABILITY)
&& !(m_spellInfo->AttributesEx & SPELL_ATTR1_CANT_BE_REFLECTED) && !(m_spellInfo->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY)
&& !IsPassiveSpell(m_spellInfo) && !IsPositiveSpell(m_spellInfo->Id);
@@ -2944,6 +2944,12 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
m_caster->SetCurrentCastedSpell(this);
SendSpellStart();
// set target for proper facing
if (m_casttime && !m_IsTriggeredSpell)
if (uint64 target = m_targets.GetUnitTargetGUID())
if (m_caster->GetGUID() != target && m_caster->GetTypeId() == TYPEID_UNIT)
m_caster->FocusTarget(this, target);
TriggerGlobalCooldown();
//item: first cast may destroy item and second cast causes crash
@@ -3578,6 +3584,9 @@ void Spell::finish(bool ok)
((Puppet*)charm)->UnSummon();
}
if (m_caster->GetTypeId() == TYPEID_UNIT)
m_caster->ReleaseFocus(this);
if (!ok)
return;