fix: Fixes pets from attacking themselves (#2265)
### Summary Stops pets from attacking themselves.
This commit is contained in:
parent
6f5b7f7a6b
commit
5667017874
3 changed files with 24 additions and 0 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue