fix(Core/Pet): Fix player pets attack (#22601)
Co-authored-by: PkllonG <PkllonG@users.noreply.github.com>
This commit is contained in:
parent
cd87350a17
commit
548447ffb0
1 changed files with 3 additions and 5 deletions
|
|
@ -2683,15 +2683,13 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const
|
|||
if (skipDistCheck)
|
||||
return true;
|
||||
|
||||
float dist = sWorld->getFloatConfig(CONFIG_CREATURE_LEASH_RADIUS);
|
||||
|
||||
if (Unit* unit = GetCharmerOrOwner())
|
||||
{
|
||||
float visibilityDist = std::min<float>(GetMap()->GetVisibilityRange() + GetObjectSize() * 2, 150.0f);
|
||||
if (!victim->IsWithinDist(unit, visibilityDist))
|
||||
return false;
|
||||
float visibilityDist = std::min<float>(GetMap()->GetVisibilityRange() + GetObjectSize() * 2, DEFAULT_VISIBILITY_DISTANCE);
|
||||
return victim->IsWithinDist(unit, visibilityDist);
|
||||
}
|
||||
|
||||
float dist = sWorld->getFloatConfig(CONFIG_CREATURE_LEASH_RADIUS);
|
||||
if (!dist)
|
||||
return true;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue