fix: Fixes movement pathing while in combat (#2271)

This commit is contained in:
Bohica 2025-11-16 10:14:06 -08:00 • committed by GitHub
parent 051f22ff93
commit ee1a40bb51
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 10 additions and 16 deletions

View file

@ -55,7 +55,7 @@ public class AnimalAI : BaseAI
return true; return true;
} }
if (!WalkMobileRange(combatant, 1, true, Mobile.RangeFight, Mobile.RangeFight)) if (!WalkMobileRange(combatant, 1, false, Mobile.RangeFight, Mobile.RangeFight))
{ {
if (Mobile.GetDistanceToSqrt(combatant) > Mobile.RangePerception + 1) if (Mobile.GetDistanceToSqrt(combatant) > Mobile.RangePerception + 1)
{ {

View file

@ -41,13 +41,7 @@ public class ArcherAI : BaseAI
return true; return true;
} }
if (Core.TickCount - Mobile.LastMoveTime > 1000 && !WalkMobileRange( if (!WalkMobileRange(combatant, 1, false, Mobile.RangeFight, Mobile.Weapon.MaxRange))
combatant,
1,
true,
Mobile.RangeFight,
Mobile.Weapon.MaxRange
))
{ {
this.DebugSayFormatted($"I am still not in range of {combatant.Name}"); this.DebugSayFormatted($"I am still not in range of {combatant.Name}");

View file

@ -38,7 +38,7 @@ public class BerserkAI : BaseAI
return true; return true;
} }
if (!WalkMobileRange(combatant, 1, true, Mobile.RangeFight, Mobile.RangeFight)) if (!WalkMobileRange(combatant, 1, false, Mobile.RangeFight, Mobile.RangeFight))
{ {
this.DebugSayFormatted($"I am still not in range of {combatant.Name}"); this.DebugSayFormatted($"I am still not in range of {combatant.Name}");

View file

@ -168,7 +168,7 @@ public class MageAI : BaseAI
{ {
if (!SmartAI) if (!SmartAI)
{ {
if (!MoveTo(m, true, Mobile.RangeFight)) if (!MoveTo(m, false, Mobile.RangeFight))
{ {
OnFailedMove(); OnFailedMove();
} }
@ -182,14 +182,14 @@ public class MageAI : BaseAI
{ {
RunFrom(m); RunFrom(m);
} }
else if (!Mobile.InRange(m, Math.Max(Mobile.RangeFight, 2)) && !MoveTo(m, true, 1)) else if (!Mobile.InRange(m, Math.Max(Mobile.RangeFight, 2)) && !MoveTo(m, false, 1))
{ {
OnFailedMove(); OnFailedMove();
} }
} }
else if (!Mobile.InRange(m, Mobile.RangeFight)) else if (!Mobile.InRange(m, Mobile.RangeFight))
{ {
if (!MoveTo(m, true, 1)) if (!MoveTo(m, false, 1))
{ {
OnFailedMove(); OnFailedMove();
} }

View file

@ -67,7 +67,7 @@ public class MeleeAI : BaseAI
} }
} }
if (!MoveTo(combatant, true, Mobile.RangeFight)) if (!MoveTo(combatant, false, Mobile.RangeFight))
{ {
if (AcquireFocusMob(Mobile.RangePerception, Mobile.FightMode, false, false, true)) if (AcquireFocusMob(Mobile.RangePerception, Mobile.FightMode, false, false, true))
{ {

View file

@ -41,7 +41,7 @@ public class PredatorAI : BaseAI
return true; return true;
} }
if (!WalkMobileRange(combatant, 1, true, Mobile.RangeFight, Mobile.RangeFight)) if (!WalkMobileRange(combatant, 1, false, Mobile.RangeFight, Mobile.RangeFight))
{ {
if (Mobile.GetDistanceToSqrt(combatant) > Mobile.RangePerception + 1) if (Mobile.GetDistanceToSqrt(combatant) > Mobile.RangePerception + 1)
{ {

View file

@ -43,7 +43,7 @@ public class ThiefAI : BaseAI
return true; return true;
} }
if (!WalkMobileRange(combatant, 1, true, Mobile.RangeFight, Mobile.RangeFight)) if (!WalkMobileRange(combatant, 1, false, Mobile.RangeFight, Mobile.RangeFight))
{ {
this.DebugSayFormatted($"I should be closer to {combatant.Name}"); this.DebugSayFormatted($"I should be closer to {combatant.Name}");
} }

View file

@ -93,7 +93,7 @@ public abstract partial class BaseFamiliar : BaseCreature
Hidden = m_LastHidden = master.Hidden; Hidden = m_LastHidden = master.Hidden;
} }
if (AIObject?.WalkMobileRange(master, 5, true, 1, 1) == true) if (AIObject?.WalkMobileRange(master, 5, false, 1, 1) == true)
{ {
Warmode = master.Warmode; Warmode = master.Warmode;
Combatant = master.Combatant; Combatant = master.Combatant;