コード例 #1
0
        /// <summary>
        /// Gets aoe arc prediction
        /// </summary>
        /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
        public static Prediction.AoeResult GetAoeArcSPrediction(this Spell s)
        {
            if (s.Collision)
            {
                throw new InvalidOperationException("Collisionable spell");
            }

            return(ArcPrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, s.From.ToVector2(), s.RangeCheckFrom.ToVector2()));
        }
コード例 #2
0
        /// <summary>
        /// Spell extension for cast aoe arc spell with SPrediction
        /// </summary>
        /// <param name="minHit">Minimum aoe hits to cast</param>
        /// <returns></returns>
        public static bool SPredictionCastAoeArc(this Spell s, 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");
            }

            Prediction.AoeResult result = ArcPrediction.GetAoePrediction(s.Width, s.Delay, s.Speed, s.Range, s.From.ToVector2(), s.RangeCheckFrom.ToVector2());

            if (result.HitCount >= minHit)
            {
                return(s.Cast(result.CastPosition));
            }

            return(false);
        }
コード例 #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>
        public static bool SPredictionCastArc(this Spell s, AIHeroClient t, HitChance hc, bool arconly = true, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100)
        {
            if (ConfigMenu.SelectedPrediction.Index == 1)
            {
                throw new NotSupportedException("Arc Prediction not supported in Common prediction");
            }

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

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

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


            float avgt   = t.AvgMovChangeTime() + reactionIgnoreDelay;
            float movt   = t.LastMovChangeTime();
            float avgp   = t.AvgPathLenght();
            var   result = ArcPrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, t.GetWaypoints(), avgt, movt, avgp, t.LastAngleDiff(), s.From.ToVector2(), s.RangeCheckFrom.ToVector2(), arconly);

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

            return(false);
        }
コード例 #4
0
 /// <summary>
 /// Gets Prediction result
 /// </summary>
 /// <param name="target">Target</param>
 /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
 public static Prediction.Result GetArcSPrediction(this Spell s, AIHeroClient target)
 {
     return(ArcPrediction.GetPrediction(target, s.Width, s.Delay, s.Speed, s.Range, s.Collision, target.GetWaypoints(), target.AvgMovChangeTime(), target.LastMovChangeTime(), target.AvgPathLenght(), target.LastAngleDiff(), s.From.ToVector2(), s.RangeCheckFrom.ToVector2()));
 }