Pets should inherit owner's hostility status for the purposes of target checking
Based on patch by Toni.Shocker Fixes issue #3552 --HG-- branch : trunk
This commit is contained in:
@@ -11905,16 +11905,22 @@ bool Unit::canAttack(Unit const* target, bool force) const
|
||||
{
|
||||
if (IsFriendlyTo(target))
|
||||
return false;
|
||||
|
||||
if (GetTypeId()!=TYPEID_PLAYER)
|
||||
if (!IsHostileTo(target))
|
||||
{
|
||||
if (isPet())
|
||||
{
|
||||
if (Unit *owner = GetOwner())
|
||||
if (!(owner->canAttack(target)))
|
||||
return false;
|
||||
}
|
||||
else if (!IsHostileTo(target))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!IsHostileTo(target))
|
||||
return false;
|
||||
|
||||
//if (m_Vehicle && m_Vehicle == target->m_Vehicle)
|
||||
// return true;
|
||||
|
||||
if (!target->isAttackableByAOE() || target->hasUnitState(UNIT_STAT_DIED))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -154,8 +154,9 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
|
||||
if (!TargetUnit)
|
||||
return;
|
||||
|
||||
if (!pet->canAttack(TargetUnit))
|
||||
return;
|
||||
if (Unit *owner = pet->GetOwner())
|
||||
if (!owner->canAttack(TargetUnit))
|
||||
return;
|
||||
|
||||
// Not let attack through obstructions
|
||||
if (sWorld.getConfig(CONFIG_PET_LOS))
|
||||
|
||||
Reference in New Issue
Block a user