示例#1
0
        public static Mobile Acquire(Predicate <Mobile> validator)
        {
            Mobile player = World.Player;

            if (player != null)
            {
                using (ScratchList <Mobile> scratchList = new ScratchList <Mobile>())
                {
                    List <Mobile>       mobileList          = scratchList.Value;
                    bool                isBola              = false;
                    int                 range               = Engine.ServerFeatures.AOS ? 11 : 12;
                    ServerTargetHandler serverTargetHandler = TargetManager.Active as ServerTargetHandler;
                    if (serverTargetHandler != null && serverTargetHandler.Action == TargetAction.Bola)
                    {
                        isBola = true;
                        range  = 8;
                    }
                    foreach (Mobile mobile in World.Mobiles.Values)
                    {
                        if (mobile.Visible && !mobile.Player && (!mobile.IsDead && TargetManager.IsAcquirable(player, mobile, isBola)) && (player.InRange((IPoint2D)mobile, range) && Map.LineOfSight(player, mobile) && (validator == null || validator(mobile))))
                        {
                            mobileList.Add(mobile);
                        }
                    }
                    if (mobileList.Count > 0)
                    {
                        mobileList.Sort(TargetSorter.Comparer);
                        return(mobileList[0]);
                    }
                }
            }
            return((Mobile)null);
        }
示例#2
0
 public static bool IsAcquirable(Mobile me, Mobile mob)
 {
     return(TargetManager.IsAcquirable(me, mob, false));
 }