more target validation for bots to prevent pets from getting hit with AEs and pets trying to attack invalid targets

This commit is contained in:
nytmyr
2024-11-06 07:31:48 -06:00
parent 1d6d6a0f36
commit 95bf30740f
2 changed files with 26 additions and 2 deletions
+19 -2
View File
@@ -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 &&