mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-22 03:18:22 +00:00
Cleanup IsAttackAllowed checks for bots and their pets
This commit is contained in:
+20
-19
@@ -743,28 +743,29 @@ bool Mob::IsAttackAllowed(Mob *target, bool isSpellAttack)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// can't damage own pet (applies to everthing)
|
// can't damage own pet (applies to everthing)
|
||||||
Mob *target_owner = target->GetOwner();
|
Mob* target_owner = target->GetOwner();
|
||||||
Mob *our_owner = GetOwner();
|
Mob* our_owner = GetOwner();
|
||||||
Mob* target_ultimate_owner = (target->IsBot() ? target->CastToBot()->GetBotOwner() : target->GetUltimateOwner());
|
|
||||||
Mob* our_ultimate_owner = (IsBot() ? CastToBot()->GetBotOwner() : GetUltimateOwner());
|
|
||||||
|
|
||||||
if (target_owner && target_owner == this) {
|
// Self-owner check
|
||||||
|
if (target_owner == this || our_owner == target) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (
|
|
||||||
IsBot() && target_ultimate_owner &&
|
// Bot-specific logic
|
||||||
(
|
if (IsBot()) {
|
||||||
(target_ultimate_owner == our_ultimate_owner) ||
|
Mob* target_ultimate_owner = target->IsBot() ? target->CastToBot()->GetBotOwner() : target->GetUltimateOwner();
|
||||||
(target_ultimate_owner->IsOfClientBot())
|
Mob* our_ultimate_owner = CastToBot()->GetBotOwner();
|
||||||
)
|
|
||||||
) {
|
if (target_ultimate_owner) {
|
||||||
return false;
|
if (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) {
|
// Bots should not attack their ultimate owner
|
||||||
return false;
|
if (our_ultimate_owner == target) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// invalidate for swarm pets for later on if their owner is a corpse
|
// invalidate for swarm pets for later on if their owner is a corpse
|
||||||
|
|||||||
Reference in New Issue
Block a user