diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 1a8c7b929..4f1d65831 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -745,10 +745,27 @@ bool Mob::IsAttackAllowed(Mob *target, bool isSpellAttack) // can't damage own pet (applies to everthing) Mob *target_owner = target->GetOwner(); Mob *our_owner = GetOwner(); - if(target_owner && target_owner == this) + Mob* target_ultimate_owner = target->GetUltimateOwner(); + Mob* our_ultimate_owner = GetUltimateOwner(); + + if (target_owner && target_owner == this) { return false; - else if(our_owner && our_owner == target) + } + else if ( + IsBot() && target_ultimate_owner && + ( + (target_ultimate_owner == our_ultimate_owner) || + (target_ultimate_owner->IsOfClientBot()) + ) + ) { return false; + } + else if (our_owner && our_owner == target) { + return false; + } + else if (IsBot() && our_ultimate_owner && our_ultimate_owner == target) { + return false; + } // invalidate for swarm pets for later on if their owner is a corpse if (IsNPC() && CastToNPC()->GetSwarmInfo() && our_owner && diff --git a/zone/bot.cpp b/zone/bot.cpp index 79b7a02f0..0737d0961 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -2113,6 +2113,13 @@ void Bot::AI_Process() // TARGET VALIDATION if (!IsValidTarget(bot_owner, leash_owner, lo_distance, leash_distance, tar, tar_distance)) { + if (HasPet()) { + if (tar && GetPet()->GetTarget() && GetPet()->GetTarget() == tar) { + GetPet()->WipeHateList(); + GetPet()->SetTarget(nullptr); + } + } + return; }