Ejemplo n.º 1
0
        public bool DoTurn(Squad squad)
        {
            SquadPushPlugin pusher = new SquadPushPlugin(x => x.StickyBombs.Length > 0 ? 1 : 0, true,
                                                         (obj, attackers) => Bot.Engine.CanKill(attackers, obj)
                    ? PushMapping.ByDistance(attackers, obj.DistanceFromBorder(), obj.ClosestBorder())
                    : new PushMapping());

            bool res = pusher.DoTurn(squad);

            if (GameEngine.UNSAFE_SQUAD_PLUGINS)
            {
                return(false);
            }
            else
            {
                return(res);
            }
        }
        private bool HandleDangers(Squad squad, T[] Dangers, Delegates.DefenseFunction <T> Scorer)
        {
            Dangers = Dangers.Where(x => Scorer(x).rank > 0).ToArray();
            SquadPushPlugin Pusher = new SquadPushPlugin(x => Dangers.Any(y => y.UniqueId == x.UniqueId) ? Scorer(x as T).rank : 0, true,
                                                         PushMapper);

            if (!Dangers.IsEmpty() && squad.Count > 0)
            {
                Pusher.DoTurn(squad);
                Squad CurrentSquad = squad;
                foreach (T danger in Dangers.OrderBy(x => Scorer(x).rank))
                {
                    DefenseStats stats      = Scorer(danger);
                    Squad        LocalSquad = CurrentSquad.OrderBy(x => x.Distance(danger)).Take(stats.amount).ToList();
                    LocalSquad.ForEach(x => x.Sail(danger));
                    CurrentSquad = CurrentSquad.FilterOutBySquad(LocalSquad);
                }
                return(true);
            }

            return(false);
        }