コード例 #1
0
ファイル: SpellExtensions.cs プロジェクト: volder1/PortAIO
        /// <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 Spell s, AIHeroClient t, float ringRadius, EloBuddy.SDK.Enumerations.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;
            }


            var   avgt = t.AvgMovChangeTime() + reactionIgnoreDelay;
            float movt = t.LastMovChangeTime();
            var   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.LSTo2D(), rangeCheckFrom.Value.LSTo2D());
            }
            else
            {
                result = CirclePrediction.GetPrediction(t, s.Width, s.Delay, s.Speed, s.Range + ringRadius, s.Collision, t.GetWaypoints(), avgt, movt, avgp, 360, s.From.LSTo2D(), rangeCheckFrom.Value.LSTo2D());
            }

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

            return(false);
        }
コード例 #2
0
 /// <summary>
 /// Gets Prediction result
 /// </summary>
 /// <param name="s"></param>
 /// <param name="target">Target</param>
 /// <param name="ringRadius">Ring radius</param>
 /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
 public static Prediction.Result GetRingSPrediction(this Spell s, AIHeroClient target, float ringRadius)
 {
     return(RingPrediction.GetPrediction(target, s.Width, ringRadius, s.Delay, s.Speed, s.Range, s.Collision));
 }
コード例 #3
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 Spell s, Obj_AI_Hero t, float ringRadius, HitChance hc, bool onlyEdge = true, int reactionIgnoreDelay = 0, byte minHit = 1, Vector3?rangeCheckFrom = null, float filterHPPercent = 100)
        {
            if (ConfigMenu.SelectedPrediction.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());
                    }

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

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

            return(false);
        }