ModernUO/Projects/UOContent/Mobiles/AI/AIControlMobileTarget.cs
Kamron Batman aab731ed96
feat: Overhauls AI (Speech/Movement) (#2232)
### Summary

* Refactors AI so it is easier to read and maintain
* Fixes NPC speed issues
* Fixes pet sector AI issue that was causing stuttering
* Fixes direction snapping for Melee/Mage AI
* Refactors pet orders
* Refactors speech commands
* Removes scale speed by dex for HS+ (it was a stupid feature anyways)
2025-07-18 22:39:57 -07:00

41 lines
849 B
C#

using System.Collections.Generic;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Targets;
public class AIControlMobileTarget : Target
{
private readonly List<BaseAI> _list;
public AIControlMobileTarget(BaseAI ai, OrderType order) : base(
-1,
false,
order == OrderType.Attack ? TargetFlags.Harmful : TargetFlags.None
)
{
_list = [ai];
Order = order;
}
public OrderType Order { get; }
public void AddAI(BaseAI ai)
{
if (!_list.Contains(ai))
{
_list.Add(ai);
}
}
protected override void OnTarget(Mobile from, object o)
{
if (o is Mobile m)
{
for (var i = 0; i < _list.Count; ++i)
{
_list[i].EndPickTarget(from, m, Order);
}
}
}
}