From 5667017874c4084b137b82bee48de3b6703c7f3e Mon Sep 17 00:00:00 2001 From: Bohica <53943479+Bohicatv@users.noreply.github.com> Date: Sat, 15 Nov 2025 10:15:10 -0800 Subject: [PATCH] fix: Fixes pets from attacking themselves (#2265) ### Summary Stops pets from attacking themselves. --- Projects/UOContent/Mobiles/AI/AnimalAI.cs | 8 ++++++++ Projects/UOContent/Mobiles/AI/MageAI.cs | 8 ++++++++ Projects/UOContent/Mobiles/AI/MeleeAI.cs | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/Projects/UOContent/Mobiles/AI/AnimalAI.cs b/Projects/UOContent/Mobiles/AI/AnimalAI.cs index 9e33414c7..a25355078 100644 --- a/Projects/UOContent/Mobiles/AI/AnimalAI.cs +++ b/Projects/UOContent/Mobiles/AI/AnimalAI.cs @@ -46,6 +46,14 @@ public class AnimalAI : BaseAI { var combatant = Mobile.Combatant; + if (Mobile.Controlled && combatant == Mobile) + { + DebugSay("I should not attack myself!"); + Mobile.Combatant = null; + Action = ActionType.Guard; + return true; + } + if (combatant == null || combatant.Deleted || combatant.Map != Mobile.Map || !combatant.Alive || combatant.IsDeadBondedPet) { diff --git a/Projects/UOContent/Mobiles/AI/MageAI.cs b/Projects/UOContent/Mobiles/AI/MageAI.cs index 03fe60a6a..c1e6b70f4 100644 --- a/Projects/UOContent/Mobiles/AI/MageAI.cs +++ b/Projects/UOContent/Mobiles/AI/MageAI.cs @@ -624,6 +624,14 @@ public class MageAI : BaseAI var c = Mobile.Combatant; Mobile.Warmode = true; + if (Mobile.Controlled && c == Mobile) + { + DebugSay("I should not attack myself!"); + Mobile.Combatant = null; + Action = ActionType.Guard; + return true; + } + if (c?.Deleted != false || !c.Alive || c.IsDeadBondedPet || !Mobile.CanSee(c) || !Mobile.CanBeHarmful(c, false) || c.Map != Mobile.Map) { diff --git a/Projects/UOContent/Mobiles/AI/MeleeAI.cs b/Projects/UOContent/Mobiles/AI/MeleeAI.cs index edf0b108e..44fe40370 100644 --- a/Projects/UOContent/Mobiles/AI/MeleeAI.cs +++ b/Projects/UOContent/Mobiles/AI/MeleeAI.cs @@ -33,6 +33,14 @@ public class MeleeAI : BaseAI { var combatant = Mobile.Combatant; + if (Mobile.Controlled && combatant == Mobile) + { + DebugSay("I should not attack myself!"); + Mobile.Combatant = null; + Action = ActionType.Guard; + return true; + } + if (combatant == null || combatant.Deleted || combatant.Map != Mobile.Map || !combatant.Alive || combatant.IsDeadBondedPet) {