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
+12 -9
View File
@@ -235,6 +235,9 @@ m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this)
m_duringRemoveFromWorld = false;
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE);
_focusSpell = NULL;
_targetLocked = false;
}
////////////////////////////////////////////////////////////
@@ -9579,7 +9582,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
m_attacking->_addAttacker(this);
// Set our target
SetUInt64Value(UNIT_FIELD_TARGET, victim->GetGUID());
SetTarget(victim->GetGUID());
if (meleeAttack)
AddUnitState(UNIT_STAT_MELEE_ATTACKING);
@@ -9621,7 +9624,7 @@ bool Unit::AttackStop()
m_attacking = NULL;
// Clear our target
SetUInt64Value(UNIT_FIELD_TARGET, 0);
SetTarget(0);
ClearUnitState(UNIT_STAT_MELEE_ATTACKING);
@@ -14334,7 +14337,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
// no more charges to use, prevent proc
if (useCharges && !i->aura->GetCharges())
continue;
bool takeCharges = false;
SpellEntry const* spellInfo = i->aura->GetSpellProto();
uint32 Id = i->aura->GetId();
@@ -15729,7 +15732,7 @@ void Unit::SetStunned(bool apply)
{
if (apply)
{
SetUInt64Value(UNIT_FIELD_TARGET, 0);
SetTarget(0);
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
// MOVEMENTFLAG_ROOT cannot be used in conjunction with
@@ -15755,7 +15758,7 @@ void Unit::SetStunned(bool apply)
else
{
if (isAlive() && getVictim())
SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID());
SetTarget(getVictim()->GetGUID());
// don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface)
Unit* pOwner = GetOwner();
@@ -15830,7 +15833,7 @@ void Unit::SetFeared(bool apply)
{
if (apply)
{
SetUInt64Value(UNIT_FIELD_TARGET, 0);
SetTarget(0);
Unit* caster = NULL;
Unit::AuraEffectList const& fearAuras = GetAuraEffectsByType(SPELL_AURA_MOD_FEAR);
@@ -15847,7 +15850,7 @@ void Unit::SetFeared(bool apply)
if (GetMotionMaster()->GetCurrentMovementGeneratorType() == FLEEING_MOTION_TYPE)
GetMotionMaster()->MovementExpired();
if (getVictim())
SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID());
SetTarget(getVictim()->GetGUID());
}
}
@@ -15859,7 +15862,7 @@ void Unit::SetConfused(bool apply)
{
if (apply)
{
SetUInt64Value(UNIT_FIELD_TARGET, 0);
SetTarget(0);
GetMotionMaster()->MoveConfused();
}
else
@@ -15869,7 +15872,7 @@ void Unit::SetConfused(bool apply)
if (GetMotionMaster()->GetCurrentMovementGeneratorType() == CONFUSED_MOTION_TYPE)
GetMotionMaster()->MovementExpired();
if (getVictim())
SetUInt64Value(UNIT_FIELD_TARGET, getVictim()->GetGUID());
SetTarget(getVictim()->GetGUID());
}
}