Better handling of movement generators when fear/confuse ends for a player.

Untested as a fix, but it is an improvement anyway.
This commit is contained in:
Olion 2015-09-24 14:10:12 +03:00 committed by Antz
parent 1cdfec704a
commit ab4425ad35

View File

@ -8570,7 +8570,7 @@ void Unit::SetFeared(bool apply, ObjectGuid casterGuid, uint32 spellID, uint32 t
{ {
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
GetMotionMaster()->MovementExpired(false); GetMotionMaster()->MovementExpired(GetTypeId() == TYPEID_PLAYER);
if (GetTypeId() != TYPEID_PLAYER && IsAlive()) if (GetTypeId() != TYPEID_PLAYER && IsAlive())
{ {
@ -8591,7 +8591,7 @@ void Unit::SetFeared(bool apply, ObjectGuid casterGuid, uint32 spellID, uint32 t
} }
if (GetTypeId() == TYPEID_PLAYER) if (GetTypeId() == TYPEID_PLAYER)
{ ((Player*)this)->SetClientControl(this, !apply); } { ((Player*)this)->SetClientControl(this, apply ? 0 : 1); }
} }
void Unit::SetConfused(bool apply, ObjectGuid casterGuid, uint32 spellID) void Unit::SetConfused(bool apply, ObjectGuid casterGuid, uint32 spellID)
@ -8613,23 +8613,23 @@ void Unit::SetConfused(bool apply, ObjectGuid casterGuid, uint32 spellID)
{ {
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED);
GetMotionMaster()->MovementExpired(false); GetMotionMaster()->MovementExpired(GetTypeId() == TYPEID_PLAYER);
if (GetTypeId() != TYPEID_PLAYER && IsAlive()) if (GetTypeId() != TYPEID_PLAYER && IsAlive())
{ {
// restore appropriate movement generator // restore appropriate movement generator
if (getVictim()) if (getVictim())
{ {
SetTargetGuid(getVictim()->GetObjectGuid()); SetTargetGuid(getVictim()->GetObjectGuid());
GetMotionMaster()->MoveChase(getVictim()); GetMotionMaster()->MoveChase(getVictim());
} }
else else
{ GetMotionMaster()->Initialize(); } { GetMotionMaster()->Initialize(); }
} }
} }
if (GetTypeId() == TYPEID_PLAYER) if (GetTypeId() == TYPEID_PLAYER)
{ ((Player*)this)->SetClientControl(this, !apply); } { ((Player*)this)->SetClientControl(this, apply ? 0 : 1); }
} }
void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid /*= ObjectGuid()*/) void Unit::SetFeignDeath(bool apply, ObjectGuid casterGuid /*= ObjectGuid()*/)