/// <summary>
        /// Spell extension for cast aoe vector spell with SPrediction
        /// </summary>
        /// <param name="vectorLenght">Vector lenght</param>
        /// <param name="minHit">Minimum aoe hits to cast</param>
        /// <returns></returns>
        public static bool SPredictionCastAoeVector(this Spell s, float vectorLenght, int minHit)
        {
            if (minHit < 2)
            {
                throw new InvalidOperationException("Minimum aoe hit count cannot be less than 2");
            }

            if (s.Collision)
            {
                throw new InvalidOperationException("Collisionable spell");
            }

            VectorPrediction.AoeResult result = VectorPrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, vectorLenght, s.RangeCheckFrom.To2D());

            Prediction.lastDrawTick      = Utils.TickCount;
            Prediction.lastDrawPos       = result.CastTargetPosition;
            Prediction.lastDrawHitchance = String.Format("Arc Aoe Cast (Hits: {0})", result.HitCount);
            Prediction.lastDrawDirection = (result.CastTargetPosition - s.From.To2D()).Normalized().Perpendicular();
            Prediction.lastDrawWidth     = (int)s.Width;

            if (result.HitCount >= minHit)
            {
                return(s.Cast(result.CastSourcePosition, result.CastTargetPosition));
            }

            return(false);
        }
예제 #2
0
        /// <summary>
        /// Gets aoe vector prediction
        /// </summary>
        /// <param name="vectorLenght">Vector lenght</param>
        /// <returns>Prediction result as <see cref="VectorPrediction.AoeResult"/></returns>
        public static VectorPrediction.AoeResult GetAoeVectorSPrediction(this Spell s, float vectorLenght)
        {
            if (s.Collision)
            {
                throw new InvalidOperationException("Collisionable spell");
            }

            return(VectorPrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, vectorLenght, s.RangeCheckFrom.ToVector2()));
        }
예제 #3
0
        /// <summary>
        /// Spell extension for cast arc spell with SPrediction
        /// </summary>
        /// <param name="s">Spell to cast</param>
        /// <param name="t">Target for spell</param>
        /// <param name="hc">Minimum HitChance to cast</param>
        /// <param name="reactionIgnoreDelay">Delay to ignore target's reaction time</param>
        /// <param name="minHit">Minimum Hit Count to cast</param>
        /// <param name="rangeCheckFrom">Position where spell will be casted from</param>
        /// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param>
        /// <returns>true if spell has casted</returns>
        /// <summary>
        /// Spell extension for cast vector spell with SPrediction
        /// </summary>
        /// <param name="s">Spell to cast</param>
        /// <param name="t">Target for spell</param>
        /// <param name="vectorLenght">Vector lenght</param>
        /// <param name="hc">Minimum HitChance to cast</param>
        /// <param name="reactionIgnoreDelay">Delay to ignore target's reaction time</param>
        /// <param name="minHit">Minimum Hit Count to cast</param>
        /// <param name="rangeCheckFrom">Position where spell will be casted from</param>
        /// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param>
        /// <returns>true if spell has casted</returns>
        public static bool SPredictionCastVector(this Spell s, Obj_AI_Hero t, float vectorLenght, HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100)
        {
            if (minHit > 1)
            {
                throw new NotSupportedException("Vector aoe prediction has not supported yet");
            }

            if (Prediction.predMenu != null && Prediction.predMenu.Item("PREDICTONLIST").GetValue <StringList>().SelectedIndex == 1)
            {
                throw new NotSupportedException("Vector Prediction not supported in Common prediction");
            }


            if (t.HealthPercent > filterHPPercent)
            {
                return(false);
            }

            if (rangeCheckFrom == null)
            {
                rangeCheckFrom = ObjectManager.Player.ServerPosition;
            }

            if (Monitor.TryEnter(PathTracker.EnemyInfo[t.NetworkId].m_lock))
            {
                try
                {
                    float avgt   = t.AvgMovChangeTime() + reactionIgnoreDelay;
                    float movt   = t.LastMovChangeTime();
                    float avgp   = t.AvgPathLenght();
                    var   result = VectorPrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, vectorLenght, t.GetWaypoints(), avgt, movt, avgp, s.RangeCheckFrom.To2D());

                    if (result.HitChance >= hc)
                    {
                        s.Cast(result.CastSourcePosition, result.CastTargetPosition);
                        return(true);
                    }

                    Monitor.Pulse(PathTracker.EnemyInfo[t.NetworkId].m_lock);
                    return(false);
                }
                finally
                {
                    Monitor.Exit(PathTracker.EnemyInfo[t.NetworkId].m_lock);
                }
            }

            return(false);
        }
예제 #4
0
        /// <summary>
        /// Spell extension for cast aoe vector spell with SPrediction
        /// </summary>
        /// <param name="vectorLenght">Vector lenght</param>
        /// <param name="minHit">Minimum aoe hits to cast</param>
        /// <returns></returns>
        public static bool SPredictionCastAoeVector(this Spell s, float vectorLenght, int minHit)
        {
            if (minHit < 2)
            {
                throw new InvalidOperationException("Minimum aoe hit count cannot be less than 2");
            }

            if (s.Collision)
            {
                throw new InvalidOperationException("Collisionable spell");
            }

            VectorPrediction.AoeResult result = VectorPrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, vectorLenght, s.RangeCheckFrom.ToVector2());


            if (result.HitCount >= minHit)
            {
                return(s.Cast(result.CastSourcePosition.ToVector3(), result.CastTargetPosition.ToVector3()));
            }

            return(false);
        }
예제 #5
0
        /// <summary>
        ///     Spell extension for cast vector spell with SPrediction
        /// </summary>
        /// <param name="s">Spell to cast</param>
        /// <param name="t">Target for spell</param>
        /// <param name="vectorLenght">Vector lenght</param>
        /// <param name="hc">Minimum HitChance to cast</param>
        /// <param name="reactionIgnoreDelay">Delay to ignore target's reaction time</param>
        /// <param name="minHit">Minimum Hit Count to cast</param>
        /// <param name="rangeCheckFrom">Position where spell will be casted from</param>
        /// <param name="filterHPPercent">Minimum HP Percent to cast (for target)</param>
        /// <returns>true if spell has casted</returns>
        public static bool SPredictionCastVector(this Spell s, AIHeroClient t, float vectorLenght, EloBuddy.SDK.Enumerations.HitChance hc,
                                                 int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100)
        {
            if (ConfigMenu.SelectedPrediction == 1)
            {
                throw new NotSupportedException("Vector Prediction not supported in Common prediction");
            }

            if (minHit > 1)
            {
                return(SPredictionCastAoeVector(s, vectorLenght, minHit));
            }

            if (t.HealthPercent > filterHPPercent)
            {
                return(false);
            }

            if (rangeCheckFrom == null)
            {
                rangeCheckFrom = ObjectManager.Player.ServerPosition;
            }


            var   avgt   = t.AvgMovChangeTime() + reactionIgnoreDelay;
            float movt   = t.LastMovChangeTime();
            var   avgp   = t.AvgPathLenght();
            var   result = VectorPrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, vectorLenght,
                                                          t.GetWaypoints(), avgt, movt, avgp, s.RangeCheckFrom.LSTo2D());

            if (result.HitChance >= hc)
            {
                s.Cast(result.CastSourcePosition, result.CastTargetPosition);
                return(true);
            }

            return(false);
        }
예제 #6
0
 /// <summary>
 /// Gets Prediction result
 /// </summary>
 /// <param name="target">Target</param>
 /// <param name="vectorLenght">Vector Lenght</param>
 /// <returns>Prediction result as <see cref="Prediction.Vector.Result"/></returns>
 public static VectorPrediction.Result GetVectorSPrediction(this Spell s, AIHeroClient target, float vectorLenght)
 {
     return(VectorPrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, vectorLenght, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), s.RangeCheckFrom.ToVector2()));
 }