Merge branch '3.3.5-spellfacing' into 3.3.5-base (PR #15641)

(cherry picked from commit 233297c5c8)
This commit is contained in:
treeston
2016-01-13 18:38:54 +01:00
committed by Shauren
parent 21371075ff
commit 009cabb4b9
8 changed files with 179 additions and 38 deletions
+17 -6
View File
@@ -262,7 +262,8 @@ Unit::Unit(bool isWorldObject) :
for (uint8 i = 0; i < MAX_STATS; ++i)
m_createStats[i] = 0.0f;
m_attacking = NULL;
m_attacking = nullptr;
m_shouldReacquireTarget = false;
if (GetTypeId() == TYPEID_PLAYER)
{
m_modMeleeHitChance = 7.5f;
@@ -285,7 +286,7 @@ Unit::Unit(bool isWorldObject) :
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
m_speed_rate[i] = 1.0f;
m_charmInfo = NULL;
m_charmInfo = nullptr;
_redirectThreadInfo = RedirectThreatInfo();
@@ -1887,6 +1888,9 @@ void Unit::AttackerStateUpdate (Unit* victim, WeaponAttackType attType, bool ext
if (attType != BASE_ATTACK && attType != OFF_ATTACK)
return; // ignore ranged case
if (GetTypeId() == TYPEID_UNIT && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
SetFacingToObject(victim); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
// melee attack spell cast at main hand attack only - no normal melee dmg dealt
if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL] && !extra)
m_currentSpells[CURRENT_MELEE_SPELL]->cast();
@@ -7247,6 +7251,12 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
if (HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
RemoveAurasByType(SPELL_AURA_MOD_UNATTACKABLE);
if (m_shouldReacquireTarget)
{
SetTarget(victim->GetGUID());
m_shouldReacquireTarget = false;
}
if (m_attacking)
{
if (m_attacking == victim)
@@ -7332,7 +7342,7 @@ bool Unit::AttackStop()
Unit* victim = m_attacking;
m_attacking->_removeAttacker(this);
m_attacking = NULL;
m_attacking = nullptr;
// Clear our target
SetTarget(ObjectGuid::Empty);
@@ -10768,7 +10778,7 @@ Unit* Creature::SelectVictim()
// next-victim-selection algorithm and evade mode are called
// threat list sorting etc.
Unit* target = NULL;
Unit* target = nullptr;
// First checking if we have some taunt on us
AuraEffectList const& tauntAuras = GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT);
if (!tauntAuras.empty())
@@ -10836,7 +10846,8 @@ Unit* Creature::SelectVictim()
if (target && _IsTargetAcceptable(target) && CanCreatureAttack(target))
{
SetInFront(target);
if(!IsFocusing())
SetInFront(target);
return target;
}
@@ -15781,7 +15792,7 @@ void Unit::SetFacingTo(float ori)
init.Launch();
}
void Unit::SetFacingToObject(WorldObject* object)
void Unit::SetFacingToObject(WorldObject const* object)
{
// never face when already moving
if (!IsStopped())