当前位置: 首页>>代码示例>>C#>>正文


C# PredictionInput类代码示例

本文整理汇总了C#中PredictionInput的典型用法代码示例。如果您正苦于以下问题:C# PredictionInput类的具体用法?C# PredictionInput怎么用?C# PredictionInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PredictionInput类属于命名空间,在下文中一共展示了PredictionInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CastSpell

 public static void CastSpell(Spell.Skillshot qwer, Obj_AI_Base target)
 {
     var predInput2 = new PredictionInput
     {
         Speed = qwer.Speed,
         Delay = qwer.CastDelay,
         Range = qwer.Range,
         From = Player.Instance.ServerPosition,
         Radius = qwer.Width,
         Unit = target,
         Type = SkillshotType.SkillshotLine
     };
     var poutput2 = P.GetPrediction(predInput2);
     if (poutput2.Hitchance >= HitChance.Low)
         qwer.Cast(poutput2.CastPosition);
 }
开发者ID:FireBuddy,项目名称:Elobuddy-3,代码行数:16,代码来源:JungleClear.cs

示例2: CastSpell

 private static void CastSpell(Spell.Skillshot qwer, Obj_AI_Base target)
 {
     var predInput2 = new PredictionInput
     {
         Speed = qwer.Speed,
         Delay = qwer.CastDelay,
         Range = qwer.Range,
         From = Player.Instance.ServerPosition,
         Radius = qwer.Width,
         Unit = target,
         Type = SkillshotType.SkillshotLine
     };
     var poutput2 = P.GetPrediction(predInput2);
     var Standard = qwer.GetPrediction(target);
         if(Standard.HitChance >= EloBuddy.SDK.Enumerations.HitChance.Medium)
         {
         qwer.Cast(S.Q.GetPrediction(target).CastPosition);
         }
 }
开发者ID:FireBuddy,项目名称:Elobuddy-3,代码行数:19,代码来源:Combo.cs

示例3: CastSpell

        public static void CastSpell(Spell QWER, Obj_AI_Base target)
        {
            switch (GetStringValue("PredictionMode"))
            {
                case 0:
                {
                    const SkillshotType coreType2 = SkillshotType.SkillshotLine;

                    var predInput2 = new PredictionInput
                    {
                        Collision = QWER.Collision,
                        Speed = QWER.Speed,
                        Delay = QWER.Delay,
                        Range = QWER.Range,
                        From = Player.ServerPosition,
                        Radius = QWER.Width,
                        Unit = target,
                        Type = coreType2
                    };
                    var poutput2 = Prediction.GetPrediction(predInput2);
                    // if (poutput2 == null) return;
                    if (poutput2.Hitchance >= HitChance.High || poutput2.Hitchance == HitChance.Immobile ||
                        poutput2.Hitchance == HitChance.Dashing)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                    break;
                }
                case 1:
                    var pred = Q.GetPrediction(target);
                    if (pred.Hitchance >= LeagueSharp.Common.HitChance.High ||
                        pred.Hitchance == LeagueSharp.Common.HitChance.Immobile)
                    {
                        if (pred.CollisionObjects.Count == 0)
                            Q.Cast(pred.CastPosition);
                    }
                    break;
            }

        }
开发者ID:Faqer,项目名称:LeagueSharp-3,代码行数:40,代码来源:OnUpdate.cs

示例4: WayPointAnalysis

        internal static PredictionOutput WayPointAnalysis(PredictionOutput result, PredictionInput input)
        {
            if (!(input.Unit is EloBuddy.AIHeroClient) || input.Radius == 1)
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }
            OktwCommon.debug("WAIT.....");
            // CAN'T MOVE SPELLS ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.GetSpecialSpellEndTime(input.Unit) > 100 || input.Unit.HasBuff("Recall") || (UnitTracker.GetLastStopMoveTime(input.Unit) < 100 && input.Unit.IsRooted))
            {
                OktwCommon.debug("CAN'T MOVE SPELLS");
                result.Hitchance = HitChance.VeryHigh;
                result.CastPosition = input.Unit.ServerPosition;
                return result;
            }

            // PREPARE MATH ///////////////////////////////////////////////////////////////////////////////////

            var path = input.Unit.GetWaypoints();

            var lastWaypiont = path.Last().To3D();

            var distanceUnitToWaypoint = lastWaypiont.LSDistance(input.Unit.ServerPosition);
            var distanceFromToUnit = input.From.LSDistance(input.Unit.ServerPosition);
            var distanceFromToWaypoint = lastWaypiont.LSDistance(input.From);

            Vector2 pos1 = lastWaypiont.LSTo2D() - input.Unit.Position.LSTo2D();
            Vector2 pos2 = input.From.LSTo2D() - input.Unit.Position.LSTo2D();
            var getAngle = pos1.LSAngleBetween(pos2);

            float speedDelay = distanceFromToUnit / input.Speed;

            if (Math.Abs(input.Speed - float.MaxValue) < float.Epsilon)
                speedDelay = 0;

            float totalDelay = speedDelay + input.Delay;
            float moveArea = input.Unit.MoveSpeed * totalDelay;
            float fixRange = moveArea * 0.35f;
            float pathMinLen = 1000;

            if (input.Type == SkillshotType.SkillshotCircle)
            {
                fixRange -= input.Radius / 2;
            }

            // FIX RANGE ///////////////////////////////////////////////////////////////////////////////////
            if (distanceFromToWaypoint <= distanceFromToUnit && distanceFromToUnit > input.Range - fixRange)
            {
                result.Hitchance = HitChance.Medium;
                return result;
            }

            if (distanceUnitToWaypoint > 0)
            {
                // RUN IN LANE DETECTION ///////////////////////////////////////////////////////////////////////////////////
                if (getAngle < 20 || getAngle > 160 || (getAngle > 130 && distanceUnitToWaypoint > 400))
                {
                    OktwCommon.debug("PRED: ANGLE " + getAngle);
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }

                // WALL LOGIC  ///////////////////////////////////////////////////////////////////////////////////

                var points = OktwCommon.CirclePoints(15, 350, input.Unit.ServerPosition).Where(x => x.LSIsWall());

                if (points.Count() > 2)
                {
                    var runOutWall = true;
                    foreach (var point in points)
                    {
                        if (input.Unit.ServerPosition.LSDistance(point) > lastWaypiont.LSDistance(point))
                        {
                            runOutWall = false;
                        }
                    }
                    if (runOutWall)
                    {
                        OktwCommon.debug("PRED: RUN OUT WALL");
                        result.Hitchance = HitChance.VeryHigh;
                        return result;
                    }
                }
            }

            // SHORT CLICK DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if (distanceUnitToWaypoint > 0 && distanceUnitToWaypoint < 100)
            {
                OktwCommon.debug("PRED: SHORT CLICK DETECTION");
                result.Hitchance = HitChance.Medium;
                return result;
            }

            if (input.Unit.GetWaypoints().Count == 1)
            {
                if (UnitTracker.GetLastAutoAttackTime(input.Unit) < 0.1d && totalDelay < 0.7)
                {
//.........这里部分代码省略.........
开发者ID:yashine59fr,项目名称:PortAIO,代码行数:101,代码来源:PredictionOktw.cs

示例5: GetPrediction

 public static PredictionOutput GetPrediction(PredictionInput input)
 {
     return GetPrediction(input, true, true);
 }
开发者ID:rio4948,项目名称:LeagueRepo,代码行数:4,代码来源:PredictionOktw.cs

示例6: GetStandardPrediction

        internal static PredictionOutput GetStandardPrediction(PredictionInput input)
        {
            var speed = input.Unit.MoveSpeed;

            if (input.Unit.Distance(input.From, true) < 200 * 200)
            {
                //input.Delay /= 2;
                speed /= 1.5f;
            }

            var result = GetPositionOnPath(input, input.Unit.GetWaypoints(), speed);

            return result;
        }
开发者ID:rio4948,项目名称:LeagueRepo,代码行数:14,代码来源:PredictionOktw.cs

示例7: GetCollision

        public static bool GetCollision(List<Vector3> positions, PredictionInput input)
        {

            foreach (var position in positions)
            {
                foreach (var objectType in input.CollisionObjects)
                {
                    switch (objectType)
                    {
                        case CollisionableObjects.Minions:
                            foreach (var minion in MinionManager.GetMinions(input.From, Math.Min(input.Range + input.Radius + 100, 2000)))
                            {
                                input.Unit = minion;

                                var distanceFromToUnit = minion.ServerPosition.Distance(input.From);

                                if (distanceFromToUnit < input.Radius)
                                {
                                    if (MinionIsDead(input, minion, distanceFromToUnit))
                                        continue;
                                    else
                                        return true;
                                }
                                else if (minion.ServerPosition.Distance(position) < input.Unit.BoundingRadius)
                                {
                                    if (MinionIsDead(input, minion, distanceFromToUnit))
                                        continue;
                                    else
                                        return true;
                                }
                                else
                                {
                                    var minionPos = minion.ServerPosition;
                                    int bonusRadius = 20;
                                    if (minion.IsMoving)
                                    {
                                        minionPos = Prediction.GetPrediction(input, false, false).CastPosition;
                                        bonusRadius = 100;
                                    }

                                    if (minionPos.To2D().Distance(input.From.To2D(), position.To2D(), true, true) <= Math.Pow((input.Radius + bonusRadius + minion.BoundingRadius), 2))
                                    {
                                        if (MinionIsDead(input, minion, distanceFromToUnit))
                                            continue;
                                        else
                                            return true;
                                    }
                                }
                            }
                            break;
                        case CollisionableObjects.Heroes:
                            foreach (var hero in
                                HeroManager.Enemies.FindAll(
                                    hero =>
                                        hero.IsValidTarget(
                                            Math.Min(input.Range + input.Radius + 100, 2000), true, input.RangeCheckFrom))
                                )
                            {
                                input.Unit = hero;
                                var prediction = Prediction.GetPrediction(input, false, false);
                                if (
                                    prediction.UnitPosition.To2D()
                                        .Distance(input.From.To2D(), position.To2D(), true, true) <=
                                    Math.Pow((input.Radius + 50 + hero.BoundingRadius), 2))
                                {
                                    return true;
                                }
                            }
                            break;

                        case CollisionableObjects.Walls:
                            var step = position.Distance(input.From) / 20;
                            for (var i = 0; i < 20; i++)
                            {
                                var p = input.From.To2D().Extend(position.To2D(), step * i);
                                if (NavMesh.GetCollisionFlags(p.X, p.Y).HasFlag(CollisionFlags.Wall))
                                {
                                    return true;
                                }
                            }
                            break;
                    }
                }
            }
            return false;
        }
开发者ID:julianu37,项目名称:LeagueRepo,代码行数:86,代码来源:PredictionOktw.cs

示例8: GetPositionOnPath

        internal static PredictionOutput GetPositionOnPath(PredictionInput input, List<Vector2> path, float speed = -1)
        {
            speed = (Math.Abs(speed - (-1)) < float.Epsilon) ? input.Unit.MoveSpeed : speed;

            if (path.Count <= 1)
            {
                return new PredictionOutput
                {
                    Input = input,
                    UnitPosition = input.Unit.ServerPosition,
                    CastPosition = input.Unit.ServerPosition,
                    Hitchance = HitChance.High
                };
            }

            var pLength = path.PathLength();

            //Skillshots with only a delay
            if (pLength >= input.Delay * speed - input.RealRadius && Math.Abs(input.Speed - float.MaxValue) < float.Epsilon)
            {
                var tDistance = input.Delay * speed - input.RealRadius;

                for (var i = 0; i < path.Count - 1; i++)
                {
                    var a = path[i];
                    var b = path[i + 1];
                    var d = a.Distance(b);

                    if (d >= tDistance)
                    {
                        var direction = (b - a).Normalized();

                        var cp = a + direction * tDistance;
                        var p = a +
                                direction *
                                ((i == path.Count - 2)
                                    ? Math.Min(tDistance + input.RealRadius, d)
                                    : (tDistance + input.RealRadius));

                        return new PredictionOutput
                        {
                            Input = input,
                            CastPosition = cp.To3D(),
                            UnitPosition = p.To3D(),
                            Hitchance = HitChance.High
                        };
                    }

                    tDistance -= d;
                }
            }

            //Skillshot with a delay and speed.
            if (pLength >= input.Delay * speed - input.RealRadius &&
                Math.Abs(input.Speed - float.MaxValue) > float.Epsilon)
            {
                path = path.CutPath(input.Delay * speed - input.RealRadius);
                var distanceToTarget = input.From.Distance(input.Unit.ServerPosition);
                var m = distanceToTarget > input.Unit.BoundingRadius ? distanceToTarget / (distanceToTarget - input.Unit.BoundingRadius) : 1;
                var sp = m * input.Speed;

                var tT = 0f;
                for (var i = 0; i < path.Count - 1; i++)
                {
                    var a = path[i];
                    var b = path[i + 1];
                    var tB = a.Distance(b) / speed;
                    var direction = (b - a).Normalized();
                    a = a - speed * tT * direction;
                    var sol = Geometry.VectorMovementCollision(a, b, speed, input.From.To2D(), sp, tT);
                    var t = (float)sol[0];
                    var pos = (Vector2)sol[1];

                    if (pos.IsValid() && t >= tT && t <= tT + tB)
                    {
                        var p = pos + input.RealRadius * direction;

                        if (input.Type == SkillshotType.SkillshotLine && false)
                        {
                            var alpha = (input.From.To2D() - p).AngleBetween(a - b);
                            if (alpha > 50 && alpha < 180 - 50)
                            {
                                var beta = (float)Math.Asin(input.RealRadius * 0.85f / p.Distance(input.From));
                                var cp1 = input.From.To2D() + (p - input.From.To2D()).Rotated(beta);
                                var cp2 = input.From.To2D() + (p - input.From.To2D()).Rotated(-beta);

                                pos = cp1.Distance(pos, true) < cp2.Distance(pos, true) ? cp1 : cp2;
                            }
                        }

                        return new PredictionOutput
                        {
                            Input = input,
                            CastPosition = pos.To3D(),
                            UnitPosition = p.To3D(),
                            Hitchance = HitChance.High
                        };
                    }
                    tT += tB;
                }
//.........这里部分代码省略.........
开发者ID:rio4948,项目名称:LeagueRepo,代码行数:101,代码来源:PredictionOktw.cs

示例9: GetPrediction

        internal static PredictionOutput GetPrediction(PredictionInput input, bool ft, bool checkCollision)
        {
            PredictionOutput result = null;

            if (!input.Unit.LSIsValidTarget(float.MaxValue, false) || !input.Unit.IsVisible || !input.Unit.IsHPBarRendered)
            {
                return new PredictionOutput();
            }

            if (ft)
            {
                //Increase the delay due to the latency and server tick:
                input.Delay += EloBuddy.Game.Ping / 2000f + 0.06f;

                if (input.Aoe)
                {
                    return AoePrediction.GetPrediction(input);
                }
            }

            //Target too far away.
            if (Math.Abs(input.Range - float.MaxValue) > float.Epsilon &&
                input.Unit.LSDistance(input.RangeCheckFrom, true) > Math.Pow(input.Range * 1.5, 2))
            {
                return new PredictionOutput { Input = input };
            }

            //Unit is dashing.
            if (input.Unit.LSIsDashing())
            {
                result = GetDashingPrediction(input);
            }
            else
            {
                //Unit is immobile.
                var remainingImmobileT = UnitIsImmobileUntil(input.Unit);
                if (remainingImmobileT >= 0d)
                {
                    result = GetImmobilePrediction(input, remainingImmobileT);
                }
            }

            //Normal prediction
            if (result == null)
            {
                result = GetPositionOnPath(input, input.Unit.GetWaypoints(), input.Unit.MoveSpeed);
            }

            //Check if the unit position is in range
            if (Math.Abs(input.Range - float.MaxValue) > float.Epsilon)
            {
                if (result.Hitchance >= HitChance.High &&
                    input.RangeCheckFrom.LSDistance(input.Unit.ServerPosition, true) >
                    Math.Pow(input.Range + input.RealRadius * 3 / 4, 2))
                {
                    result.Hitchance = HitChance.Medium;
                }

                if (input.RangeCheckFrom.LSDistance(result.UnitPosition, true) >
                    Math.Pow(input.Range + (input.Type == SkillshotType.SkillshotCircle ? input.RealRadius : 0), 2))
                {
                    result.Hitchance = HitChance.OutOfRange;
                }

                /* This does not need to be handled for the updated predictions, but left as a reference.*/
                if (input.RangeCheckFrom.LSDistance(result.CastPosition, true) > Math.Pow(input.Range, 2))
                {
                    if (result.Hitchance != HitChance.OutOfRange)
                    {
                        result.CastPosition = input.RangeCheckFrom +
                                              input.Range *
                                              (result.UnitPosition - input.RangeCheckFrom).LSTo2D().LSNormalized().To3D();
                    }
                    else
                    {
                        result.Hitchance = HitChance.OutOfRange;
                    }
                }
            }

            //Check for collision
            if (checkCollision && input.Collision && result.Hitchance > HitChance.Impossible)
            {
                var positions = new List<Vector3> { result.CastPosition };
                var originalUnit = input.Unit;
                if (Collision.GetCollision(positions, input))
                    result.Hitchance = HitChance.Collision;
            }

            //Set hit chance
            if (result.Hitchance == HitChance.High || result.Hitchance == HitChance.VeryHigh)
            {

                result = WayPointAnalysis(result, input);
                //.debug(input.Unit.BaseSkinName + result.Hitchance);

            }
            if (result.Hitchance >= HitChance.VeryHigh && input.Unit is EloBuddy.AIHeroClient && input.Radius > 1)
            {

//.........这里部分代码省略.........
开发者ID:yashine59fr,项目名称:PortAIO,代码行数:101,代码来源:PredictionOktw.cs

示例10: MinionIsDead

        /// <summary>
        ///     Returns the list of the units that the skillshot will hit before reaching the set positions.
        /// </summary>
        /// 
        private static bool MinionIsDead(PredictionInput input, Obj_AI_Base minion , float distance)
        {
            float delay = (distance / input.Speed) + input.Delay;

            if (Math.Abs(input.Speed - float.MaxValue) < float.Epsilon)
                delay = input.Delay;

            int convert = (int)(delay * 1000);

            if (HealthPrediction.LaneClearHealthPrediction(minion, convert, 0) <= 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
开发者ID:julianu37,项目名称:LeagueRepo,代码行数:22,代码来源:PredictionOktw.cs

示例11: GetStandardPrediction

        internal static PredictionOutput GetStandardPrediction(PredictionInput input)
        {
            var speed = input.Unit.MoveSpeed;

            if (input.Unit.Distance(input.From, true) < 200 * 200)
            {
                //input.Delay /= 2;
                speed /= 1.5f;
            }

            var result = GetPositionOnPath(input, input.Unit.GetWaypoints(), speed);

            var totalDelay = input.From.Distance(input.Unit.ServerPosition) / input.Speed + input.Delay;
            var fixRange = (input.Unit.MoveSpeed * totalDelay) / 2;
            var LastWaypiont = input.Unit.GetWaypoints().Last().To3D();

            if (input.Type == SkillshotType.SkillshotLine)
            {
                if (PathTracker.GetAngle(input.From, input.Unit) < 32 + 1)
                    result.Hitchance = HitChance.VeryHigh;
                else
                    result.Hitchance = HitChance.High;
            }
            else if (input.Type == SkillshotType.SkillshotCircle)
            {
                if (totalDelay < 0.35 && (PathTracker.GetCurrentPath(input.Unit).Time < 0.1d || input.Unit.IsWindingUp))
                    result.Hitchance = HitChance.VeryHigh;
            }

            if (input.Unit.HasBuffOfType(BuffType.Slow) || input.Unit.Distance(input.From) < 300 || LastWaypiont.Distance(input.From) < 300)
                result.Hitchance = HitChance.VeryHigh;

            if (LastWaypiont.Distance(input.Unit.ServerPosition) > 700)
            {
                if (input.From.Distance(input.Unit.ServerPosition) < input.Range - fixRange)
                    result.Hitchance = HitChance.VeryHigh;
            }

            //BAD PREDICTION
            if (input.Unit.Path.Count() == 0 && input.Unit.Position == input.Unit.ServerPosition)
            {
                if (input.From.Distance(input.Unit.ServerPosition) > input.Range - fixRange)
                    result.Hitchance = HitChance.High;
            }
            else if (LastWaypiont.Distance(input.From) <= input.Unit.Distance(input.From))
            {
                if (input.From.Distance(input.Unit.ServerPosition) > input.Range - fixRange)
                    result.Hitchance = HitChance.High;
            }

            if (totalDelay > 0.5 && input.Unit.IsWindingUp)
            {
                result.Hitchance = HitChance.Medium;
            }

            if (input.Unit.Path.Count() > 1)
            {
                result.Hitchance = HitChance.Medium;
            }

            return result;
        }
开发者ID:LordRasd,项目名称:LeagueRepo,代码行数:62,代码来源:PredictionOktw.cs

示例12: WayPointAnalysis

        internal static PredictionOutput WayPointAnalysis(PredictionOutput result, PredictionInput input)
        {
            if (!input.Unit.IsValid<Obj_AI_Hero>() || input.Radius == 1)
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // CAN'T MOVE SPELLS ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.GetSpecialSpellEndTime(input.Unit) > 0 || input.Unit.HasBuff("Recall"))
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // NEW VISABLE ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.GetLastVisableTime(input.Unit) < 0.1d)
            {
                Program.debug("PRED: NEW VISABLE");
                result.Hitchance = HitChance.Medium;
                return result;
            }

            // PREPARE MATH ///////////////////////////////////////////////////////////////////////////////////

            result.Hitchance = HitChance.Medium;

            var lastWaypiont = input.Unit.GetWaypoints().Last().To3D();
            var distanceUnitToWaypoint = lastWaypiont.Distance(input.Unit.ServerPosition);
            var distanceFromToUnit = input.From.Distance(input.Unit.ServerPosition);
            var distanceFromToWaypoint = lastWaypiont.Distance(input.From);
            var getAngle = GetAngle(input.From, input.Unit);
            float speedDelay = distanceFromToUnit / input.Speed;

            if (Math.Abs(input.Speed - float.MaxValue) < float.Epsilon)
                speedDelay = 0;

            float totalDelay = speedDelay + input.Delay;
            float moveArea = input.Unit.MoveSpeed * totalDelay;
            float fixRange = moveArea * 0.4f;
            float pathMinLen = 900 + +moveArea;
            double angleMove = 30 + (input.Radius / 17) - totalDelay - (input.Delay * 2);

            if (angleMove < 31)
                angleMove = 31;

            if (UnitTracker.GetLastNewPathTime(input.Unit) < 0.1d)
            {
                result.Hitchance = HitChance.High;
                pathMinLen = 600f + moveArea;
                angleMove += 2;
                fixRange = moveArea * 0.3f;
            }

            if (input.Type == SkillshotType.SkillshotCircle)
            {
                fixRange -= input.Radius / 2;
            }

            // FIX RANGE ///////////////////////////////////////////////////////////////////////////////////

            if (distanceFromToWaypoint <= distanceFromToUnit && distanceFromToUnit > input.Range - fixRange)
            {
                //debug("PRED: FIX RANGE");
                result.Hitchance = HitChance.Medium;
                return result;
            }

            // SPAM CLICK ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.PathCalc(input.Unit))
            {
                Program.debug("PRED: SPAM CLICK");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // SPAM POSITION ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.SpamSamePlace(input.Unit))
            {
                Program.debug("PRED: SPAM POSITION");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // SPECIAL CASES ///////////////////////////////////////////////////////////////////////////////////

            if (distanceFromToUnit < 250 ||  input.Unit.MoveSpeed < 200 || distanceFromToWaypoint < 100)
            {
                Program.debug("PRED: SPECIAL CASES");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // LONG CLICK DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if (distanceUnitToWaypoint > pathMinLen)
//.........这里部分代码省略.........
开发者ID:superjo1508,项目名称:LeagueRepo,代码行数:101,代码来源:PredictionOktw.cs

示例13: WayPointAnalysis

        internal static PredictionOutput WayPointAnalysis(PredictionOutput result, PredictionInput input)
        {
            if (!input.Unit.IsValid<AIHeroClient>() || input.Radius == 1)
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // CAN'T MOVE SPELLS ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.GetSpecialSpellEndTime(input.Unit) > 100 || input.Unit.HasBuff("Recall") || (UnitTracker.GetLastStopMoveTime(input.Unit) < 100 && input.Unit.IsRooted))
            {
                OktwCommon.debug("CAN'T MOVE SPELLS");
                result.Hitchance = HitChance.VeryHigh;
                result.CastPosition = input.Unit.Position;
                return result;
            }

            // NEW VISABLE ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.GetLastVisableTime(input.Unit) < 100)
            {
                OktwCommon.debug("PRED: NEW VISABLE");
                result.Hitchance = HitChance.Medium;
                return result;
            }

            // PREPARE MATH ///////////////////////////////////////////////////////////////////////////////////

            result.Hitchance = HitChance.Medium;
            var lastWaypiont = input.Unit.GetWaypoints().Last().To3D();
            var distanceUnitToWaypoint = lastWaypiont.LSDistance(input.Unit.ServerPosition);
            var distanceFromToUnit = input.From.LSDistance(input.Unit.ServerPosition);
            var distanceFromToWaypoint = lastWaypiont.LSDistance(input.From);
            var getAngle = GetAngle(input.From, input.Unit);
            float speedDelay = distanceFromToUnit / input.Speed;

            if (Math.Abs(input.Speed - float.MaxValue) < float.Epsilon)
                speedDelay = 0;

            float totalDelay = speedDelay + input.Delay;
            float moveArea = input.Unit.MoveSpeed * totalDelay;
            float fixRange = moveArea * 0.35f;
            float pathMinLen = 800 + moveArea;

            double angleMove = 32;

            if (input.Type == SkillshotType.SkillshotCircle)
            {
                fixRange -= input.Radius / 2;
            }

            // FIX RANGE ///////////////////////////////////////////////////////////////////////////////////
            if (distanceFromToWaypoint <= distanceFromToUnit)
            {
                if (distanceFromToUnit > input.Range - fixRange)
                {
                    result.Hitchance = HitChance.Medium;
                    return result;
                }
            }

            var points = OktwCommon.CirclePoints(15, 450, input.Unit.Position).Where(x => x.LSIsWall());

            if (points.Count() > 2)
            {
                var runOutWall = true;
                foreach (var point in points)
                {
                    if (input.Unit.Position.LSDistance(point) > lastWaypiont.LSDistance(point))
                    {
                        Render.Circle.DrawCircle(point, 50, System.Drawing.Color.Orange, 1);
                        runOutWall = false;
                    }
                }
                if (runOutWall)
                {
                    OktwCommon.debug("PRED: RUN OUT WALL");
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }
            }

            if (input.Unit.GetWaypoints().Count == 1)
            {
                if (UnitTracker.GetLastStopMoveTime(input.Unit) < 600)
                {
                    //OktwCommon.debug("PRED: STOP HIGH");
                    result.Hitchance = HitChance.High;
                    return result;
                }
                else
                {
                    OktwCommon.debug("PRED: STOP LOGIC");
                    result.Hitchance = HitChance.VeryHigh;
                }
            }

            // SPAM POSITION ///////////////////////////////////////////////////////////////////////////////////

//.........这里部分代码省略.........
开发者ID:Xelamats,项目名称:PortAIO,代码行数:101,代码来源:PredictionOktw.cs

示例14: GetDashingPrediction

        internal static PredictionOutput GetDashingPrediction(PredictionInput input)
        {
            var dashData = input.Unit.GetDashInfo();
            var result = new PredictionOutput { Input = input };
            input.Delay += 0.1f;
            //Normal dashes.
            if (!dashData.IsBlink)
            {
                //Mid air:
                var dashPred = GetPositionOnPath(
                    input, new List<Vector2> { input.Unit.ServerPosition.To2D(), dashData.Path.Last() }, dashData.Speed);
                if (dashPred.Hitchance >= HitChance.High)
                {
                    dashPred.CastPosition = dashPred.UnitPosition;
                    dashPred.Hitchance = HitChance.Dashing;
                    return dashPred;
                }

                //At the end of the dash:
                if (dashData.Path.PathLength() > 200)
                {
                    var endP = dashData.Path.Last();
                    var timeToPoint = input.Delay + input.From.To2D().Distance(endP) / input.Speed;
                    if (timeToPoint <=
                        input.Unit.Distance(endP) / dashData.Speed + input.RealRadius / input.Unit.MoveSpeed)
                    {
                        return new PredictionOutput
                        {
                            CastPosition = endP.To3D(),
                            UnitPosition = endP.To3D(),
                            Hitchance = HitChance.Dashing
                        };
                    }
                }

                result.CastPosition = dashData.Path.Last().To3D();
                result.UnitPosition = result.CastPosition;

                //Figure out where the unit is going.
            }

            return result;
        }
开发者ID:rio4948,项目名称:LeagueRepo,代码行数:43,代码来源:PredictionOktw.cs

示例15: WayPointAnalysis

        private static PredictionOutput WayPointAnalysis(PredictionOutput result, PredictionInput input)
        {
            if (!input.Unit.IsValid<Obj_AI_Hero>())
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            var totalDelay = input.From.Distance(input.Unit.ServerPosition) / input.Speed + input.Delay;

            if (Math.Abs(input.Speed - float.MaxValue) < float.Epsilon)
                totalDelay =  input.Delay;

            var fixRange = (input.Unit.MoveSpeed * totalDelay) * 0.6;
            var LastWaypiont = input.Unit.GetWaypoints().Last().To3D();
            float pathMinLen = 550f;
            double angleMove = 30 + (input.Radius / 10);
            float BackToFront = input.Unit.MoveSpeed * totalDelay;

            if (PathTracker.GetCurrentPath(input.Unit).Time < 0.1d)
            {
                //pathMinLen = BackToFront * 2;
                angleMove += 5;
                fixRange = (input.Unit.MoveSpeed * totalDelay) * 0.4;
            }

            if (input.Type == SkillshotType.SkillshotCircle)
            {
                fixRange -= input.Radius / 2;
            }

            if (input.Type == SkillshotType.SkillshotLine)
            {
                if (input.Unit.Path.Count() > 0)
                {
                    if (GetAngle(input.From, input.Unit) < angleMove)
                    {
                        result.Hitchance = HitChance.VeryHigh;
                    }
                    else
                        result.Hitchance = HitChance.High;
                }
            }
            else if (input.Type == SkillshotType.SkillshotCircle)
            {
                if (totalDelay < 0.7 && OnProcessSpellDetection.GetLastAutoAttackTime(input.Unit) < 0.1d)
                    result.Hitchance = HitChance.VeryHigh;
                else if (totalDelay < 1.1 && PathTracker.GetCurrentPath(input.Unit).Time < 0.1d)
                    result.Hitchance = HitChance.VeryHigh;
            }

            if (input.Unit.MoveSpeed < 250f)
            {
                result.Hitchance = HitChance.VeryHigh;
            }

            if (LastWaypiont.Distance(input.Unit.ServerPosition) > pathMinLen)
            {
                    result.Hitchance = HitChance.VeryHigh;
            }

            if (totalDelay < 0.7 + (input.Radius / 500) && OnProcessSpellDetection.GetLastAutoAttackTime(input.Unit) < 0.1d)
            {
                result.Hitchance = HitChance.VeryHigh;
            }

            if (input.Unit.Path.Count() == 0 && input.Unit.Position == input.Unit.ServerPosition && !input.Unit.IsWindingUp)
            {
                if (input.From.Distance(input.Unit.ServerPosition) > input.Range - fixRange)
                    result.Hitchance = HitChance.High;
                else
                    result.Hitchance = HitChance.VeryHigh;
                return result;
            }
            else if (LastWaypiont.Distance(input.From) <= input.Unit.Distance(input.From))
            {
                if (input.From.Distance(input.Unit.ServerPosition) > input.Range - fixRange)
                {
                    result.Hitchance = HitChance.High;
                }
            }

            if (input.Unit.Path.Count() > 0)
            {
                if (input.Unit.Distance(LastWaypiont) < BackToFront && PathTracker.GetCurrentPath(input.Unit).Time > 0.1d)
                {
                    result.Hitchance = HitChance.Medium;
                }
            }

            if (totalDelay > 0.7 + (input.Radius / 500) && input.Unit.IsWindingUp)
            {
                result.Hitchance = HitChance.Medium;
            }

            if (input.Unit.Distance(input.From) < 300 || LastWaypiont.Distance(input.From) < 250 || input.Unit.MoveSpeed < 200f)
            {
                result.Hitchance = HitChance.VeryHigh;
            }
            return result;
//.........这里部分代码省略.........
开发者ID:skules,项目名称:LeagueRepo,代码行数:101,代码来源:PredictionOktw.cs


注:本文中的PredictionInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。