fix: Consolidates debug check messages for AI and adds debounce (#2235)

This commit is contained in:
Kamron Batman 2025-07-18 18:08:03 -07:00 • committed by GitHub
parent 8f88de68a7
commit f89150735e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 838 additions and 594 deletions

View file

@ -11,17 +11,11 @@ public class ArcherAI : BaseAI
public override bool DoActionWander()
{
if (Mobile.Debug)
{
Mobile.DebugSay("I have no combatant");
}
DebugSay("I have no combatant");
if (AcquireFocusMob(Mobile.RangePerception, Mobile.FightMode, false, false, true))
{
if (Mobile.Debug)
{
Mobile.DebugSay($"I have detected {Mobile.FocusMob.Name} and I will attack");
}
this.DebugSayFormatted($"I have detected {Mobile.FocusMob.Name} and I will attack");
Mobile.Combatant = Mobile.FocusMob;
Action = ActionType.Combat;
@ -41,10 +35,7 @@ public class ArcherAI : BaseAI
if (combatant == null || combatant.Deleted || combatant.Map != Mobile.Map || !combatant.Alive ||
combatant.IsDeadBondedPet)
{
if (Mobile.Debug)
{
Mobile.DebugSay("My combatant is gone, so my guard is up");
}
DebugSay("My combatant is gone, so my guard is up");
Action = ActionType.Guard;
return true;
@ -58,17 +49,11 @@ public class ArcherAI : BaseAI
Mobile.Weapon.MaxRange
))
{
if (Mobile.Debug)
{
Mobile.DebugSay($"I am still not in range of {combatant.Name}");
}
this.DebugSayFormatted($"I am still not in range of {combatant.Name}");
if ((int)Mobile.GetDistanceToSqrt(combatant) > Mobile.RangePerception + 1)
{
if (Mobile.Debug)
{
Mobile.DebugSay($"I have lost {combatant.Name}");
}
this.DebugSayFormatted($"I have lost {combatant.Name}");
Mobile.Combatant = null;
Action = ActionType.Guard;
@ -82,10 +67,7 @@ public class ArcherAI : BaseAI
if (Mobile.TriggerAbility(MonsterAbilityTrigger.CombatAction, combatant))
{
if (Mobile.Debug)
{
Mobile.DebugSay($"I used my abilities on {combatant.Name}!");
}
this.DebugSayFormatted($"I used my abilities on {combatant.Name}!");
return true;
}
@ -118,10 +100,7 @@ public class ArcherAI : BaseAI
{
if (AcquireFocusMob(Mobile.RangePerception, Mobile.FightMode, false, false, true))
{
if (Mobile.Debug)
{
Mobile.DebugSay($"I have detected {Mobile.FocusMob.Name}, attacking");
}
this.DebugSayFormatted($"I have detected {Mobile.FocusMob.Name}, attacking");
Mobile.Combatant = Mobile.FocusMob;
Action = ActionType.Combat;