Пример #1
0
 private void CheckOutofRange(bool checkDodge)
 {
     if (this.Input.RangeCheckFrom.To2D().Distance(this.CastPosition) > this.Input.SpellRange - (checkDodge ? GetArrivalTime(this.Input.From.To2D().Distance(this.CastPosition), this.Input.SpellDelay, this.Input.SpellMissileSpeed) * this.Unit.MoveSpeed * (100 - ConfigMenu.MaxRangeIgnore) / 100f : 0))
     {
         this.HitChance = LeagueSharp.Common.HitChance.OutOfRange;
     }
 }
Пример #2
0
 private void CheckCollisions()
 {
     if (this.Input.SpellCollisionable && (this.CollisionResult.Objects.HasFlag(Collision.Flags.Minions) || this.CollisionResult.Objects.HasFlag(Collision.Flags.YasuoWall)))
     {
         this.HitChance = LeagueSharp.Common.HitChance.Collision;
     }
 }
Пример #3
0
 public Result(Input inp, Obj_AI_Base unit, Vector2 castpos, Vector2 unitpos, LeagueSharp.Common.HitChance hc, Collision.Result col)
 {
     Input           = inp;
     Unit            = unit;
     CastPosition    = castpos;
     UnitPosition    = unitpos;
     HitChance       = hc;
     CollisionResult = col;
 }
Пример #4
0
        static void CastQ(Obj_AI_Base target, LeagueSharp.Common.HitChance hitChance = LeagueSharp.Common.HitChance.High)
        {
            if (!_spellQ.IsReady())
            {
                return;
            }
            if (target == null || !target.IsValidTarget())
            {
                return;
            }

            _spellQ.CastIfHitchanceEquals(target, hitChance);
        }
Пример #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="ringRadius">Ring Radius</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 SPredictionCastRing(this LeagueSharp.Common.Spell s, AIHeroClient t, float ringRadius, LeagueSharp.Common.HitChance hc, bool onlyEdge = true, 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)
            {
                throw new NotSupportedException("Ring aoe prediction not supported yet");
            }

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

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


            float avgt = t.AvgMovChangeTime() + reactionIgnoreDelay;
            float movt = t.LastMovChangeTime();
            float avgp = t.AvgPathLenght();

            Prediction.Result result;
            if (onlyEdge)
            {
                result = RingPrediction.GetPrediction(t, s.Width, ringRadius, s.Delay, s.Speed, s.Range, s.Collision, t.GetWaypoints(), avgt, movt, avgp, s.From.To2D(), rangeCheckFrom.Value.To2D());
            }
            else
            {
                result = CirclePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range + ringRadius, s.Collision, t.GetWaypoints(), avgt, movt, avgp, 360, s.From.To2D(), rangeCheckFrom.Value.To2D());
            }

            Drawings.s_DrawTick      = Utils.TickCount;
            Drawings.s_DrawPos       = result.CastPosition;
            Drawings.s_DrawHitChance = result.HitChance.ToString();
            Drawings.s_DrawDirection = (result.CastPosition - s.From.To2D()).Normalized().Perpendicular();
            Drawings.s_DrawWidth     = (int)ringRadius;
            if (result.HitChance >= hc)
            {
                s.Cast(result.CastPosition);
                return(true);
            }

            return(false);
        }
Пример #6
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 LeagueSharp.Common.Spell s, AIHeroClient t, float vectorLenght, LeagueSharp.Common.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;
            }


            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);
            }

            return(false);
        }
Пример #7
0
        /// <summary>
        /// Spell extension for cast 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 SPredictionCast(this LeagueSharp.Common.Spell s, AIHeroClient t, LeagueSharp.Common.HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100)
        {
            if (rangeCheckFrom == null)
            {
                rangeCheckFrom = ObjectManager.Player.ServerPosition;
            }

            if (t == null)
            {
                return(s.Cast());
            }

            if (!s.IsSkillshot)
            {
                return(s.Cast(t) == LeagueSharp.Common.Spell.CastStates.SuccessfullyCasted);
            }

            #region if common prediction selected
            if (ConfigMenu.SelectedPrediction == 1)
            {
                var pout = s.GetPrediction(t, minHit > 1);

                if (minHit > 1)
                {
                    if (pout.AoeTargetsHitCount >= minHit)
                    {
                        return(s.Cast(pout.CastPosition));
                    }
                    else
                    {
                        return(false);
                    }
                }

                if (pout.Hitchance >= hc)
                {
                    return(s.Cast(pout.CastPosition));
                }
                else
                {
                    return(false);
                }
            }
            #endregion

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

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



            float avgt      = t.AvgMovChangeTime() + reactionIgnoreDelay;
            float movt      = t.LastMovChangeTime();
            float avgp      = t.AvgPathLenght();
            var   waypoints = t.GetWaypoints();

            Prediction.Result result;

            switch (s.Type)
            {
            case SkillshotType.SkillshotLine:
                result = LinePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, waypoints, avgt, movt, avgp, t.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D());
                break;

            case SkillshotType.SkillshotCircle:
                result = CirclePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, waypoints, avgt, movt, avgp, t.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D());
                break;

            case SkillshotType.SkillshotCone:
                result = ConePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range, s.Collision, waypoints, avgt, movt, avgp, t.LastAngleDiff(), s.From.To2D(), s.RangeCheckFrom.To2D());
                break;

            default:
                throw new InvalidOperationException("Unknown spell type");
            }

            Drawings.s_DrawTick      = Utils.TickCount;
            Drawings.s_DrawPos       = result.CastPosition;
            Drawings.s_DrawHitChance = result.HitChance.ToString();
            Drawings.s_DrawDirection = (result.CastPosition - s.From.To2D()).Normalized().Perpendicular();
            Drawings.s_DrawWidth     = (int)s.Width;

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

            return(false);
        }
Пример #8
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="ringRadius">Ring Radius</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 SPredictionCastRing(this LeagueSharp.Common.Spell s, AIHeroClient t, float ringRadius, LeagueSharp.Common.HitChance hc, bool onlyEdge = true, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100)
        {
            if (Prediction.predMenu != null && Prediction.predMenu.Item("PREDICTONLIST").GetValue <StringList>().SelectedIndex == 1)
            {
                throw new NotSupportedException("Vector Prediction not supported in Common prediction");
            }

            if (minHit > 1)
            {
                throw new NotSupportedException("Ring aoe prediction not supported yet");
            }

            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();
                    Prediction.Result result;
                    if (onlyEdge)
                    {
                        result = RingPrediction.GetPrediction(t, s.Width, ringRadius, s.Delay, s.Speed, s.Range, s.Collision, t.GetWaypoints(), avgt, movt, avgp, s.From.To2D(), rangeCheckFrom.Value.To2D());
                    }
                    else
                    {
                        result = CirclePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range + ringRadius, s.Collision, t.GetWaypoints(), avgt, movt, avgp, 360, s.From.To2D(), rangeCheckFrom.Value.To2D());
                    }

                    Prediction.lastDrawTick      = Utils.TickCount;
                    Prediction.lastDrawPos       = result.CastPosition;
                    Prediction.lastDrawHitchance = result.HitChance.ToString();
                    Prediction.lastDrawDirection = (result.CastPosition - s.From.To2D()).Normalized().Perpendicular();
                    Prediction.lastDrawWidth     = (int)ringRadius;

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

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

            return(false);
        }
Пример #9
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 LeagueSharp.Common.Spell s, AIHeroClient t, float vectorLenght, LeagueSharp.Common.HitChance hc, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100)
        {
            if (Prediction.predMenu != null && Prediction.predMenu.Item("PREDICTONLIST").GetValue <StringList>().SelectedIndex == 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;
            }

            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);
        }