Пример #1
0
        /// <summary>
        ///     The get nearest stack to kill.
        /// </summary>
        /// <param name="hero">
        ///     The hero.
        /// </param>
        /// <param name="predict">
        ///     The predict.
        /// </param>
        /// <returns>
        ///     The <see cref="Stack" />.
        /// </returns>
        private static Stack GetNearestStackToPush(Unit hero, Vector3 predict)
        {
            var detonatableMines = new List <RemoteMine>();

            if (Variables.Stacks == null || !Variables.Stacks.Any())
            {
                return(null);
            }

            var heroPosition = predict;

            var tempDamage   = 0f;
            var nearestStack =
                Variables.Stacks.Where(
                    x =>
                    VectorExtensions.Distance(x.Position, heroPosition) <= PushRange + 400 &&
                    VectorExtensions.Distance(x.Position, heroPosition) > PushRange - 400)
                .MinOrDefault(x => VectorExtensions.Distance(x.Position, heroPosition));

            if (nearestStack == null)
            {
                return(null);
            }

            foreach (var landMine in
                     nearestStack.LandMines.Where(
                         x =>
                         x.Distance(heroPosition) <= x.Radius + PushRange &&
                         x.Distance(hero.Position) <= x.Radius + PushRange))
            {
                if (tempDamage >= hero.Health)
                {
                    return(nearestStack);
                }

                tempDamage += Variables.Damage.GetLandMineDamage(landMine.Level, hero.Handle);
            }

            foreach (var remoteMine in
                     nearestStack.RemoteMines.Where(
                         x =>
                         x.Distance(heroPosition) <= x.Radius + PushRange &&
                         x.Distance(hero.Position) <= x.Radius + PushRange))
            {
                if (tempDamage >= hero.Health)
                {
                    return(nearestStack);
                }

                detonatableMines.Add(remoteMine);
                tempDamage += Variables.Damage.GetRemoteMineDamage(remoteMine.Level, hero.Handle, hero);
            }

            return(!(tempDamage >= hero.Health) ? null : nearestStack);
        }
Пример #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="LandMine" /> class.
        /// </summary>
        /// <param name="entity">
        ///     The land mine entity.
        /// </param>
        public LandMine(Entity entity)
        {
            this.Handle   = entity.Handle;
            this.Position = entity.Position;
            this.Level    = Variables.LandMinesAbility.Level;
            this.Radius   = Variables.LandMinesAbility.GetAbilityData("small_radius");
            this.Entity   = entity as Unit;
            this.Damage   = Variables.Damage.CurrentLandMineDamage;

            DelayAction.Add(
                500,
                () =>
            {
                if (Variables.Stacks != null)
                {
                    var position     = this.Position;
                    var nearestStack =
                        Variables.Stacks.MinOrDefault(x => VectorExtensions.Distance(x.Position, position));
                    if (nearestStack == null)
                    {
                        Variables.Stacks.Add(new Stack(position));
                        return;
                    }

                    var distance = VectorExtensions.Distance(nearestStack.Position, position);
                    if (distance < 200)
                    {
                        return;
                    }

                    if (nearestStack.RemoteMines.Count > 0 && distance < 700)
                    {
                        Variables.Stacks.Add(new Stack(nearestStack.Position.Extend(position, 702)));
                        return;
                    }

                    if (distance < 400)
                    {
                        Variables.Stacks.Add(new Stack(nearestStack.Position.Extend(position, 402)));
                        return;
                    }

                    Variables.Stacks.Add(new Stack(position));
                }
            });

            this.CreateRangeDisplay();
        }
Пример #3
0
 /// <summary>
 ///     The distance.
 /// </summary>
 /// <param name="v">
 ///     The v.
 /// </param>
 /// <returns>
 ///     The <see cref="float" />.
 /// </returns>
 public float Distance(Vector3 v)
 {
     return(VectorExtensions.Distance(this.Position, v));
 }