Core/Pet: additional check if it's a creature (#1248)

This commit is contained in:
Stoabrogga
2019-01-09 18:51:27 +01:00
committed by Viste(Кирилл)
parent 7a3a9a81b4
commit 0be44221d2
@@ -100,13 +100,18 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool ini
float angle = i_angle; float angle = i_angle;
if (i_target->GetTypeId() == TYPEID_PLAYER && owner->ToCreature()->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET) if (i_target->GetTypeId() == TYPEID_PLAYER)
{
Creature* creature = owner->ToCreature();
if (creature && creature->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET)
{ {
// fix distance and angle for vanity pets // fix distance and angle for vanity pets
dist = 0.3f; dist = 0.3f;
angle = PET_FOLLOW_ANGLE + M_PI * 0.2f; angle = PET_FOLLOW_ANGLE + M_PI * 0.2f;
size = i_target->GetCombatReach() - i_target->GetObjectSize(); size = i_target->GetCombatReach() - i_target->GetObjectSize();
} }
}
// Xinef: Fix follow angle for hostile units // Xinef: Fix follow angle for hostile units
if (angle == 0.0f && owner->GetVictim() && owner->GetVictim()->GetGUID() == i_target->GetGUID()) if (angle == 0.0f && owner->GetVictim() && owner->GetVictim()->GetGUID() == i_target->GetGUID())