コード例 #1
0
        public static void CastSpell(Spell QWER, AIBaseClient target)
        {
            var predIndex = 0;
            var hitchance = HitChance.Low;
            var pred      = Config["predictionmode"];

            if (QWER.Slot == SpellSlot.Q)
            {
                predIndex = pred.GetValue <MenuList <string> >("Qpred").Index;
                var idx = pred.GetValue <MenuList <string> >("QHitChance").Index;
                if (idx == 0)
                {
                    hitchance = HitChance.VeryHigh;
                }
                else if (idx == 1)
                {
                    hitchance = HitChance.High;
                }
                else if (idx == 2)
                {
                    hitchance = HitChance.Low;
                }
            }
            else if (QWER.Slot == SpellSlot.W)
            {
                predIndex = pred.GetValue <MenuList <string> >("Wpred").Index;
                var idx = pred.GetValue <MenuList <string> >("WHitChance").Index;
                if (idx == 0)
                {
                    hitchance = HitChance.VeryHigh;
                }
                else if (idx == 1)
                {
                    hitchance = HitChance.High;
                }
                else if (idx == 2)
                {
                    hitchance = HitChance.Low;
                }
            }
            else if (QWER.Slot == SpellSlot.E)
            {
                predIndex = pred.GetValue <MenuList <string> >("Epred").Index;
                var idx = pred.GetValue <MenuList <string> >("EHitChance").Index;
                if (idx == 0)
                {
                    hitchance = HitChance.VeryHigh;
                }
                else if (idx == 1)
                {
                    hitchance = HitChance.High;
                }
                else if (idx == 2)
                {
                    hitchance = HitChance.Low;
                }
            }
            else if (QWER.Slot == SpellSlot.R)
            {
                predIndex = pred.GetValue <MenuList <string> >("Rpred").Index;
                var idx = pred.GetValue <MenuList <string> >("RHitChance").Index;
                if (idx == 0)
                {
                    hitchance = HitChance.VeryHigh;
                }
                else if (idx == 1)
                {
                    hitchance = HitChance.High;
                }
                else if (idx == 2)
                {
                    hitchance = HitChance.Low;
                }
            }

            if (predIndex == 0)
            {
                var poutput = QWER.GetPrediction(target);

                if (QWER.Speed != float.MaxValue && OktwCommon.CollisionYasuo(Player.Position, poutput.CastPosition))
                {
                    return;
                }

                if (poutput.Hitchance >= hitchance)
                {
                    QWER.Cast(poutput.CastPosition);
                }
            }
            else if (predIndex == 1)
            {
                var coreType2 = SkillshotType.SkillshotLine;
                var aoe2      = false;

                if (QWER.Type == SkillshotType.SkillshotCircle)
                {
                    coreType2 = SkillshotType.SkillshotCircle;
                    aoe2      = true;
                }

                if (QWER.Width > 80 && !QWER.Collision)
                {
                    aoe2 = true;
                }

                var predInput2 = new PredictionInput
                {
                    AoE       = aoe2,
                    Collision = QWER.Collision,
                    Speed     = QWER.Speed,
                    Delay     = QWER.Delay,
                    Range     = QWER.Range,
                    From      = Player.Position,
                    Radius    = QWER.Width,
                    Unit      = target,
                    Type      = coreType2
                };

                var poutput2 = Movement.GetPrediction(predInput2);

                if (QWER.Speed != float.MaxValue && OktwCommon.CollisionYasuo(Player.Position, poutput2.CastPosition))
                {
                    return;
                }

                if (hitchance == HitChance.VeryHigh)
                {
                    if (poutput2.Hitchance >= HitChance.VeryHigh)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                    else if (predInput2.AoE && poutput2.AoeTargetsHitCount > 1 && poutput2.Hitchance >= HitChance.High)
                    {
                        QWER.Cast(poutput2.CastPosition);
                    }
                }
                else if (poutput2.Hitchance >= hitchance)
                {
                    QWER.Cast(poutput2.CastPosition);
                }

                if (Game.Time - DrawSpellTime > 0.5)
                {
                    DrawSpell     = QWER;
                    DrawSpellTime = Game.Time;
                }

                DrawSpellPos = poutput2;
            }
            else if (predIndex == 2)
            {
            }
            else if (predIndex == 3)
            {
                if (QWER.Type == SkillshotType.SkillshotCircle)
                {
                    Core.PredictionAio.CCast(QWER, target, hitchance);
                }
                else if (QWER.Type == SkillshotType.SkillshotLine)
                {
                    Core.PredictionAio.LCast(QWER, target, hitchance);
                }
                else if (QWER.Type == SkillshotType.SkillshotCone)
                {
                    Core.PredictionAio.ConeCast(QWER, target, hitchance);
                }
                else
                {
                    QWER.Cast(target);
                }
            }
        }
コード例 #2
0
        private static void startInsec()
        {
            LeeSin.myHero.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos);

            if (insecTarget == null || !insecTarget.IsValidTarget() || !LeeSin.R.IsReady())
            {
                return;
            }

            Vector3 endPos = new Vector3();

            if (insecAlly != default(Obj_AI_Hero))
            {
                endPos = insecAlly.Position;
            }
            else if (insecTurret != default(Obj_AI_Turret))
            {
                endPos = insecTurret.Position;
            }
            else
            {
                endPos = insecPos;
            }

            if (endPos == default(Vector3))
            {
                return;
            }

            Vector3 WardPos = insecTarget.Position + (insecTarget.Position - endPos).Normalized() * 300;

            if (LeeSin.myHero.Distance(WardPos) < 100)
            {
                LeeSin.R.Cast(insecTarget);
                return;
            }

            Spell wardSpell = LeeSin.FindWard();

            if (LeeSin.Q.IsReady() && !LeeSin.IsSecondCast(LeeSin.Q) && LeeSin.W.IsReady() && !LeeSin.IsSecondCast(LeeSin.W) && wardSpell != null)
            {
                int     HitChance = 0;
                Vector3 pos       = new Vector3();

                if (MenuManager.myMenu.Item("pred.list2").GetValue <StringList>().SelectedIndex == 0)
                {
                    PredictionOutput pred = LeeSin.Q.GetPrediction(insecTarget);
                    HitChance = (int)pred.Hitchance;
                    pos       = pred.CastPosition;
                }
                else
                {
                    resultPred pred = myPred.GetPrediction(insecTarget, LeeSin.Q);
                    HitChance = pred.Hitchance;
                    pos       = pred.predPos;
                }

                if (HitChance >= MenuManager.myMenu.Item("insec.qHitChance").GetValue <Slider>().Value)
                {
                    LeeSin.Q.Cast(pos);
                    return;
                }
                else
                {
                    var enemyMinion = MinionManager.GetMinions(LeeSin.Q.Range, MinionTypes.All, MinionTeam.Enemy, MinionOrderTypes.None);
                    var isMinion    = enemyMinion.Where(unit => unit.Position.Distance(WardPos) < 500 && unit.Health > LeeSin.GetDamage_Q1(unit));
                    if (isMinion.Count() > 0)
                    {
                        PredictionOutput qPred = LeeSin.Q.GetPrediction(isMinion.First());
                        if ((int)qPred.Hitchance >= MenuManager.myMenu.Item("combo.qHitChance").GetValue <Slider>().Value)
                        {
                            LeeSin.Q.Cast(qPred.CastPosition);
                        }
                    }

                    var secondUnit = HeroManager.Enemies.Where(unit => unit.Position.Distance(WardPos) < 500);
                    if (secondUnit.Count() > 0)
                    {
                        if (MenuManager.myMenu.Item("pred.list2").GetValue <StringList>().SelectedIndex == 0)
                        {
                            PredictionOutput qPred = LeeSin.Q.GetPrediction(secondUnit.First());
                            if ((int)qPred.Hitchance >= MenuManager.myMenu.Item("combo.qHitChance").GetValue <Slider>().Value)
                            {
                                LeeSin.Q.Cast(qPred.CastPosition);
                            }
                        }
                        else
                        {
                            resultPred qPred = myPred.GetPrediction(secondUnit.First(), LeeSin.Q);
                            if (qPred.Hitchance >= MenuManager.myMenu.Item("combo.qHitChance").GetValue <Slider>().Value)
                            {
                                LeeSin.Q.Cast(qPred.predPos);
                            }
                        }
                    }
                }
            }

            if (LeeSin.Q.IsReady() && LeeSin.IsSecondCast(LeeSin.Q) && qHit != null && qHit.Position.Distance(WardPos) < 600)
            {
                LeeSin.Q.Cast();
                return;
            }

            if (LeeSin.myHero.Distance(WardPos) < 600 && LeeSin.W.IsReady() && !LeeSin.IsSecondCast(LeeSin.W))
            {
                LeeSin.WardJump_Position(WardPos);
                return;
            }
        }
コード例 #3
0
        private void UseSpells(bool useQ, bool useW, bool useE, bool useR, string source)
        {
            var         range         = E.IsReady() ? E.Range : Q.Range;
            var         focusSelected = menu.Item("selected", true).GetValue <bool>();
            Obj_AI_Hero target        = TargetSelector.GetTarget(range, TargetSelector.DamageType.Magical);

            if (TargetSelector.GetSelectedTarget() != null)
            {
                if (focusSelected && TargetSelector.GetSelectedTarget().Distance(Player.ServerPosition) < range)
                {
                    target = TargetSelector.GetSelectedTarget();
                }
            }

            int dfgMode = menu.Item("DFGMode", true).GetValue <StringList>().SelectedIndex;

            bool hasMana = ManaCheck2();

            float dmg   = GetComboDamage(target);
            var   waitW = menu.Item("waitW", true).GetValue <bool>();

            if (source == "Harass" && !HasMana("Harass"))
            {
                return;
            }

            if (useW && target != null && Player.Distance(target) <= W.Range && W.IsReady())
            {
                if (menu.Item("wPoke", true).GetValue <KeyBind>().Active)
                {
                    var pred = W.GetPrediction(target);
                    if (pred.Hitchance == HitChance.Immobile || IsStunned(target))
                    {
                        W.Cast(target.ServerPosition, packets());
                    }
                }
                else
                {
                    PredictionOutput pred = Prediction.GetPrediction(target, 1.25f);
                    if (pred.Hitchance >= HitChance.High && W.IsReady())
                    {
                        W.Cast(pred.CastPosition, packets());
                    }
                }
            }

            if (useE && target != null && E.IsReady() && Player.Distance(target) < E.Range)
            {
                if (!waitW || W.IsReady())
                {
                    CastE(target);
                    return;
                }
            }

            //DFG
            if (target != null && dfgMode == 0 && source == "Combo" && hasMana)
            {
                ActiveItems.Target = target;

                //see if killable
                if (dmg > target.Health - 50)
                {
                    ActiveItems.KillableTarget = true;
                }
                if ((menu.Item("DontDFG" + target.BaseSkinName, true) != null &&
                     menu.Item("DontDFG" + target.BaseSkinName, true).GetValue <bool>() == false))
                {
                    ActiveItems.UseTargetted = true;
                }
            }

            //Q
            if (useQ && Q.IsReady() && Player.Distance(target) <= Q.Range && target != null)
            {
                Q.CastOnUnit(target, packets());
            }

            //R
            if (target != null && R.IsReady())
            {
                useR = rTarget(target) && useR;
                if (useR)
                {
                    CastR(target, dmg);
                }
            }
        }
コード例 #4
0
        private static void Rlogic()
        {
            R.Range = Config.Item("RcustomeMax").GetValue <Slider>().Value;

            if (Config.Item("useR").GetValue <KeyBind>().Active)
            {
                var t = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Physical);
                if (t.IsValidTarget())
                {
                    if (Config.Item("semiMode").GetValue <StringList>().SelectedIndex == 0)
                    {
                        R.Cast(t);
                    }
                    else
                    {
                        R.CastIfWillHit(t, 2);
                        R.Cast(t, true, true);
                    }
                }
            }

            if (Config.Item("Rks").GetValue <bool>())
            {
                bool cast = false;


                if (Config.Item("RoverAA").GetValue <bool>() && (!SebbyLib.Orbwalking.CanAttack() || Player.IsWindingUp))
                {
                    return;
                }

                foreach (var target in Enemies.Where(target => target.IsValidTarget(R.Range) && OktwCommon.ValidUlt(target)))
                {
                    float predictedHealth = target.Health + target.HPRegenRate * 2;

                    var Rdmg = R.GetDamage(target, 1);
                    if (Player.Distance(target.Position) < 1500)
                    {
                        Rdmg = Rdmg * (Player.Distance(target.Position) / 1500);
                    }

                    if (Rdmg > predictedHealth)
                    {
                        cast = true;
                        PredictionOutput output    = R.GetPrediction(target);
                        Vector2          direction = output.CastPosition.To2D() - Player.Position.To2D();
                        direction.Normalize();

                        foreach (var enemy in Enemies.Where(enemy => enemy.IsValidTarget()))
                        {
                            if (enemy.NetworkId == target.NetworkId || !cast)
                            {
                                continue;
                            }
                            PredictionOutput prediction        = R.GetPrediction(enemy);
                            Vector3          predictedPosition = prediction.CastPosition;
                            Vector3          v      = output.CastPosition - Player.ServerPosition;
                            Vector3          w      = predictedPosition - Player.ServerPosition;
                            double           c1     = Vector3.Dot(w, v);
                            double           c2     = Vector3.Dot(v, v);
                            double           b      = c1 / c2;
                            Vector3          pb     = Player.ServerPosition + ((float)b * v);
                            float            length = Vector3.Distance(predictedPosition, pb);
                            if (length < (R.Width + 150 + enemy.BoundingRadius / 2) && Player.Distance(predictedPosition) < Player.Distance(target.ServerPosition))
                            {
                                cast = false;
                            }
                        }

                        if (cast)
                        {
                            if (Config.Item("RoverW").GetValue <bool>() && target.IsValidTarget(W.Range) && W.GetDamage(target) > target.Health && W.Instance.Cooldown - (W.Instance.CooldownExpires - Game.Time) < 1.1)
                            {
                                return;
                            }

                            if (target.CountEnemiesInRange(400) > Config.Item("Raoe").GetValue <Slider>().Value)
                            {
                                CastSpell(R, target);
                            }

                            if (RValidRange(target) && target.CountAlliesInRange(Config.Item("Rover").GetValue <Slider>().Value) == 0)
                            {
                                CastSpell(R, target);
                            }
                        }
                    }
                }
            }
        }
コード例 #5
0
ファイル: PredictionOktw.cs プロジェクト: rio4948/LeagueRepo
        private static PredictionOutput WayPointAnalysis(PredictionOutput result, PredictionInput input)
        {
            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.SkillshotCircle)
            {
                fixRange -= input.Radius / 2;
            }

            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;
                    return result;
                }
            }

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

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

            if (input.Type == SkillshotType.SkillshotLine)
            {
                if (input.Unit.Path.Count() > 0)
                {
                    if (GetAngle(input.From, input.Unit) < 36)
                    {
                        result.Hitchance = HitChance.VeryHigh;
                        return result;
                    }
                    else
                        result.Hitchance = HitChance.High;

                }
            }
            else if (input.Type == SkillshotType.SkillshotCircle)
            {
                if (totalDelay < 1.2)
                {
                    if (totalDelay < 0.7 && OnProcessSpellDetection.GetLastAutoAttackTime(input.Unit) < 0.1d)
                        result.Hitchance = HitChance.VeryHigh;

                    if (PathTracker.GetCurrentPath(input.Unit).Time < 0.1d)
                        result.Hitchance = HitChance.VeryHigh;
                }
            }

            float BackToFront = ((input.Unit.MoveSpeed * input.Delay) + (input.From.Distance(input.Unit.ServerPosition) / input.Speed));

            if (input.Unit.Path.Count() > 0)
            {
                if (input.Unit.Distance(LastWaypiont) < BackToFront)
                {
                    result.Hitchance = HitChance.Medium;
                    return result;
                }
            }

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

            if (input.Unit.Path.Count() > 1 && input.Type == SkillshotType.SkillshotLine)
            {
                result.Hitchance = HitChance.Medium;
            }
            return result;
        }
コード例 #6
0
ファイル: Orianna.cs プロジェクト: uio25371555/LSharp
        private void CastE(Obj_AI_Base target)
        {
            if (_isBallMoving)
            {
                return;
            }

            if (menu.Item("saveEMana", true).GetValue <bool>() && Player.Mana - ESpell.ManaCost < QSpell.ManaCost + WSpell.ManaCost)
            {
                return;
            }

            Obj_AI_Hero etarget = Player;

            switch (_ballStatus)
            {
            case 0:
                if (target != null)
                {
                    float travelTime    = target.Distance(Player.ServerPosition) / Q.Speed;
                    float minTravelTime = 10000f;

                    foreach (
                        Obj_AI_Hero ally in
                        ObjectManager.Get <Obj_AI_Hero>()
                        .Where(x => x.IsAlly && Player.Distance(x.ServerPosition) <= E.Range && !x.IsMe))
                    {
                        //dmg enemy with E
                        if (menu.Item("UseEDmg", true).GetValue <bool>())
                        {
                            PredictionOutput prediction3 = Util.GetP(Player.ServerPosition, E, target, true);
                            Object[]         obj         = Util.VectorPointProjectionOnLineSegment(Player.ServerPosition.To2D(),
                                                                                                   ally.ServerPosition.To2D(), prediction3.UnitPosition.To2D());
                            var isOnseg   = (bool)obj[2];
                            var pointLine = (Vector2)obj[1];

                            if (E.IsReady() && isOnseg &&
                                prediction3.UnitPosition.Distance(pointLine.To3D()) < E.Width)
                            {
                                //Console.WriteLine("Dmg 1");
                                E.CastOnUnit(ally);
                                return;
                            }
                        }

                        float allyRange = target.Distance(ally.ServerPosition) / Q.Speed +
                                          ally.Distance(Player.ServerPosition) / E.Speed;
                        if (allyRange < minTravelTime)
                        {
                            etarget       = ally;
                            minTravelTime = allyRange;
                        }
                    }

                    if (minTravelTime < travelTime && Player.Distance(etarget.ServerPosition) <= E.Range &&
                        E.IsReady())
                    {
                        E.CastOnUnit(etarget);
                    }
                }
                break;

            case 1:
                //dmg enemy with E
                if (menu.Item("UseEDmg", true).GetValue <bool>())
                {
                    PredictionOutput prediction = Util.GetP(_currentBallPosition, E, target, true);
                    Object[]         obj        = Util.VectorPointProjectionOnLineSegment(_currentBallPosition.To2D(),
                                                                                          Player.ServerPosition.To2D(), prediction.UnitPosition.To2D());
                    var isOnseg   = (bool)obj[2];
                    var pointLine = (Vector2)obj[1];

                    if (E.IsReady() && isOnseg && prediction.UnitPosition.Distance(pointLine.To3D()) < E.Width)
                    {
                        //Console.WriteLine("Dmg 2");
                        E.CastOnUnit(Player);
                        return;
                    }
                }

                float travelTime2    = target.Distance(_currentBallPosition) / Q.Speed;
                float minTravelTime2 = target.Distance(Player.ServerPosition) / Q.Speed +
                                       Player.Distance(_currentBallPosition) / E.Speed;

                if (minTravelTime2 < travelTime2 && target.Distance(Player.ServerPosition) <= Q.Range + Q.Width &&
                    E.IsReady())
                {
                    E.CastOnUnit(Player);
                }

                break;

            case 2:
                float travelTime3    = target.Distance(_currentBallPosition) / Q.Speed;
                float minTravelTime3 = 10000f;

                foreach (
                    Obj_AI_Hero ally in
                    ObjectManager.Get <Obj_AI_Hero>()
                    .Where(x => x.IsAlly && Player.Distance(x.ServerPosition) <= E.Range && !x.IsMe))
                {
                    //dmg enemy with E
                    if (menu.Item("UseEDmg", true).GetValue <bool>())
                    {
                        PredictionOutput prediction2 = Util.GetP(_currentBallPosition, E, target, true);
                        Object[]         obj         = Util.VectorPointProjectionOnLineSegment(_currentBallPosition.To2D(),
                                                                                               ally.ServerPosition.To2D(), prediction2.UnitPosition.To2D());
                        var isOnseg   = (bool)obj[2];
                        var pointLine = (Vector2)obj[1];

                        if (E.IsReady() && isOnseg &&
                            prediction2.UnitPosition.Distance(pointLine.To3D()) < E.Width)
                        {
                            Console.WriteLine("Dmg 3");
                            E.CastOnUnit(ally);
                            return;
                        }
                    }

                    float allyRange2 = target.Distance(ally.ServerPosition) / Q.Speed +
                                       ally.Distance(_currentBallPosition) / E.Speed;

                    if (allyRange2 < minTravelTime3)
                    {
                        etarget        = ally;
                        minTravelTime3 = allyRange2;
                    }
                }

                if (minTravelTime3 < travelTime3 && Player.Distance(etarget.ServerPosition) <= E.Range &&
                    E.IsReady())
                {
                    E.CastOnUnit(etarget);
                }

                break;
            }
        }
コード例 #7
0
        internal static PredictionOutput WayPointAnalysis(PredictionOutput result, PredictionInput input)
        {
            if (!input.Unit.IsValid<Obj_AI_Hero>())
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            result.Hitchance = HitChance.High;

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

            float totalDelay;

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

            float moveArea = input.Unit.MoveSpeed * totalDelay;
            float fixRange = moveArea * 0.6f;
            double angleMove = 30 + (input.Radius / 15);
            float backToFront = moveArea * 1.5f;
            float pathMinLen = 500f + backToFront;

            if (UnitTracker.GetLastNewPathTime(input.Unit) < 0.1d)
            {
                pathMinLen = 550f;
                fixRange = moveArea * 0.4f;
                backToFront = moveArea;
                angleMove += 5;
            }

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

            if (distanceUnitToWaypoint > pathMinLen)
            {
                result.Hitchance = HitChance.VeryHigh;
            }
            else if (input.Type == SkillshotType.SkillshotLine)
            {
                if (input.Unit.Path.Count() > 1)
                    result.Hitchance = HitChance.Medium;
                else if (input.Unit.Path.Count() > 0)
                {
                    if (GetAngle(input.From, input.Unit) < angleMove)
                    {
                        backToFront = moveArea / 2 ;
                        result.Hitchance = HitChance.VeryHigh;
                    }
                    else
                        result.Hitchance = HitChance.High;
                }
            }

            if (input.Unit.Path.Count() == 0 && input.Unit.Position == input.Unit.ServerPosition)
            {
                if (UnitTracker.GetLastStopMoveTime(input.Unit) < 0.3d)
                    result.Hitchance = HitChance.High;
                else if (distanceFromToUnit > input.Range - fixRange)
                    result.Hitchance = HitChance.High;
                else
                    result.Hitchance = HitChance.VeryHigh;

            }
            else if (distanceFromToWaypoint <= input.Unit.Distance(input.From))
            {
                if (distanceFromToUnit > input.Range - fixRange)
                    result.Hitchance = HitChance.Medium;
            }

            if (UnitTracker.GetLastAutoAttackTime(input.Unit) < 0.1d)
            {
                if (input.Type == SkillshotType.SkillshotLine && totalDelay < 0.8)
                    result.Hitchance = HitChance.VeryHigh;
                else if (totalDelay < 0.7)
                    result.Hitchance = HitChance.High;
                else
                    result.Hitchance = HitChance.Medium;
            }

            if (input.Type == SkillshotType.SkillshotCircle)
            {
                if (totalDelay < 1.1 && UnitTracker.GetLastNewPathTime(input.Unit) < 0.1d)
                    result.Hitchance = HitChance.VeryHigh;
            }

            if (result.Hitchance != HitChance.Medium)
            {
                if (input.Unit.IsWindingUp && UnitTracker.GetLastAutoAttackTime(input.Unit) > 0.1d)
                    result.Hitchance = HitChance.Medium;
                else if (input.Unit.Path.Count() == 0 && input.Unit.Position != input.Unit.ServerPosition)
                    result.Hitchance = HitChance.Medium;
                else if (input.Unit.Path.Count() > 0)
                {
                    if (distanceUnitToWaypoint < backToFront || input.Unit.Position == input.Unit.ServerPosition)
                        result.Hitchance = HitChance.Medium;
                }
            }

            if (input.Unit.Distance(input.From) < 300 || distanceFromToWaypoint < 400 || input.Unit.MoveSpeed < 200f)
                result.Hitchance = HitChance.VeryHigh;

            return result;
        }
コード例 #8
0
        private void LogicR()
        {
            bool   cast        = false;
            double secoundDmgR = 0.80;

            foreach (var target in Program.Enemies.Where(target => target.IsValidTarget(R1.Range) && OktwCommon.ValidUlt(target)))
            {
                float  predictedHealth = target.Health + target.HPRegenRate;
                double Rdmg            = OktwCommon.GetKsDamage(target, R);
                var    collisionTarget = target;
                cast = true;
                PredictionOutput output    = R.GetPrediction(target);
                Vector2          direction = output.CastPosition.To2D() - Player.Position.To2D();
                direction.Normalize();
                List <Obj_AI_Hero> enemies = ObjectManager.Get <Obj_AI_Hero>().Where(x => x.IsEnemy && x.IsValidTarget()).ToList();
                foreach (var enemy in enemies)
                {
                    if (enemy.SkinName == target.SkinName || !cast)
                    {
                        continue;
                    }
                    PredictionOutput prediction        = R.GetPrediction(enemy);
                    Vector3          predictedPosition = prediction.CastPosition;
                    Vector3          v      = output.CastPosition - Player.ServerPosition;
                    Vector3          w      = predictedPosition - Player.ServerPosition;
                    double           c1     = Vector3.Dot(w, v);
                    double           c2     = Vector3.Dot(v, v);
                    double           b      = c1 / c2;
                    Vector3          pb     = Player.ServerPosition + ((float)b * v);
                    float            length = Vector3.Distance(predictedPosition, pb);
                    if (length < (120 + enemy.BoundingRadius) && Player.Distance(predictedPosition) < Player.Distance(target.ServerPosition))
                    {
                        cast            = false;
                        collisionTarget = enemy;
                    }
                }
                if (cast &&
                    Rdmg > predictedHealth &&
                    target.IsValidTarget(R.Range) &&
                    (!Orbwalking.InAutoAttackRange(target) || ObjectManager.Player.Health < ObjectManager.Player.MaxHealth * 0.6))
                {
                    Program.CastSpell(R, target);
                    Program.debug("Rdmg");
                }
                else if (cast &&
                         Rdmg * secoundDmgR > predictedHealth &&
                         target.IsValidTarget(R1.Range) &&
                         target.CountAlliesInRange(300) == 0 && (!Orbwalking.InAutoAttackRange(target) || ObjectManager.Player.Health < ObjectManager.Player.MaxHealth * 0.6))
                {
                    Program.CastSpell(R, target);
                    Program.debug("Rdmg 0.7");
                }
                else if (!cast && Rdmg * secoundDmgR > predictedHealth && target.IsValidTarget(Player.Distance(collisionTarget.Position) + 700))
                {
                    Program.CastSpell(R, target);
                    Program.debug("Rdmg 0.7 collision");
                }
                else if (cast && Config.Item("fastR", true).GetValue <bool>() && Rdmg > predictedHealth && Orbwalking.InAutoAttackRange(target) && Program.Combo)
                {
                    Program.CastSpell(R, target);
                    Program.debug("R fast");
                }
            }
        }
コード例 #9
0
        private static void Game_OnGameUpdate(EventArgs args)
        {
            ManaMenager();
            if (Orbwalker.ActiveMode.ToString() == "Mixed" || Orbwalker.ActiveMode.ToString() == "LaneClear" || Orbwalker.ActiveMode.ToString() == "LastHit")
            {
                Farm = true;
            }
            else
            {
                Farm = false;
            }

            if (E.IsReady() && ObjectManager.Player.Mana > RMANA + EMANA)
            {
                foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(E.Range) && E.IsReady()))
                {
                    if (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) ||
                        enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) ||
                        enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuffOfType(BuffType.Suppression) ||
                        enemy.IsStunned || enemy.HasBuff("Recall"))
                    {
                        E.Cast(enemy, true);
                    }
                    else if (enemy.HasBuffOfType(BuffType.Slow) && enemy.Path.Count() > 1)
                    {
                        E.CastIfHitchanceEquals(enemy, HitChance.VeryHigh, true);
                    }
                    else if (enemy.Path.Count() > 1 && enemy.CountEnemiesInRange(300) > 2)
                    {
                        E.CastIfHitchanceEquals(enemy, HitChance.VeryHigh, true);
                    }
                    else
                    {
                        E.CastIfHitchanceEquals(enemy, HitChance.Immobile, true);
                    }
                }
                foreach (var Object in ObjectManager.Get <Obj_AI_Base>().Where(Obj => Obj.Distance(Player.ServerPosition) < E.Range && E.IsReady() && Obj.Team != Player.Team && (Obj.HasBuff("teleport_target", true) || Obj.HasBuff("Pantheon_GrandSkyfall_Jump", true))))
                {
                    E.Cast(Object.Position, true);
                }
                var ta = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);
                if (Orbwalker.ActiveMode.ToString() == "Combo" && E.IsReady() && ta.IsValidTarget(E.Range) && Config.Item("autoE").GetValue <bool>() && ObjectManager.Player.Mana > RMANA + EMANA + WMANA && ta.Path.Count() == 1)
                {
                    if (ObjectManager.Player.Position.Distance(ta.ServerPosition) > ObjectManager.Player.Position.Distance(ta.Position))
                    {
                        if (ta.Position.Distance(ObjectManager.Player.ServerPosition) < ta.Position.Distance(ObjectManager.Player.Position) && ta.IsValidTarget(E.Range))
                        {
                            E.CastIfHitchanceEquals(ta, HitChance.VeryHigh, true);
                            debug("E run");
                        }
                    }
                    else
                    {
                        if (ta.Position.Distance(ObjectManager.Player.ServerPosition) > ta.Position.Distance(ObjectManager.Player.Position) && ta.IsValidTarget(E.Range))
                        {
                            E.CastIfHitchanceEquals(ta, HitChance.VeryHigh, true);
                            debug("E escape");
                        }
                    }
                }
            }

            if (Q.IsReady())
            {
                ManaMenager();
                if (Farm)
                {
                    if (ObjectManager.Player.Mana > RMANA + WMANA + EMANA + 10 && !FishBoneActive)
                    {
                        farmQ();
                    }
                }
                var t = TargetSelector.GetTarget(bonusRange() + 50, TargetSelector.DamageType.Physical);
                if (t.IsValidTarget())
                {
                    var distance    = GetRealDistance(t);
                    var powPowRange = GetRealPowPowRange(t);
                    if (!FishBoneActive && !Orbwalking.InAutoAttackRange(t))
                    {
                        if (Orbwalker.ActiveMode.ToString() == "Combo" && (ObjectManager.Player.Mana > RMANA + WMANA + 20 || ObjectManager.Player.GetAutoAttackDamage(t) * 2 > t.Health))
                        {
                            Q.Cast();
                        }
                        else if (Orbwalker.ActiveMode.ToString() == "Mixed" && haras() && !ObjectManager.Player.UnderTurret(true) && ObjectManager.Player.Mana > RMANA + WMANA + EMANA + WMANA + 20 && distance < bonusRange() + t.BoundingRadius + ObjectManager.Player.BoundingRadius)
                        {
                            Q.Cast();
                        }
                        else if (Orbwalker.ActiveMode.ToString() == "LaneClear" && haras() && !ObjectManager.Player.UnderTurret(true) && ObjectManager.Player.Mana > RMANA + WMANA + EMANA + WMANA + 20 && distance < bonusRange())
                        {
                            Q.Cast();
                        }
                    }
                    else if (FishBoneActive && attackNow)
                    {
                        if (Orbwalker.ActiveMode.ToString() == "Combo" && (distance < powPowRange) && (ObjectManager.Player.Mana < RMANA + WMANA + 20 || ObjectManager.Player.GetAutoAttackDamage(t) * 2 < t.Health))
                        {
                            Q.Cast();
                        }
                        else if (Farm && (distance > bonusRange() || distance < powPowRange || ObjectManager.Player.Mana < RMANA + EMANA + WMANA + WMANA))
                        {
                            Q.Cast();
                        }
                    }
                }
                else if (!FishBoneActive && (Orbwalker.ActiveMode.ToString() == "Combo") && ObjectManager.Player.Mana > RMANA + WMANA + 20)
                {
                    Q.Cast();
                }
                else if (FishBoneActive && (Orbwalker.ActiveMode.ToString() == "Combo") && ObjectManager.Player.Mana < RMANA + WMANA + 20)
                {
                    Q.Cast();
                }
                else if (FishBoneActive && Farm)
                {
                    Q.Cast();
                }
            }

            if (W.IsReady() && (Game.Time - QCastTime > 0.6))
            {
                ManaMenager();
                bool cast = false;
                bool wait = false;
                foreach (var target in ObjectManager.Get <Obj_AI_Hero>())
                {
                    if (target.IsValidTarget(W.Range) &&
                        !target.HasBuffOfType(BuffType.PhysicalImmunity) && !target.HasBuffOfType(BuffType.SpellImmunity) && !target.HasBuffOfType(BuffType.SpellShield))
                    {
                        float predictedHealth = HealthPrediction.GetHealthPrediction(target, (int)(W.Delay + (Player.Distance(target.ServerPosition) / W.Speed) * 1000));
                        var   Wdmg            = W.GetDamage(target);
                        if (Wdmg > predictedHealth)
                        {
                            cast = true;
                            wait = true;
                            PredictionOutput output    = R.GetPrediction(target);
                            Vector2          direction = output.CastPosition.To2D() - Player.Position.To2D();
                            direction.Normalize();
                            List <Obj_AI_Hero> enemies = ObjectManager.Get <Obj_AI_Hero>().Where(x => x.IsEnemy && x.IsValidTarget()).ToList();
                            foreach (var enemy in enemies)
                            {
                                if (enemy.SkinName == target.SkinName || !cast)
                                {
                                    continue;
                                }
                                PredictionOutput prediction        = R.GetPrediction(enemy);
                                Vector3          predictedPosition = prediction.CastPosition;
                                Vector3          v      = output.CastPosition - Player.ServerPosition;
                                Vector3          w      = predictedPosition - Player.ServerPosition;
                                double           c1     = Vector3.Dot(w, v);
                                double           c2     = Vector3.Dot(v, v);
                                double           b      = c1 / c2;
                                Vector3          pb     = Player.ServerPosition + ((float)b * v);
                                float            length = Vector3.Distance(predictedPosition, pb);
                                if (length < (W.Width + enemy.BoundingRadius) && Player.Distance(predictedPosition) < Player.Distance(target.ServerPosition))
                                {
                                    cast = false;
                                }
                            }
                            if (!Orbwalking.InAutoAttackRange(target) && cast && target.IsValidTarget(W.Range) && ObjectManager.Player.CountEnemiesInRange(400) == 0)
                            {
                                W.Cast(target, true);
                                debug("W ks");
                            }
                        }
                    }
                }

                var t = TargetSelector.GetTarget(W.Range, TargetSelector.DamageType.Physical);
                if (t.IsValidTarget() && W.IsReady() && !wait)
                {
                    if (Orbwalker.ActiveMode.ToString() == "Combo" && ObjectManager.Player.Mana > RMANA + WMANA + 10 && ObjectManager.Player.CountEnemiesInRange(GetRealPowPowRange(t)) == 0)
                    {
                        castW(t);
                    }
                    else if ((Farm && ObjectManager.Player.Mana > RMANA + EMANA + WMANA + WMANA + 20) && !ObjectManager.Player.UnderTurret(true) && ObjectManager.Player.CountEnemiesInRange(bonusRange()) == 0 && haras())
                    {
                        castW(t);
                    }
                    else if ((Orbwalker.ActiveMode.ToString() == "Combo" || Farm) && ObjectManager.Player.Mana > RMANA + WMANA && ObjectManager.Player.CountEnemiesInRange(GetRealPowPowRange(t)) == 0)
                    {
                        foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(W.Range)))
                        {
                            if (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) ||
                                enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) ||
                                enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuffOfType(BuffType.Slow) || enemy.HasBuff("Recall"))
                            {
                                W.Cast(enemy, true);
                            }
                        }
                    }
                }
            }

            if (R.IsReady() && Config.Item("autoR").GetValue <bool>())
            {
                bool cast = false;
                foreach (var target in ObjectManager.Get <Obj_AI_Hero>())
                {
                    if (target.IsValidTarget() && (Game.Time - WCastTime > 1) &&
                        !target.HasBuffOfType(BuffType.PhysicalImmunity) && !target.HasBuffOfType(BuffType.SpellImmunity) && !target.HasBuffOfType(BuffType.SpellShield))
                    {
                        float predictedHealth = HealthPrediction.GetHealthPrediction(target, (int)(R.Delay + (Player.Distance(target.ServerPosition) / R.Speed) * 1000));
                        var   Rdmg            = R.GetDamage(target);
                        if (Rdmg > predictedHealth)
                        {
                            cast = true;
                            PredictionOutput output    = R.GetPrediction(target);
                            Vector2          direction = output.CastPosition.To2D() - Player.Position.To2D();
                            direction.Normalize();
                            List <Obj_AI_Hero> enemies = ObjectManager.Get <Obj_AI_Hero>().Where(x => x.IsEnemy && x.IsValidTarget()).ToList();
                            foreach (var enemy in enemies)
                            {
                                if (enemy.SkinName == target.SkinName || !cast)
                                {
                                    continue;
                                }
                                PredictionOutput prediction        = R.GetPrediction(enemy);
                                Vector3          predictedPosition = prediction.CastPosition;
                                Vector3          v      = output.CastPosition - Player.ServerPosition;
                                Vector3          w      = predictedPosition - Player.ServerPosition;
                                double           c1     = Vector3.Dot(w, v);
                                double           c2     = Vector3.Dot(v, v);
                                double           b      = c1 / c2;
                                Vector3          pb     = Player.ServerPosition + ((float)b * v);
                                float            length = Vector3.Distance(predictedPosition, pb);
                                if (length < (R.Width + 150 + enemy.BoundingRadius / 2) && Player.Distance(predictedPosition) < Player.Distance(target.ServerPosition))
                                {
                                    cast = false;
                                }
                            }

                            if (cast && target.IsValidTarget(R.Range) && GetRealDistance(target) > bonusRange() + 200 + target.BoundingRadius && target.CountAlliesInRange(600) == 0 && ObjectManager.Player.CountEnemiesInRange(400) == 0)
                            {
                                if (Config.Item("hitchanceR").GetValue <bool>() && target.Path.Count() < 2)
                                {
                                    R.CastIfHitchanceEquals(target, HitChance.VeryHigh, true);
                                    debug("R normal");
                                }
                                else
                                {
                                    R.Cast(target, true);
                                    debug("R normal");
                                }
                            }
                            else if (cast && target.IsValidTarget(R.Range) && target.CountEnemiesInRange(200) > 2 && GetRealDistance(target) > bonusRange() + 200 + target.BoundingRadius)
                            {
                                R1.Cast(target, true, true);
                                debug("R aoe 1");
                            }
                            else if (cast && target.HasBuff("Recall"))
                            {
                                R.Cast(target, true, true);
                                debug("R recall");
                            }
                        }
                    }
                }
            }
            PotionMenager();
        }
コード例 #10
0
ファイル: PredictionOktw.cs プロジェクト: skules/LeagueRepo
        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;
        }
コード例 #11
0
        private static void FarmWTarget(Obj_AI_Hero target)
        {
            if (!Orbwalking.CanMove(40))
            {
                return;
            }
            if (Config.Item("ManaSliderFarm").GetValue <Slider>().Value >
                ObjectManager.Player.Mana / ObjectManager.Player.MaxMana * 100)
            {
                return;
            }

            List <Obj_AI_Base> rangedMinions = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, Q.Range,
                                                                        MinionTypes.Ranged);
            List <Obj_AI_Base> allMinions = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, Q.Range,
                                                                     MinionTypes.All);

            var useQ            = Config.Item("UseQFarm").GetValue <bool>();
            var useW            = Config.Item("UseWFarm").GetValue <bool>();
            var useE            = Config.Item("UseEFarm").GetValue <bool>();
            var killableMinions = new List <Obj_AI_Base>();

            foreach (Obj_AI_Base minion in allMinions)
            {
                if (!Orbwalking.InAutoAttackRange(minion) &&
                    Vector3.Distance(ObjectManager.Player.ServerPosition, minion.Position) <= Q.Range)
                {
                    PredictionOutput prediction = Q.GetPrediction(minion);
                    double           Qdamage    = ObjectManager.Player.GetSpellDamage(minion, SpellSlot.Q) * 0.85;

                    if (Qdamage >= Q.GetHealthPrediction(minion))
                    {
                        killableMinions.Add(minion);
                    }
                }
            }

            if (useQ && Q.IsReady())
            {
                Tuple <Vector3, int> mecLocation = GetMecqFarmPos();
                Vector3 position      = mecLocation.Item1;
                int     killableCount = mecLocation.Item2;
                if (killableCount >= 2)
                {
                    Q.Cast(position, true);
                }
            }

            if (useW && W.IsReady())
            {
                int minionsHit =
                    allMinions.Count(
                        minion =>
                        Vector3.Distance(BallManager.CurrentBallDrawPosition, minion.ServerPosition) <= W.Width &&
                        W.GetDamage(minion) > minion.Health);
                if (minionsHit >= 2)
                {
                    W.Cast();
                    //ObjectManager.Player.Spellbook.CastSpell(SpellSlot.W);
                }
            }

            if (Q.IsReady() && useQ)
            {
                if (killableMinions.Count == 0 && target != null)
                {
                    PredictionOutput prediction = Q.GetPrediction(target);
                    if (prediction.Hitchance == HitChance.OutOfRange)
                    {
                        Q.Cast(ObjectManager.Player
                               .ServerPosition
                               .To2D()
                               .Extend(prediction.CastPosition.To2D(), Q.Range - 5));
                    }
                    else if (prediction.Hitchance >= HitChance.High)
                    {
                        Q.Cast(prediction.CastPosition);
                    }
                }
                else
                {
                    foreach (Obj_AI_Base minion in killableMinions)
                    {
                        Q.CastOnUnit(minion);
                    }
                }
            }

            if (E.IsReady() && useE)
            {
                List <Obj_AI_Base> collisionList = GetMinionsHitByE();
                foreach (Obj_AI_Base minion in collisionList)
                {
                    double damage = ObjectManager.Player.GetSpellDamage(minion, SpellSlot.E) * 0.88;
                    if (E.IsReady() && damage >= E.GetHealthPrediction(minion))
                    {
                        E.CastOnUnit(ObjectManager.Player);
                    }
                }
            }
        }
コード例 #12
0
        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)
            {
                Program.debug("PRED: LONG CLICK DETECTION");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // RUN IN LANE DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if ( getAngle < angleMove)
            {
                if (distanceUnitToWaypoint > fixRange && UnitTracker.GetLastNewPathTime(input.Unit) < 0.1d)
                {
                    Program.debug(GetAngle(input.From, input.Unit) + " PRED: ANGLE " + angleMove);
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }
                if (ObjectManager.Player.IsMoving)
                {
                    if (ObjectManager.Player.IsFacing(input.Unit))
                    {
                        if (!input.Unit.IsFacing(ObjectManager.Player))
                        {
                            Program.debug(" PRED:TRY CATCH");
                            result.Hitchance = HitChance.VeryHigh;
                            return result;
                        }
                    }
                    else
                    {
                        if (input.Unit.IsFacing(ObjectManager.Player))
                        {
                            Program.debug(" PRED:TRY CATCH 2");
                            result.Hitchance = HitChance.VeryHigh;
                            return result;
                        }
                    }
                }
            }

            // AUTO ATTACK LOGIC ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.GetLastAutoAttackTime(input.Unit) < 0.1d)
            {
                if (input.Type == SkillshotType.SkillshotLine && totalDelay < 0.4 + (input.Radius * 0.002))
                {
                    Program.debug("PRED: AUTO ATTACK DETECTION 1");
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }
                else if (input.Type == SkillshotType.SkillshotCircle && totalDelay < 0.6 + (input.Radius * 0.002))
                {
                    Program.debug("PRED: AUTO ATTACK DETECTION 2");
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }
                else
                {
                    result.Hitchance = HitChance.High;
                    Program.debug("PRED: AUTO ATTACK DETECTION HIGH");
                }
            }

            // STOP LOGIC ///////////////////////////////////////////////////////////////////////////////////

            else if (input.Unit.Path.Count() == 0 || !input.Unit.IsMoving)
            {
                if (input.Unit.IsWindingUp)
                    result.Hitchance = HitChance.High;
                else if (UnitTracker.GetLastStopMoveTime(input.Unit) < 0.5d)
                    result.Hitchance = HitChance.High;
                else
                {
                    Program.debug("PRED: STOP LOGIC");
                    result.Hitchance = HitChance.VeryHigh;
                }
                return result;
            }

            // CIRCLE NEW PATH ///////////////////////////////////////////////////////////////////////////////////

            if (input.Type == SkillshotType.SkillshotCircle)
            {
                if (UnitTracker.GetLastNewPathTime(input.Unit) < 0.1d && distanceUnitToWaypoint > fixRange)
                {
                    Program.debug("PRED: CIRCLE NEW PATH");
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }
            }
            //Program.debug("PRED: NO DETECTION");
            return result;
        }
コード例 #13
0
ファイル: PredictionOktw.cs プロジェクト: Xelamats/PortAIO
        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 ///////////////////////////////////////////////////////////////////////////////////

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

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

            if (distanceFromToUnit < 250)
            {
                OktwCommon.debug("PRED: SPECIAL CASES NEAR");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }
            else if (input.Unit.MoveSpeed < 250)
            {
                OktwCommon.debug("PRED: SPECIAL CASES SLOW");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }
            else if (distanceFromToWaypoint < 250)
            {
                OktwCommon.debug("PRED: SPECIAL CASES ON WAY");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

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

            if (distanceUnitToWaypoint > pathMinLen)
            {
                OktwCommon.debug("PRED: LONG CLICK DETECTION");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // LOW HP DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if (input.Unit.HealthPercent < 20 || ObjectManager.Player.HealthPercent < 20)
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // RUN IN LANE DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if (getAngle < angleMove && UnitTracker.GetLastNewPathTime(input.Unit) < 100)
            {
                OktwCommon.debug(GetAngle(input.From, input.Unit) + " PRED: ANGLE " + angleMove + " DIS " + distanceUnitToWaypoint);
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // CIRCLE NEW PATH ///////////////////////////////////////////////////////////////////////////////////

            if (input.Type == SkillshotType.SkillshotCircle)
            {
                if (UnitTracker.GetLastNewPathTime(input.Unit) < 100 && distanceUnitToWaypoint > fixRange)
                {
                    OktwCommon.debug("PRED: CIRCLE NEW PATH");
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }
            }
            //Program.debug("PRED: NO DETECTION");
            return result;
        }
コード例 #14
0
ファイル: PredictionOktw.cs プロジェクト: yashine59fr/PortAIO
        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)
                {
                    OktwCommon.debug("PRED: AA try");
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }
                if (input.Unit.Spellbook.IsAutoAttacking)
                {
                    result.Hitchance = HitChance.High;
                    return result;
                }
                else if (UnitTracker.GetLastStopMoveTime(input.Unit) < 800)
                {
                    //OktwCommon.debug("PRED: STOP HIGH");
                    result.Hitchance = HitChance.High;
                    return result;
                }
                else
                {
                    OktwCommon.debug("PRED: STOP LOGIC");
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }
            }

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

            if (UnitTracker.SpamSamePlace(input.Unit))
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

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

            if (distanceFromToUnit < 250)
            {
                OktwCommon.debug("PRED: SPECIAL CASES NEAR");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }
            else if (input.Unit.MoveSpeed < 250)
            {
                OktwCommon.debug("PRED: SPECIAL CASES SLOW");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }
            else if (distanceFromToWaypoint < 250)
            {
                OktwCommon.debug("PRED: SPECIAL CASES ON WAY");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // LONG TIME ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.GetLastNewPathTime(input.Unit) > 250)
            {
                OktwCommon.debug("PRED: LONG TIME");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

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

            if (distanceUnitToWaypoint > pathMinLen)
            {
                OktwCommon.debug("PRED: LONG CLICK DETECTION");
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // LOW HP DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if (input.Unit.HealthPercent < 20 || EloBuddy.ObjectManager.Player.HealthPercent < 20)
            {
                result.Hitchance = HitChance.VeryHigh;
                OktwCommon.debug("Low hp");
                return result;
            }

            // CIRCLE NEW PATH ///////////////////////////////////////////////////////////////////////////////////

            if (input.Type == SkillshotType.SkillshotCircle)
            {
                if (UnitTracker.GetLastNewPathTime(input.Unit) < 100 && distanceUnitToWaypoint > fixRange)
                {
                    OktwCommon.debug("PRED: CIRCLE NEW PATH");
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }
            }

            //Program.debug("PRED: NO DETECTION");
            return result;
        }
コード例 #15
0
        void KillSteal()
        {
            AIHeroClient target = HeroList
                                  .Where(x => x.IsValidTarget() && x.Distance(Khazix.Position) < 1375f && !x.IsZombie)
                                  .MinOrDefault(x => x.Health);

            if (target != null && target.IsInRange(600))
            {
                if (getCheckBoxItem(safety, "Safety.autoescape") && !IsHealthy)
                {
                    var ally =
                        HeroList.FirstOrDefault(h => h.HealthPercent > 40 && h.CountEnemiesInRange(400) == 0 && !h.ServerPosition.PointUnderEnemyTurret());
                    if (ally != null && ally.IsValid)
                    {
                        E.Cast(ally.ServerPosition);
                        return;
                    }
                    var objAiturret = EnemyTurretPositions.Where(x => Vector3.Distance(Khazix.ServerPosition, x) <= 900f);
                    if (objAiturret.Any() || Khazix.CountEnemiesInRange(500) >= 1)
                    {
                        var bestposition = Khazix.ServerPosition.LSExtend(NexusPosition, E.Range);
                        E.Cast(bestposition);
                        return;
                    }
                }

                if (getCheckBoxItem(ks, "UseQKs") && Q.IsReady() &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= Q.Range)
                {
                    double QDmg = GetQDamage(target);
                    if (!Jumping && target.Health <= QDmg)
                    {
                        Q.Cast(target);
                        return;
                    }
                }

                if (getCheckBoxItem(ks, "UseEKs") && E.IsReady() && !Jumping &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= E.Range && Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) > Q.Range)
                {
                    double EDmg = Khazix.GetSpellDamage(target, SpellSlot.E);
                    if (!Jumping && target.Health < EDmg)
                    {
                        LeagueSharp.Common.Utility.DelayAction.Add(
                            Game.Ping + getSliderItem(ks, "Edelay"), delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValid && !target.IsDead)
                            {
                                if (getCheckBoxItem(ks, "Ksbypass") || ShouldJump(pred.CastPosition))
                                {
                                    E.Cast(pred.CastPosition);
                                }
                            }
                        });
                    }
                }

                if (W.IsReady() && !EvolvedW && Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range &&
                    getCheckBoxItem(ks, "UseWKs"))
                {
                    double WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    if (target.Health <= WDmg)
                    {
                        var pred = W.GetPrediction(target);
                        if (pred.Hitchance >= HitChance.Medium)
                        {
                            W.Cast(pred.CastPosition);
                            return;
                        }
                    }
                }

                if (W.IsReady() && EvolvedW &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range &&
                    getCheckBoxItem(ks, "UseWKs"))
                {
                    double           WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    PredictionOutput pred = WE.GetPrediction(target);
                    if (target.Health <= WDmg && pred.Hitchance >= HitChance.Medium)
                    {
                        CastWE(target, pred.UnitPosition.To2D(), 0, Config.GetHitChance("WHitchance"));
                        return;
                    }

                    if (pred.Hitchance >= HitChance.Collision)
                    {
                        List <Obj_AI_Base> PCollision = pred.CollisionObjects;
                        var x =
                            PCollision
                            .FirstOrDefault(PredCollisionChar => Vector3.Distance(PredCollisionChar.ServerPosition, target.ServerPosition) <= 30);
                        if (x != null)
                        {
                            W.Cast(x.Position);
                            return;
                        }
                    }
                }


                // Mixed's EQ KS
                if (Q.IsReady() && E.IsReady() &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= E.Range + Q.Range &&
                    getCheckBoxItem(ks, "UseEQKs"))
                {
                    double QDmg = GetQDamage(target);
                    double EDmg = Khazix.GetSpellDamage(target, SpellSlot.E);
                    if ((target.Health <= QDmg + EDmg))
                    {
                        LeagueSharp.Common.Utility.DelayAction.Add(getSliderItem(ks, "Edelay"), delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValidTarget() && !target.IsZombie && ShouldJump(pred.CastPosition))
                            {
                                if (getCheckBoxItem(ks, "Ksbypass") || ShouldJump(pred.CastPosition))
                                {
                                    E.Cast(pred.CastPosition);
                                }
                            }
                        });
                    }
                }

                // MIXED EW KS
                if (W.IsReady() && E.IsReady() && !EvolvedW &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range + E.Range &&
                    getCheckBoxItem(ks, "UseEWKs"))
                {
                    double WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    if (target.Health <= WDmg)
                    {
                        LeagueSharp.Common.Utility.DelayAction.Add(getSliderItem(ks, "Edelay"), delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                            {
                                if (getCheckBoxItem(ks, "Ksbypass") || ShouldJump(pred.CastPosition))
                                {
                                    E.Cast(pred.CastPosition);
                                }
                            }
                        });
                    }
                }

                if (Tiamat.IsReady() &&
                    Vector2.Distance(Khazix.ServerPosition.To2D(), target.ServerPosition.To2D()) <= Tiamat.Range &&
                    getCheckBoxItem(ks, "UseTiamatKs"))
                {
                    double Tiamatdmg = Khazix.GetItemDamage(target, LeagueSharp.Common.Damage.DamageItems.Tiamat);
                    if (target.Health <= Tiamatdmg)
                    {
                        Tiamat.Cast();
                        return;
                    }
                }
                if (Hydra.IsReady() &&
                    Vector2.Distance(Khazix.ServerPosition.To2D(), target.ServerPosition.To2D()) <= Hydra.Range &&
                    getCheckBoxItem(ks, "UseTiamatKs"))
                {
                    double hydradmg = Khazix.GetItemDamage(target, LeagueSharp.Common.Damage.DamageItems.Hydra);
                    if (target.Health <= hydradmg)
                    {
                        Hydra.Cast();
                    }
                }
            }
        }
コード例 #16
0
        public static void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base unit, GameObjectProcessSpellCastEventArgs args)
        {
            double ShouldUse = ShouldUseE(args.SData.Name);

            if (Config.Item("opsE").GetValue <bool>() && unit.Team != ObjectManager.Player.Team && ShouldUse >= 0f && unit.IsValidTarget(E.Range))
            {
                E.Cast(unit.ServerPosition, true);
                debug("E ope");
            }
            if (unit.IsMe && args.SData.Name == "JinxW")
            {
                WCastTime = Game.Time;
            }

            foreach (var target in ObjectManager.Get <Obj_AI_Hero>())
            {
                if (args.Target.NetworkId == target.NetworkId && args.Target.IsEnemy)
                {
                    var    dmg    = unit.GetSpellDamage(target, args.SData.Name);
                    double HpLeft = target.Health - dmg;
                    if (HpLeft < 0 && target.IsValidTarget())
                    {
                        QCastTime = Game.Time;
                    }
                    if (!Orbwalking.InAutoAttackRange(target) && target.IsValidTarget(W.Range) && W.IsReady())
                    {
                        var wDmg = W.GetDamage(target);
                        if (wDmg > HpLeft && HpLeft > 0)
                        {
                            W.Cast(target, true);
                            WCastTime = Game.Time;
                            debug("W ks OPS");
                        }
                    }
                    if (GetRealDistance(target) > bonusRange() + 200 + target.BoundingRadius && target.IsValidTarget(R.Range) && R.IsReady() && ObjectManager.Player.CountEnemiesInRange(400) == 0)
                    {
                        var rDmg = R.GetDamage(target);
                        var cast = true;

                        PredictionOutput output    = R.GetPrediction(target);
                        Vector2          direction = output.CastPosition.To2D() - Player.Position.To2D();
                        direction.Normalize();
                        List <Obj_AI_Hero> enemies = ObjectManager.Get <Obj_AI_Hero>().Where(x => x.IsEnemy && x.IsValidTarget()).ToList();
                        foreach (var enemy in enemies)
                        {
                            if (enemy.SkinName == target.SkinName || !cast)
                            {
                                continue;
                            }
                            PredictionOutput prediction        = R.GetPrediction(enemy);
                            Vector3          predictedPosition = prediction.CastPosition;
                            Vector3          v      = output.CastPosition - Player.ServerPosition;
                            Vector3          w      = predictedPosition - Player.ServerPosition;
                            double           c1     = Vector3.Dot(w, v);
                            double           c2     = Vector3.Dot(v, v);
                            double           b      = c1 / c2;
                            Vector3          pb     = Player.ServerPosition + ((float)b * v);
                            float            length = Vector3.Distance(predictedPosition, pb);
                            if (length < (R.Width + 100 + enemy.BoundingRadius / 2) && Player.Distance(predictedPosition) < Player.Distance(target.ServerPosition))
                            {
                                cast = false;
                            }
                        }
                        if (rDmg > HpLeft && HpLeft > 0 && cast && target.CountAlliesInRange(500) == 0)
                        {
                            R.Cast(target, true);
                            debug("R OPS");
                        }
                    }
                }
            }
        }
コード例 #17
0
        public static void castE(Obj_AI_Base target)
        {
            if (IsBallMoving)
            {
                return;
            }

            Obj_AI_Hero etarget = Player;

            switch (ballStatus)
            {
            case 0:
                if (target != null)
                {
                    float TravelTime    = target.Distance(Player.ServerPosition) / Q.Speed;
                    float MinTravelTime = 10000f;

                    foreach (
                        Obj_AI_Hero ally in
                        ObjectManager.Get <Obj_AI_Hero>()
                        .Where(x => x.IsAlly && Player.Distance(x.ServerPosition) <= E.Range && !x.IsMe))
                    {
                        if (ally != null)
                        {
                            //dmg enemy with E
                            if (menu.Item("UseEDmg").GetValue <bool>())
                            {
                                PredictionOutput prediction3 = GetP(Player.ServerPosition, E, target, true);
                                Object[]         obj         = VectorPointProjectionOnLineSegment(Player.ServerPosition.To2D(),
                                                                                                  ally.ServerPosition.To2D(), prediction3.UnitPosition.To2D());
                                var isOnseg   = (bool)obj[2];
                                var PointLine = (Vector2)obj[1];

                                if (E.IsReady() && isOnseg &&
                                    prediction3.UnitPosition.Distance(PointLine.To3D()) < E.Width)
                                {
                                    //Game.PrintChat("Dmg 1");
                                    E.CastOnUnit(ally, packets());
                                    return;
                                }
                            }

                            float allyRange = target.Distance(ally.ServerPosition) / Q.Speed +
                                              ally.Distance(Player.ServerPosition) / E.Speed;
                            if (allyRange < MinTravelTime)
                            {
                                etarget       = ally;
                                MinTravelTime = allyRange;
                            }
                        }
                    }

                    if (MinTravelTime < TravelTime && Player.Distance(etarget.ServerPosition) <= E.Range &&
                        E.IsReady())
                    {
                        E.CastOnUnit(etarget, packets());
                    }
                }
                break;

            case 1:
                //dmg enemy with E
                if (menu.Item("UseEDmg").GetValue <bool>())
                {
                    PredictionOutput prediction = GetP(CurrentBallPosition, E, target, true);
                    Object[]         obj        = VectorPointProjectionOnLineSegment(CurrentBallPosition.To2D(),
                                                                                     Player.ServerPosition.To2D(), prediction.UnitPosition.To2D());
                    var isOnseg   = (bool)obj[2];
                    var PointLine = (Vector2)obj[1];

                    if (E.IsReady() && isOnseg && prediction.UnitPosition.Distance(PointLine.To3D()) < E.Width)
                    {
                        //Game.PrintChat("Dmg 2");
                        E.CastOnUnit(Player, packets());
                        return;
                    }
                }

                float TravelTime2    = target.Distance(CurrentBallPosition) / Q.Speed;
                float MinTravelTime2 = target.Distance(Player.ServerPosition) / Q.Speed +
                                       Player.Distance(CurrentBallPosition) / E.Speed;

                if (MinTravelTime2 < TravelTime2 && target.Distance(Player.ServerPosition) <= Q.Range + Q.Width &&
                    E.IsReady())
                {
                    E.CastOnUnit(Player, packets());
                }

                break;

            case 2:
                float TravelTime3    = target.Distance(CurrentBallPosition) / Q.Speed;
                float MinTravelTime3 = 10000f;

                foreach (
                    Obj_AI_Hero ally in
                    ObjectManager.Get <Obj_AI_Hero>()
                    .Where(x => x.IsAlly && Player.Distance(x.ServerPosition) <= E.Range && !x.IsMe))
                {
                    if (ally != null)
                    {
                        //dmg enemy with E
                        if (menu.Item("UseEDmg").GetValue <bool>())
                        {
                            PredictionOutput prediction2 = GetP(CurrentBallPosition, E, target, true);
                            Object[]         obj         = VectorPointProjectionOnLineSegment(CurrentBallPosition.To2D(),
                                                                                              ally.ServerPosition.To2D(), prediction2.UnitPosition.To2D());
                            var isOnseg   = (bool)obj[2];
                            var PointLine = (Vector2)obj[1];

                            if (E.IsReady() && isOnseg &&
                                prediction2.UnitPosition.Distance(PointLine.To3D()) < E.Width)
                            {
                                //Game.PrintChat("Dmg 3");
                                E.CastOnUnit(ally, packets());
                                return;
                            }
                        }

                        float allyRange2 = target.Distance(ally.ServerPosition) / Q.Speed +
                                           ally.Distance(CurrentBallPosition) / E.Speed;

                        if (allyRange2 < MinTravelTime3)
                        {
                            etarget        = ally;
                            MinTravelTime3 = allyRange2;
                        }
                    }
                }

                if (MinTravelTime3 < TravelTime3 && Player.Distance(etarget.ServerPosition) <= E.Range &&
                    E.IsReady())
                {
                    E.CastOnUnit(etarget, packets());
                }

                break;
            }
        }
コード例 #18
0
        private static void UseSpells(bool useQ, bool useW, bool useE, bool useR, string Source)
        {
            var         range         = E.IsReady() ? E.Range : Q.Range;
            var         focusSelected = menu.Item("selected").GetValue <bool>();
            Obj_AI_Hero target        = SimpleTs.GetTarget(range, SimpleTs.DamageType.Magical);

            if (SimpleTs.GetSelectedTarget() != null)
            {
                if (focusSelected && SimpleTs.GetSelectedTarget().Distance(Player.ServerPosition) < range)
                {
                    target = SimpleTs.GetSelectedTarget();
                }
            }

            int IgniteMode = menu.Item("igniteMode").GetValue <StringList>().SelectedIndex;
            int dfgMode    = menu.Item("dfgMode").GetValue <StringList>().SelectedIndex;

            bool hasMana = manaCheck();

            float dmg   = GetComboDamage(target);
            bool  waitW = menu.Item("waitW").GetValue <bool>();

            if (Source == "Harass")
            {
                int   mana        = menu.Item("mana").GetValue <Slider>().Value;
                float manaPercent = Player.Mana / Player.MaxMana * 100;

                if (manaPercent < mana)
                {
                    return;
                }
            }

            if (useE && target != null && E.IsReady() && Player.Distance(target) < E.Range)
            {
                if (!waitW || W.IsReady())
                {
                    castE(target);
                    return;
                }
            }

            if (useW && target != null && Player.Distance(target) <= W.Range)
            {
                if (menu.Item("wPoke").GetValue <KeyBind>().Active)
                {
                    var pred = W.GetPrediction(target);
                    if (pred.Hitchance == HitChance.Immobile && W.IsReady())
                    {
                        W.Cast(target.ServerPosition, Packets());
                    }
                }
                else if (W.IsReady())
                {
                    PredictionOutput pred = Prediction.GetPrediction(target, 1.25f);
                    if (pred.Hitchance >= HitChance.High && W.IsReady())
                    {
                        W.Cast(pred.CastPosition, Packets());
                    }
                }
            }

            //dfg
            if (target != null && Dfg.IsReady() && menu.Item("dfg").GetValue <bool>() && dfgMode == 0 &&
                GetComboDamage(target) > target.Health + 30 && Source == "Combo" && hasMana)
            {
                if ((menu.Item("DontDFG" + target.BaseSkinName) != null &&
                     menu.Item("DontDFG" + target.BaseSkinName).GetValue <bool>() == false))
                {
                    Dfg.Cast(target);
                }
            }

            //Ignite
            if (target != null && menu.Item("ignite").GetValue <bool>() && IgniteSlot != SpellSlot.Unknown &&
                Player.SummonerSpellbook.CanUseSpell(IgniteSlot) == SpellState.Ready && Source == "Combo" && hasMana)
            {
                if (IgniteMode == 0 && dmg > target.Health)
                {
                    Player.SummonerSpellbook.CastSpell(IgniteSlot, target);
                }
            }

            //Q
            if (useQ && Q.IsReady() && Player.Distance(target) <= Q.Range && target != null)
            {
                Q.CastOnUnit(target, Packets());
            }

            //R
            if (target != null && R.IsReady())
            {
                useR = rTarget(target) && useR;
                if (useR)
                {
                    castR(target, dmg);
                }
            }
        }
コード例 #19
0
        public static void doJayceInj(Obj_AI_Hero target)
        {
            if (lockedTarg != null)
            {
                target = lockedTarg;
            }
            else
            {
                lockedTarg = target;
            }


            if (isHammer)
            {
                castIgnite(target);

                if (/*inMyTowerRange(posAfterHammer(target)) &&*/ E2.IsReady())
                {
                    E2.Cast(target);
                }

                //If not in flash range  Q to get in it
                if (Player.Distance(target) > 400 && targetInRange(target, 600f))
                {
                    Q2.Cast(target);
                }

                if (!E2.IsReady() && !Q2.IsReady())
                {
                    R2.Cast();
                }
                Obj_AI_Base tower = ObjectManager.Get <Obj_AI_Turret>().Where(tur => tur.IsAlly && tur.Health > 0).OrderBy(tur => Player.Distance(tur)).First();
                if (Player.Distance(getBestPosToHammer(target.ServerPosition)) < 400 && tower.Distance(target) < 1500)
                {
                    Player.Spellbook.CastSpell(Player.GetSpellSlot("SummonerFlash"), getBestPosToHammer(target.ServerPosition));
                }
                Player.IssueOrder(GameObjectOrder.AttackUnit, target);
            }
            else
            {
                if (E1.IsReady() && Q1.IsReady() && gotManaFor(true, false, true))
                {
                    PredictionOutput po = QEmp1.GetPrediction(target);
                    var dist            = Player.Distance(po.UnitPosition);
                    if (dist <= E1.Range && getJayceEQDmg(target) < target.Health)
                    {
                        // if (JayceSharp.Config.Item("useExploit").GetValue<bool>())
                        //     doExploit(target);
                        // else
                        if (shootQE(po.CastPosition, dist > 550))
                        {
                            castedQon = target;
                        }
                    }
                    else
                    {
                        if (po.Hitchance >= HitChance.Medium && Player.Distance(po.UnitPosition) < (QEmp1.Range + target.BoundingRadius))
                        {
                            castQon   = po.CastPosition;
                            castedQon = target;
                        }
                    }

                    // QEmp1.CastIfHitchanceEquals(target, Prediction.HitChance.HighHitchance);
                }
                else if (Q1.IsReady() && gotManaFor(true) && !E1.IsReady(1000))
                {
                    if (Q1.Cast(target.Position))
                    {
                        castedQon = target;
                    }
                }
                else if (W1.IsReady() && gotManaFor(false, true) && targetInRange(getClosestEnem(), 1000f))
                {
                    W1.Cast();
                }
            }
        }
コード例 #20
0
        internal static PredictionOutput WayPointAnalysis(PredictionOutput result, PredictionInput input)
        {
            if (!input.Unit.IsValid<Obj_AI_Hero>())
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            if (UnitTracker.GetSpecialSpellEndTime(input.Unit) > 0 )
            {

                result.Hitchance = HitChance.VeryHigh;
                return result;

            }
            result.Hitchance = HitChance.High;

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

            float speedDelay = distanceFromToUnit / input.Speed;

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

            float totalDelay = speedDelay + input.Delay;
            float moveArea = input.Unit.MoveSpeed * totalDelay;
            float fixRange = moveArea * 0.6f;
            double angleMove = 30 + (input.Radius / 10) - (input.Delay * 5);
            float backToFront = moveArea * 1.5f;
            float pathMinLen = 700f + backToFront;

            if (UnitTracker.PathCalc(input.Unit))
            {

                if (distanceFromToUnit < input.Range - fixRange)
                {
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }

                result.Hitchance = HitChance.High;
                return result;
            }

            if (UnitTracker.GetLastNewPathTime(input.Unit) < 0.1d)
            {
                fixRange = moveArea * (0.2f + input.Delay);
                backToFront = moveArea;
            }

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

            if (distanceUnitToWaypoint > pathMinLen)
            {
                result.Hitchance = HitChance.VeryHigh;
            }
            else if (input.Type == SkillshotType.SkillshotLine)
            {
                if (input.Unit.Path.Count() > 0)
                {
                    if (GetAngle(input.From, input.Unit) < angleMove)
                    {
                        result.Hitchance = HitChance.VeryHigh;
                    }
                    else if (UnitTracker.GetLastNewPathTime(input.Unit) > 0.1d)
                        result.Hitchance = HitChance.High;
                }
            }

            if (input.Unit.Path.Count() == 0 && input.Unit.Position == input.Unit.ServerPosition)
            {
                if (UnitTracker.GetLastStopMoveTime(input.Unit) < 0.5d)
                    result.Hitchance = HitChance.High;
                else if (distanceFromToUnit > input.Range - fixRange)
                    result.Hitchance = HitChance.Medium;
                else
                    result.Hitchance = HitChance.VeryHigh;
            }
            else if (distanceFromToWaypoint <= input.Unit.Distance(input.From))
            {
                if (distanceFromToUnit > input.Range - fixRange)
                    result.Hitchance = HitChance.Medium;
            }

            if (UnitTracker.GetLastAutoAttackTime(input.Unit) < 0.1d)
            {
                if (input.Type == SkillshotType.SkillshotLine && totalDelay < 0.8 + (input.Radius * 0.001))
                    result.Hitchance = HitChance.VeryHigh;
                else if (input.Type == SkillshotType.SkillshotCircle && totalDelay < 0.6 + (input.Radius * 0.001))
                    result.Hitchance = HitChance.VeryHigh;
                else
                    result.Hitchance = HitChance.Medium;
            }

            if (input.Type == SkillshotType.SkillshotCircle)
            {
                if (UnitTracker.GetLastNewPathTime(input.Unit) < 0.1d)
                    result.Hitchance = HitChance.VeryHigh;
                else if (distanceFromToUnit < input.Range - fixRange)
                    result.Hitchance = HitChance.VeryHigh;
            }

            if (result.Hitchance != HitChance.Medium)
            {
                if (input.Unit.IsWindingUp && UnitTracker.GetLastAutoAttackTime(input.Unit) > 0.1d)
                    result.Hitchance = HitChance.Medium;
                else if (input.Unit.Path.Count() == 0 && input.Unit.Position != input.Unit.ServerPosition)
                    result.Hitchance = HitChance.Medium;
                else if (input.Unit.Path.Count() > 0 && distanceUnitToWaypoint < backToFront)
                {
                    result.Hitchance = HitChance.Medium;
                }
                else if (input.Unit.Path.Count() > 1)
                    result.Hitchance = HitChance.Medium;
                else

                if (UnitTracker.GetLastVisableTime(input.Unit) < 0.05d)
                {
                    result.Hitchance = HitChance.Medium;
                }
            }
            if (distanceFromToWaypoint > input.Unit.Distance(input.From) && GetAngle(input.From, input.Unit) > angleMove)
                result.Hitchance = HitChance.VeryHigh;

            if (input.Unit.Distance(input.From) < 400 || distanceFromToWaypoint < 300 || input.Unit.MoveSpeed < 200f)
                result.Hitchance = HitChance.VeryHigh;

            return result;
        }
コード例 #21
0
        private static void Game_OnGameUpdate(EventArgs args)
        {
            ManaMenager();
            if (Orbwalker.ActiveMode.ToString() == "Mixed" || Orbwalker.ActiveMode.ToString() == "LaneClear" || Orbwalker.ActiveMode.ToString() == "LastHit")
            {
                Farm = true;
            }
            else
            {
                Farm = false;
            }

            if (ObjectManager.Player.Mana > RMANA + WMANA && W.IsReady())
            {
                foreach (var Object in ObjectManager.Get <Obj_AI_Base>().Where(Obj => Obj.Distance(Player.ServerPosition) < W.Range && Obj.Team != Player.Team && Obj.HasBuff("teleport_target", true)))
                {
                    W.Cast(Object.Position, true);
                    debug("W telport");
                }
            }

            if (E.IsReady())
            {
                ManaMenager();
                var t = TargetSelector.GetTarget(E.Range - 100, TargetSelector.DamageType.Physical);

                var t2 = TargetSelector.GetTarget(1100, TargetSelector.DamageType.Physical);
                if (t.IsValidTarget() && Config.Item("autoE").GetValue <bool>())
                {
                    var    eDmg            = E.GetDamage(t);
                    float  predictedHealth = HealthPrediction.GetHealthPrediction(t, (int)(R.Delay + (Player.Distance(t.ServerPosition) / Q.Speed) * 1000));
                    double Qdmg            = Q.GetDamage(t);
                    if (Qdmg > predictedHealth)
                    {
                        Qdmg = getQdmg(t);
                    }
                    if (Qdmg + eDmg > t.Health &&
                        Qdmg < t.Health && ObjectManager.Player.Mana > EMANA + QMANA && Q.IsReady() &&
                        t.Position.Distance(ObjectManager.Player.ServerPosition) > t.Position.Distance(ObjectManager.Player.Position) &&
                        ObjectManager.Player.Position.Distance(t.ServerPosition) < ObjectManager.Player.Position.Distance(t.Position))

                    {
                        E.Cast(t, true);
                        debug("E + Q combo");
                    }
                    else if (
                        ObjectManager.Player.Mana > RMANA + EMANA &&
                        ObjectManager.Player.CountEnemiesInRange(200) > 0 &&
                        ObjectManager.Player.Position.Extend(Game.CursorPos, 400).CountEnemiesInRange(500) < 3 &&
                        t2.Position.Distance(Game.CursorPos) > t2.Position.Distance(ObjectManager.Player.Position))
                    {
                        var position = ObjectManager.Player.ServerPosition - (Game.CursorPos - ObjectManager.Player.ServerPosition);
                        E.Cast(position, true);
                        debug("E mele escape");
                    }

                    else if (ObjectManager.Player.Mana > RMANA + EMANA && GetRealDistance(t) < 500 && ObjectManager.Player.Health < ObjectManager.Player.MaxHealth * 0.3)
                    {
                        E.Cast(t, true);
                    }
                }
                if (Config.Item("useE").GetValue <KeyBind>().Active)
                {
                    var position = ObjectManager.Player.ServerPosition - (Game.CursorPos - ObjectManager.Player.ServerPosition);
                    E.Cast(position, true);
                }
            }

            if (Q.IsReady())
            {
                ManaMenager();
                var t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);
                if (t.IsValidTarget())
                {
                    float  predictedHealth = HealthPrediction.GetHealthPrediction(t, (int)(R.Delay + (Player.Distance(t.ServerPosition) / Q.Speed) * 1000));
                    double Qdmg            = Q.GetDamage(t);
                    if (Qdmg > predictedHealth)
                    {
                        Qdmg = getQdmg(t);
                    }
                    if (GetRealDistance(t) > bonusRange() + 150 && Qdmg > predictedHealth && ObjectManager.Player.CountEnemiesInRange(400) == 0)
                    {
                        Q.Cast(t, true);
                        debug("Q KS");
                    }
                    else if (Orbwalker.ActiveMode.ToString() == "Combo" && ObjectManager.Player.Mana > RMANA + QMANA + EMANA + 10 && ObjectManager.Player.CountEnemiesInRange(bonusRange() + 100 + t.BoundingRadius) == 0 && !Config.Item("autoQ").GetValue <bool>())
                    {
                        castQ(t);
                        debug("Q combo");
                    }
                    if (Q.IsReady() && (Orbwalker.ActiveMode.ToString() == "Combo" || Farm) && ObjectManager.Player.Mana > RMANA + QMANA && ObjectManager.Player.CountEnemiesInRange(bonusRange()) == 0 && ObjectManager.Player.CountEnemiesInRange(bonusRange() + 60) == 0)
                    {
                        foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(Q.Range)))
                        {
                            if (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) ||
                                enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) ||
                                enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuffOfType(BuffType.Slow) || enemy.HasBuff("Recall"))
                            {
                                Q.CastIfHitchanceEquals(enemy, HitChance.High, true);
                                debug("Q cc");
                            }
                        }
                    }
                    if (Q.IsReady() && Orbwalker.ActiveMode.ToString() == "Combo" && ObjectManager.Player.Mana > RMANA + QMANA + EMANA && ObjectManager.Player.CountEnemiesInRange(bonusRange() + 100) == 0)
                    {
                        Q.CastIfWillHit(t, 2, true);
                    }
                    if (Q.IsReady() && Farm && ObjectManager.Player.Mana > RMANA + EMANA + WMANA + QMANA && ObjectManager.Player.CountEnemiesInRange(bonusRange() + 100) == 0)
                    {
                        debug("Q farm");
                        Q.CastIfWillHit(t, 2, true);
                        if (ObjectManager.Player.Mana > ObjectManager.Player.MaxMana * 0.9)
                        {
                            castQ(t);
                        }
                        else if (t.Path.Count() == 1)
                        {
                            if (Q.IsReady() && ObjectManager.Player.Mana > RMANA + EMANA + WMANA + QMANA + QMANA)
                            {
                                Qc.CastIfHitchanceEquals(t, HitChance.VeryHigh, true);
                            }
                        }
                    }
                }
            }

            if (R.IsReady() && Config.Item("autoR").GetValue <bool>() && !ObjectManager.Player.UnderTurret(true))
            {
                bool cast = false;
                foreach (var target in ObjectManager.Get <Obj_AI_Hero>().Where(target => target.IsValidTarget(500 * R.Level + 1500)))
                {
                    if (target.IsValidTarget() && (Game.Time - WCastTime > 1) &&
                        !target.HasBuffOfType(BuffType.PhysicalImmunity) && !target.HasBuffOfType(BuffType.SpellImmunity) && !target.HasBuffOfType(BuffType.SpellShield))
                    {
                        float predictedHealth = HealthPrediction.GetHealthPrediction(target, (int)(R.Delay + (Player.Distance(target.ServerPosition) / R.Speed) * 1000));
                        var   Rdmg            = R.GetDamage(target);
                        if (Rdmg > predictedHealth && GetRealDistance(target) > bonusRange() + 400 + target.BoundingRadius && target.CountAlliesInRange(500) == 0 && Orbwalker.GetTarget() == null)
                        {
                            cast = true;
                            PredictionOutput output    = R.GetPrediction(target);
                            Vector2          direction = output.CastPosition.To2D() - Player.Position.To2D();
                            direction.Normalize();
                            List <Obj_AI_Hero> enemies = ObjectManager.Get <Obj_AI_Hero>().Where(x => x.IsEnemy && x.IsValidTarget()).ToList();
                            foreach (var enemy in enemies)
                            {
                                if (enemy.SkinName == target.SkinName || !cast)
                                {
                                    continue;
                                }
                                PredictionOutput prediction        = R.GetPrediction(enemy);
                                Vector3          predictedPosition = prediction.CastPosition;
                                Vector3          v      = output.CastPosition - Player.ServerPosition;
                                Vector3          w      = predictedPosition - Player.ServerPosition;
                                double           c1     = Vector3.Dot(w, v);
                                double           c2     = Vector3.Dot(v, v);
                                double           b      = c1 / c2;
                                Vector3          pb     = Player.ServerPosition + ((float)b * v);
                                float            length = Vector3.Distance(predictedPosition, pb);
                                if (length < (400 + enemy.BoundingRadius) && Player.Distance(predictedPosition) < Player.Distance(target.ServerPosition))
                                {
                                    cast = false;
                                }
                            }
                            if (cast && target.IsValidTarget() && target.CountEnemiesInRange(500) == 1)
                            {
                                R.Cast(target, true);
                            }
                        }
                    }
                }
            }
            PotionMenager();
        }
コード例 #22
0
        private static void CastWE(Obj_AI_Base unit, Vector2 unitPosition, int minTargets = 0)
        {
            var usePacket = Config.Item("usePackets").GetValue <bool>();
            var points    = new List <Vector2>();
            var hitBoxes  = new List <int>();

            Vector2 startPoint        = ObjectManager.Player.ServerPosition.To2D();
            Vector2 originalDirection = W.Range * (unitPosition - startPoint).Normalized();

            foreach (Obj_AI_Hero enemy in ObjectManager.Get <Obj_AI_Hero>())
            {
                if (enemy.IsValidTarget() && enemy.NetworkId != unit.NetworkId)
                {
                    PredictionOutput pos = W.GetPrediction(enemy);
                    if (pos.Hitchance >= HitChance.Medium)
                    {
                        points.Add(pos.UnitPosition.To2D());
                        hitBoxes.Add((int)enemy.BoundingRadius);
                    }
                }
            }


            var posiblePositions = new List <Vector2>();

            for (int i = 0; i < 3; i++)
            {
                if (i == 0)
                {
                    posiblePositions.Add(unitPosition + originalDirection.Rotated(0));
                }
                if (i == 1)
                {
                    posiblePositions.Add(startPoint + originalDirection.Rotated(Wangle));
                }
                if (i == 2)
                {
                    posiblePositions.Add(startPoint + originalDirection.Rotated(-Wangle));
                }
            }


            if (startPoint.Distance(unitPosition) < 900)
            {
                for (int i = 0; i < 3; i++)
                {
                    Vector2 pos       = posiblePositions[i];
                    Vector2 direction = (pos - startPoint).Normalized().Perpendicular();
                    float   k         = (2 / 3 * (unit.BoundingRadius + Q.Width));
                    posiblePositions.Add(startPoint - k * direction);
                    posiblePositions.Add(startPoint + k * direction);
                }
            }

            var bestPosition = new Vector2();
            int bestHit      = -1;

            foreach (Vector2 position in posiblePositions)
            {
                int hits = CountHits(position, points, hitBoxes);
                if (hits > bestHit)
                {
                    bestPosition = position;
                    bestHit      = hits;
                }
            }

            if (bestHit + 1 <= minTargets)
            {
                return;
            }

            W.Cast(bestPosition.To3D(), usePacket);
        }
コード例 #23
0
ファイル: PredictionOktw.cs プロジェクト: rio4948/LeagueRepo
        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;
        }
コード例 #24
0
        private static void KillSteal()
        {
            Obj_AI_Hero target = ObjectManager.Get <Obj_AI_Hero>()
                                 .Where(x => x.IsValidTarget() && x.Distance(Player.Position) < 1000f)
                                 .OrderBy(x => x.Health).FirstOrDefault();
            var usePacket = Config.Item("usePackets").GetValue <bool>();



            if (target != null && !target.IsInvulnerable && !target.IsDead && !target.IsZombie)
            {
                double igniteDmg = Player.GetSummonerSpellDamage(target, Damage.SummonerSpell.Ignite);
                double QDmg      = getdamages(SpellSlot.Q, target);
                double WDmg      = Player.GetSpellDamage(target, SpellSlot.W);
                double EDmg      = Player.GetSpellDamage(target, SpellSlot.E);
                double hydradmg  = Player.GetItemDamage(target, Damage.DamageItems.Hydra);
                double tiamatdmg = Player.GetItemDamage(target, Damage.DamageItems.Tiamat);
                if (Config.Item("UseIgnite").GetValue <bool>() && IgniteSlot != SpellSlot.Unknown &&
                    Player.Spellbook.CanUseSpell(IgniteSlot) == SpellState.Ready)
                {
                    if (igniteDmg > target.Health)
                    {
                        Player.Spellbook.CastSpell(IgniteSlot, target);
                    }
                }

                if (!ishealthy() && Config.Item("autoescape").GetValue <bool>() && Player.CountEnemiesInRange(300) >= 1)
                {
                    var objAiHero = ObjectManager.Get <Obj_AI_Hero>().FirstOrDefault(x => x.IsAlly && x.CountEnemiesInRange(300) == 0 && x.HealthPercentage() > 45 && E.IsInRange(x));
                    if (objAiHero != null)
                    {
                        var bestposition =
                            objAiHero.ServerPosition;
                        E.Cast(bestposition, usePacket);
                    }
                }
                if (Q.IsReady() && Player.Distance(target) <= Q.Range && Config.Item("UseQKs").GetValue <bool>())
                {
                    if (target.Health <= QDmg)
                    {
                        Orbwalker.SetAttack(false);
                        Q.Cast(target, usePacket);
                        Orbwalker.SetAttack(true);
                    }
                }

                if (E.IsReady() && Player.Distance(target) <= E.Range && Config.Item("UseEKs").GetValue <bool>())
                {
                    if (target.Health <= EDmg)
                    {
                        Utility.DelayAction.Add(
                            Game.Ping + Config.Item("EDelay").GetValue <Slider>().Value, delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValid && !target.IsDead)
                            {
                                E.Cast(pred.CastPosition, usePacket);
                            }
                        });
                    }
                }

                if (W.IsReady() && Wnorm && Player.Distance(target) <= W.Range && Config.Item("UseWKs").GetValue <bool>())
                {
                    if (target.Health <= WDmg)
                    {
                        if (W.GetPrediction(target).Hitchance >= HitChance.Medium)
                        {
                            PredictionOutput pred = W.GetPrediction(target);
                            W.Cast(pred.CastPosition);
                        }
                    }
                    if (W.IsReady() && Wevolved && Player.Distance(target) <= W.Range &&
                        Config.Item("UseWKs").GetValue <bool>())
                    {
                        if (target.Health <= WDmg)
                        {
                            PredictionOutput pred = W.GetPrediction(target);
                            CastWE(target, pred.UnitPosition.To2D());
                        }

                        if (W.GetPrediction(target).Hitchance >= HitChance.Collision)
                        {
                            List <Obj_AI_Base> PCollision = W.GetPrediction(target).CollisionObjects;
                            foreach (Obj_AI_Base PredCollisionChar in
                                     PCollision.Where(PredCollisionChar => PredCollisionChar.Distance(target) <= 30))
                            {
                                W.Cast(PredCollisionChar.Position, Config.Item("usePackets").GetValue <bool>());
                            }
                        }
                    }
                }

                // Mixed's EQ KS
                if (Q.IsReady() && E.IsReady() && Player.Distance(target) <= E.Range + Q.Range &&
                    Config.Item("UseEQKs").GetValue <bool>())
                {
                    if ((target.Health <= QDmg + EDmg))
                    {
                        Utility.DelayAction.Add(Game.Ping + 200, delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValid && !target.IsDead)
                            {
                                E.Cast(pred.CastPosition);
                            }
                        });
                    }
                }

                // MIXED EW KS
                if (W.IsReady() && E.IsReady() && Wnorm && Player.Distance(target) <= W.Range + E.Range &&
                    Config.Item("UseEWKs").GetValue <bool>())
                {
                    if (target.Health <= WDmg)
                    {
                        Utility.DelayAction.Add(Game.Ping + 200, delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValid && !target.IsDead)
                            {
                                E.Cast(pred.CastPosition);
                            }
                        });
                    }
                }


                if (TIA.IsReady() && Player.Distance(target) <= TIA.Range &&
                    Config.Item("UseTiaKs").GetValue <bool>())
                {
                    if (target.Health <= tiamatdmg)
                    {
                        TIA.Cast();
                    }
                }
                if (HDR.IsReady() && Player.Distance(target) <= HDR.Range &&
                    Config.Item("UseTiaKs").GetValue <bool>())
                {
                    if (target.Health <= hydradmg)
                    {
                        HDR.Cast();
                    }
                }
            }
        }
コード例 #25
0
        private static void Combo()
        {
            if (HasPassive && Config.CheckPassive)
            {
                return;
            }
            ItemManager.UseOffensiveItems();
            if (Config.ComboQ && SpellManager.Q.IsReady())
            {
                var target = TargetSelector.GetTarget(SpellManager.Q.Range, TargetSelector.DamageType.Physical);
                if (target != null)
                {
                    SpellManager.CastSpell(SpellManager.Q, target, Config.UsePackets);
                    if (Config.CheckPassive)
                    {
                        return;
                    }
                }
                target = TargetSelector.GetTarget(SpellManager.Q2.Range, TargetSelector.DamageType.Physical);
                var collisions = SpellManager.Q2.GetCollision(Player.ServerPosition.To2D(), new List <Vector2>()
                {
                    target.ServerPosition.To2D()
                });
                foreach (Obj_AI_Base collision in collisions)
                {
                    SpellManager.CastSpell(SpellManager.Q, collision, Config.UsePackets);
                }
            }
            if (Config.ComboW && SpellManager.W.IsReady())
            {
                var target = TargetSelector.GetTarget(SpellManager.W.Range, TargetSelector.DamageType.Physical);
                if (target != null)
                {
                    PredictionOutput prediction = SpellManager.W.GetPrediction(target);
                    switch (prediction.Hitchance)
                    {
                    case HitChance.High:
                    case HitChance.VeryHigh:
                        SpellManager.CastSpell(SpellManager.W, target, Config.UsePackets);
                        if (Config.CheckPassive)
                        {
                            return;
                        }
                        break;

                    case HitChance.Collision:
                        var collisions = prediction.CollisionObjects.Where(collision => collision.Distance(target) <= SpellManager.W.Width).ToList();
                        if (collisions.Count > 0)
                        {
                            SpellManager.CastSpell(SpellManager.W, collisions[0], Config.UsePackets);
                            if (Config.CheckPassive)
                            {
                                return;
                            }
                        }
                        break;
                    }
                }
            }
            if (Config.ComboE && SpellManager.E.IsReady())
            {
                float range  = Player.AttackRange + SpellManager.E.Range;
                var   target = TargetSelector.GetTarget(range, TargetSelector.DamageType.Physical);
                if (target != null && target.IsValidTarget(range))
                {
                    if (Config.EIntoTurret || (!Config.EIntoTurret && !target.UnderTurret(true)))
                    {
                        SpellManager.CastSpell(SpellManager.E, Game.CursorPos, Config.UsePackets);
                        if (Config.CheckPassive)
                        {
                            return;
                        }
                    }
                }
            }

            if (Config.ComboR && SpellManager.R.IsReady())
            {
                var target = TargetSelector.GetTarget(SpellManager.R.Range, TargetSelector.DamageType.Physical);
                if (target != null)
                {
                    if (target.Health <= DamageCalc.GetUltDamage(target))
                    {
                        SpellManager.CastSpell(SpellManager.R, target, HitChance.High, Config.UsePackets);
                        if (Config.CheckPassive)
                        {
                            return;
                        }
                    }
                }
            }
        }
コード例 #26
0
        private static void Combo()
        {
            if (Player.IsDead)
            {
                return;
            }
            var         usePacket    = Config.Item("usePackets").GetValue <bool>();
            var         isolatedlist = GetIsolatedTargets();
            HitChance   hitchance    = HarassHitChance();
            Obj_AI_Hero target       = new Obj_AI_Hero();

            if (isolatedlist != null && isolatedlist.Any())
            {
                var isolated = isolatedlist.OrderByDescending(
                    hero =>
                    Player.CalcDamage(hero, Damage.DamageType.Physical, 100) / (1 + hero.Health) *
                    TargetSelector.GetPriority(hero)).FirstOrDefault();

                target = isolated;
                isolatedlist.Clear();
            }
            else
            {
                target = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);
            }

            if (target == null || !target.IsValid || !target.IsEnemy || target.IsDead || Player.Distance(target) > E.Range + 100)
            {
                target = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);
            }


            if ((target != null))
            {
                // Normal abilities
                if (Player.Distance(target) <= Q.Range && Config.Item("UseQCombo").GetValue <bool>() &&
                    Q.IsReady())
                {
                    Orbwalker.SetAttack(false);
                    Q.Cast(target, usePacket);
                    Orbwalker.SetAttack(true);
                }
                if (Wnorm && Player.Distance(target) <= W.Range && Config.Item("UseWCombo").GetValue <bool>() &&
                    W.IsReady() && W.GetPrediction(target).Hitchance >= hitchance)
                {
                    PredictionOutput pred = W.GetPrediction(target);
                    W.Cast(pred.CastPosition, usePacket);
                }

                if (Player.Distance(target) <= E.Range && Config.Item("UseECombo").GetValue <bool>() &&
                    E.IsReady() && Player.Distance(target) > Q.Range)
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead)
                    {
                        E.Cast(pred.CastPosition, usePacket);
                    }
                }

                // Use EQ AND EW Synergy
                if ((Player.Distance(target) <= E.Range + Q.Range && Player.Distance(target) > Q.Range && E.IsReady() &&
                     Config.Item("UseEGapclose").GetValue <bool>()) || (Player.Distance(target) <= E.Range + W.Range && Player.Distance(target) > Q.Range && E.IsReady() && W.IsReady() &&
                                                                        Config.Item("UseEGapcloseW").GetValue <bool>()))
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead)
                    {
                        E.Cast(pred.CastPosition, usePacket);
                    }
                    if (Config.Item("UseRGapcloseW").GetValue <bool>() && R.IsReady())
                    {
                        R.CastOnUnit(ObjectManager.Player);
                    }
                }


                // Ult Usage
                if (R.IsReady() && !Q.IsReady() && !W.IsReady() && !E.IsReady() &&
                    Config.Item("UseRCombo").GetValue <bool>())
                {
                    R.Cast();
                    if (Config.Item("Debugon").GetValue <bool>())
                    {
                        Game.PrintChat("9 - Basic Ult Cast");
                    }
                }
                // Evolved

                if (Wevolved && Player.Distance(target) <= WE.Range && Config.Item("UseWCombo").GetValue <bool>() &&
                    W.IsReady() && W.GetPrediction(target).Hitchance >= hitchance)
                {
                    PredictionOutput pred = WE.GetPrediction(target);
                    // W.Cast(pred.CastPosition, usePacket);
                    CastWE(target, pred.UnitPosition.To2D());
                }
                if (Wevolved && Player.Distance(target) <= WE.Range && Config.Item("UseWCombo").GetValue <bool>() &&
                    W.IsReady() && W.GetPrediction(target).Hitchance >= HitChance.Collision)
                {
                    List <Obj_AI_Base> PCollision = W.GetPrediction(target).CollisionObjects;
                    foreach (
                        Obj_AI_Base PredCollisionChar in
                        PCollision.Where(PredCollisionChar => PredCollisionChar.Distance(target) <= 30))
                    {
                        W.Cast(PredCollisionChar.Position, usePacket);
                    }
                }

                if (Player.Distance(target) <= E.Range && Player.Distance(target) > Q.Range &&
                    Config.Item("UseECombo").GetValue <bool>() && E.IsReady())
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead)
                    {
                        E.Cast(pred.CastPosition, usePacket);
                    }
                }


                if (Config.Item("UseItems").GetValue <bool>())
                {
                    UseItems(target);
                }
            }
        }
コード例 #27
0
ファイル: Program.cs プロジェクト: kkenjii/LeagueRepo
        private static void Game_OnGameUpdate(EventArgs args)
        {
            ManaMenager();
            if (Orbwalker.ActiveMode.ToString() == "Mixed" || Orbwalker.ActiveMode.ToString() == "LaneClear" || Orbwalker.ActiveMode.ToString() == "LastHit")
            {
                Farm = true;
            }
            else
            {
                Farm = false;
            }

            if (Orbwalker.GetTarget() == null)
            {
                attackNow = true;
            }
            if (E.IsReady())
            {
                if (Config.Item("smartE").GetValue <KeyBind>().Active)
                {
                    Esmart = true;
                }
                if (Esmart && ObjectManager.Player.Position.Extend(Game.CursorPos, E.Range).CountEnemiesInRange(500) < 4)
                {
                    E.Cast(ObjectManager.Player.Position.Extend(Game.CursorPos, E.Range), true);
                }
            }
            else
            {
                Esmart = false;
            }

            if (Orbwalker.ActiveMode.ToString() == "Combo" && E.IsReady() && Config.Item("autoE").GetValue <bool>())
            {
                ManaMenager();
                var t2 = TargetSelector.GetTarget(950, TargetSelector.DamageType.Physical);
                var t  = TargetSelector.GetTarget(1300, TargetSelector.DamageType.Physical);

                if (E.IsReady() && ObjectManager.Player.Mana > RMANA + EMANA &&
                    ObjectManager.Player.CountEnemiesInRange(260) > 0 &&
                    ObjectManager.Player.Position.Extend(Game.CursorPos, E.Range).CountEnemiesInRange(500) < 3 &&
                    t.Position.Distance(Game.CursorPos) > t.Position.Distance(ObjectManager.Player.Position))
                {
                    E.Cast(ObjectManager.Player.Position.Extend(Game.CursorPos, E.Range), true);
                }
                else if (ObjectManager.Player.Health > ObjectManager.Player.MaxHealth * 0.4 &&
                         !ObjectManager.Player.UnderTurret(true) &&
                         (Game.Time - OverKill > 0.4)

                         && ObjectManager.Player.Position.Extend(Game.CursorPos, E.Range).CountEnemiesInRange(700) < 3)
                {
                    if (t.IsValidTarget() &&
                        ObjectManager.Player.Mana > QMANA + EMANA + WMANA &&
                        t.Position.Distance(Game.CursorPos) + 300 < t.Position.Distance(ObjectManager.Player.Position) &&
                        Q.IsReady() && W.IsReady() &&
                        Q.GetDamage(t) + W.GetDamage(t) + E.GetDamage(t) > t.Health &&
                        !Orbwalking.InAutoAttackRange(t) &&
                        Q.WillHit(ObjectManager.Player.Position.Extend(Game.CursorPos, E.Range), Q.GetPrediction(t).UnitPosition)
                        )
                    {
                        E.Cast(ObjectManager.Player.Position.Extend(Game.CursorPos, E.Range), true);
                        debug("E kill Q");
                    }
                    else if (t2.IsValidTarget() &&
                             t2.Position.Distance(Game.CursorPos) + 300 < t2.Position.Distance(ObjectManager.Player.Position) &&
                             ObjectManager.Player.Mana > EMANA + RMANA &&
                             ObjectManager.Player.GetAutoAttackDamage(t2) + E.GetDamage(t2) > t2.Health &&
                             !Orbwalking.InAutoAttackRange(t2))
                    {
                        E.Cast(ObjectManager.Player.Position.Extend(Game.CursorPos, E.Range), true);
                        debug("E kill aa");
                        OverKill = Game.Time;
                    }
                    else if (t.IsValidTarget() &&
                             ObjectManager.Player.Mana > QMANA + EMANA + WMANA &&
                             t.Position.Distance(Game.CursorPos) + 300 < t.Position.Distance(ObjectManager.Player.Position) &&
                             W.IsReady() &&
                             W.GetDamage(t) + E.GetDamage(t) > t.Health &&
                             !Orbwalking.InAutoAttackRange(t) &&
                             Q.WillHit(ObjectManager.Player.Position.Extend(Game.CursorPos, E.Range), Q.GetPrediction(t).UnitPosition)
                             )
                    {
                        E.Cast(ObjectManager.Player.Position.Extend(Game.CursorPos, E.Range), true);
                        debug("E kill W");
                    }
                }
            }

            if (Q.IsReady())
            {
                //Q.Cast(ObjectManager.Player);
                ManaMenager();
                if (Config.Item("mura").GetValue <bool>())
                {
                    int Mur = Items.HasItem(Muramana) ? 3042 : 3043;
                    if (Orbwalker.ActiveMode.ToString() == "Combo" && Items.HasItem(Mur) && Items.CanUseItem(Mur) && ObjectManager.Player.Mana > RMANA + EMANA + QMANA + WMANA)
                    {
                        if (!ObjectManager.Player.HasBuff("Muramana"))
                        {
                            Items.UseItem(Mur);
                        }
                    }
                    else if (ObjectManager.Player.HasBuff("Muramana") && Items.HasItem(Mur) && Items.CanUseItem(Mur))
                    {
                        Items.UseItem(Mur);
                    }
                }
                bool cast = false;
                bool wait = false;
                foreach (var target in ObjectManager.Get <Obj_AI_Hero>())
                {
                    if (target.IsValidTarget(Q.Range + 100) &&
                        !target.HasBuffOfType(BuffType.PhysicalImmunity))
                    {
                        float predictedHealth = HealthPrediction.GetHealthPrediction(target, (int)(Q.Delay + (Player.Distance(target.ServerPosition) / Q.Speed) * 1000));
                        var   Qdmg            = Q.GetDamage(target);
                        if (Qdmg > predictedHealth)
                        {
                            cast = true;
                            wait = true;
                            PredictionOutput output    = R.GetPrediction(target);
                            Vector2          direction = output.CastPosition.To2D() - Player.Position.To2D();
                            direction.Normalize();
                            List <Obj_AI_Hero> enemies = ObjectManager.Get <Obj_AI_Hero>().Where(x => x.IsEnemy && x.IsValidTarget()).ToList();
                            foreach (var enemy in enemies)
                            {
                                if (enemy.SkinName == target.SkinName || !cast)
                                {
                                    continue;
                                }
                                PredictionOutput prediction        = R.GetPrediction(enemy);
                                Vector3          predictedPosition = prediction.CastPosition;
                                Vector3          v      = output.CastPosition - Player.ServerPosition;
                                Vector3          w      = predictedPosition - Player.ServerPosition;
                                double           c1     = Vector3.Dot(w, v);
                                double           c2     = Vector3.Dot(v, v);
                                double           b      = c1 / c2;
                                Vector3          pb     = Player.ServerPosition + ((float)b * v);
                                float            length = Vector3.Distance(predictedPosition, pb);
                                if (length < (Q.Width + enemy.BoundingRadius) && Player.Distance(predictedPosition) < Player.Distance(target.ServerPosition))
                                {
                                    cast = false;
                                }
                            }
                            if (cast && target.IsValidTarget(Q.Range + 100))
                            {
                                castQ(target);
                                OverKill = Game.Time;
                                debug("Q ks");
                            }
                        }
                    }
                }
                var t = TargetSelector.GetTarget(Q.Range - 50, TargetSelector.DamageType.Physical);
                if (ObjectManager.Player.CountEnemiesInRange(900) == 0)
                {
                    t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);
                }
                else
                {
                    t = TargetSelector.GetTarget(900, TargetSelector.DamageType.Physical);
                }

                if (t.IsValidTarget() && Q.IsReady() && !wait && attackNow)
                {
                    var qDmg = Q.GetDamage(t);
                    var wDmg = W.GetDamage(t);
                    if (qDmg * 3 > t.Health && Config.Item("noob").GetValue <bool>() && t.CountAlliesInRange(800) > 1)
                    {
                        debug("Q noob mode");
                    }
                    else if (t.IsValidTarget(W.Range) && qDmg + wDmg > t.Health)
                    {
                        castQ(t);
                    }
                    else if (Orbwalker.ActiveMode.ToString() == "Combo" && ObjectManager.Player.Mana > RMANA + QMANA + EMANA)
                    {
                        castQ(t);
                    }
                    else if ((Farm && ObjectManager.Player.Mana > RMANA + EMANA + QMANA + WMANA) && !ObjectManager.Player.UnderTurret(true) && haras())
                    {
                        castQ(t);
                    }

                    else if ((Orbwalker.ActiveMode.ToString() == "Combo" || Farm) && ObjectManager.Player.Mana > RMANA + QMANA + EMANA)
                    {
                        foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(W.Range)))
                        {
                            if (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) ||
                                enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) ||
                                enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuffOfType(BuffType.Slow) || enemy.HasBuff("Recall"))
                            {
                                Q.Cast(enemy, true);
                            }
                        }
                    }
                }
                if (Farm && attackNow && Config.Item("farmQ").GetValue <bool>() && Q.IsReady() && ObjectManager.Player.Mana > RMANA + EMANA + WMANA + QMANA * 3)
                {
                    farmQ();
                }
                else if (!ObjectManager.Player.HasBuff("Recall") && Orbwalker.ActiveMode.ToString() != "Combo" && !t.IsValidTarget() && Config.Item("stack").GetValue <bool>() && (Items.HasItem(Tear) || Items.HasItem(Manamune)) && ObjectManager.Player.Mana == ObjectManager.Player.MaxMana && Q.IsReady())
                {
                    Q.Cast(ObjectManager.Player);
                }
            }
            if (W.IsReady() && attackNow)
            {
                //W.Cast(ObjectManager.Player);
                ManaMenager();
                var t = TargetSelector.GetTarget(W.Range, TargetSelector.DamageType.Physical);
                if (t.IsValidTarget())
                {
                    var qDmg = Q.GetDamage(t);
                    var wDmg = W.GetDamage(t);
                    if (wDmg > t.Health)
                    {
                        castW(t);
                    }
                    else if (wDmg + qDmg > t.Health && Q.IsReady())
                    {
                        castW(t);
                    }
                    else if (qDmg * 2 > t.Health && Config.Item("noob").GetValue <bool>() && t.CountAlliesInRange(800) > 1)
                    {
                        debug("W noob mode");
                    }
                    else if (Orbwalker.ActiveMode.ToString() == "Combo" && ObjectManager.Player.Mana > RMANA + WMANA + EMANA + QMANA)
                    {
                        castW(t);
                    }
                    else if (Farm && !ObjectManager.Player.UnderTurret(true) && (ObjectManager.Player.Mana > ObjectManager.Player.MaxMana * 0.8 || W.Level > Q.Level) && ObjectManager.Player.Mana > RMANA + WMANA + EMANA + QMANA + WMANA)
                    {
                        castW(t);
                    }
                    else if ((Orbwalker.ActiveMode.ToString() == "Combo" || Farm) && ObjectManager.Player.Mana > RMANA + WMANA + EMANA)
                    {
                        foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>().Where(enemy => enemy.IsValidTarget(W.Range)))
                        {
                            if (enemy.HasBuffOfType(BuffType.Stun) || enemy.HasBuffOfType(BuffType.Snare) ||
                                enemy.HasBuffOfType(BuffType.Charm) || enemy.HasBuffOfType(BuffType.Fear) ||
                                enemy.HasBuffOfType(BuffType.Taunt) || enemy.HasBuffOfType(BuffType.Slow) || enemy.HasBuff("Recall"))
                            {
                                W.Cast(enemy, true);
                            }
                        }
                    }
                }
            }
            PotionMenager();

            if (R.IsReady() && Config.Item("autoR").GetValue <bool>() && ObjectManager.Player.CountEnemiesInRange(800) == 0 && (Game.Time - OverKill > 0.6))
            {
                foreach (var target in ObjectManager.Get <Obj_AI_Hero>())
                {
                    if (target.IsValidTarget(R.Range) &&
                        !target.HasBuffOfType(BuffType.PhysicalImmunity) &&
                        !target.HasBuffOfType(BuffType.SpellImmunity) &&
                        !target.HasBuffOfType(BuffType.SpellShield))
                    {
                        float  predictedHealth = HealthPrediction.GetHealthPrediction(target, (int)(R.Delay + (Player.Distance(target.ServerPosition) / R.Speed) * 1000));
                        double Rdmg            = R.GetDamage(target);
                        if (Rdmg > predictedHealth)
                        {
                            Rdmg = getRdmg(target);
                        }
                        var qDmg = Q.GetDamage(target);
                        var wDmg = W.GetDamage(target);
                        if (target.IsValidTarget(R.Range) && Rdmg > predictedHealth && target.CountAlliesInRange(400) == 0)
                        {
                            if (Config.Item("hitchanceR").GetValue <bool>() && target.Path.Count() < 2)
                            {
                                R.CastIfHitchanceEquals(target, HitChance.VeryHigh, true);
                            }
                            else
                            {
                                R.Cast(target, true);
                            }
                        }
                        else if (Rdmg > predictedHealth && target.HasBuff("Recall"))
                        {
                            R.Cast(target, true, true);
                            debug("R recall");
                        }
                        else if (target.HasBuffOfType(BuffType.Stun) || target.HasBuffOfType(BuffType.Snare) ||
                                 target.HasBuffOfType(BuffType.Charm) || target.HasBuffOfType(BuffType.Fear) ||
                                 target.HasBuffOfType(BuffType.Taunt))
                        {
                            if (target.IsValidTarget(Q.Range + E.Range) && Rdmg + qDmg + wDmg > predictedHealth)
                            {
                                R.CastIfHitchanceEquals(target, HitChance.VeryHigh, true);
                            }
                        }
                        else if (target.IsValidTarget(R.Range) && Orbwalker.ActiveMode.ToString() == "Combo")
                        {
                            R.CastIfWillHit(target, 3, true);
                        }
                        else if (target.IsValidTarget(Q.Range + E.Range) && Rdmg + qDmg + wDmg > predictedHealth && Orbwalker.ActiveMode.ToString() == "Combo")
                        {
                            R.CastIfWillHit(target, 2, true);
                        }
                    }
                }
            }
        }
コード例 #28
0
ファイル: Caitlyn.cs プロジェクト: v1148797121/LeagueSharp
        private void Combo()
        {
            var comboTarget = TargetSelector.GetTarget(_spells[SpellSlot.Q].Range, TargetSelector.DamageType.Physical);
            var eqTarget    = TargetSelector.GetTarget(_spells[SpellSlot.Q].Range + 505f, TargetSelector.DamageType.Physical);
            var rTarget     = TargetSelector.GetTarget(_spells[SpellSlot.R].Range, TargetSelector.DamageType.Physical);

            if (_spells[SpellSlot.Q].IsEnabledAndReady(Mode.Combo) && comboTarget.IsValidTarget(_spells[SpellSlot.Q].Range))
            {
                if (MenuHelper.isMenuEnabled("dzaio.caitlyin.combo.skilloptions.impq"))
                {
                    if (HeroHelper.IsEmpaired(comboTarget))
                    {
                        _spells[SpellSlot.Q].CastIfHitchanceEquals(comboTarget, MenuHelper.GetHitchance());
                    }
                }
                else
                {
                    _spells[SpellSlot.Q].CastIfHitchanceEquals(comboTarget, MenuHelper.GetHitchance());
                }
            }

            if (_spells[SpellSlot.W].IsEnabledAndReady(Mode.Combo) && comboTarget.IsValidTarget(_spells[SpellSlot.W].Range) &&
                (HeroHelper.IsEmpaired(comboTarget) || comboTarget.IsRecalling()))
            {
                _spells[SpellSlot.W].CastIfHitchanceEquals(comboTarget, MenuHelper.GetHitchance());
            }

            if (_spells[SpellSlot.R].IsEnabledAndReady(Mode.Combo))
            {
                if (HeroHelper.IsSafePosition(ObjectManager.Player.ServerPosition) && _spells[SpellSlot.R].GetDamage(rTarget) >= rTarget.Health + 25 &&
                    rTarget.CountEnemiesInRange(800f) <= 2 && rTarget.CountAlliesInRange(600f) < 3 && rTarget.Distance(ObjectManager.Player) >= ObjectManager.Player.AttackRange)
                {
                    _spells[SpellSlot.R].CastOnUnit(rTarget);
                }
            }

            #region E Combos
            if (_spells[SpellSlot.E].IsEnabledAndReady(Mode.Combo) && !_spells[SpellSlot.R].IsEnabledAndReady(Mode.Combo) && eqTarget.IsValidTarget() && eqTarget.Distance(ObjectManager.Player) >= Orbwalking.GetRealAutoAttackRange(null))
            {
                var afterEPosition = GetPositionAfterE(WhereToEForPosition(eqTarget.ServerPosition));
                if (!CaitlynIsSafePosition(afterEPosition))
                {
                    return;
                }
                var delay = (int)Math.Ceiling(ObjectManager.Player.Distance(afterEPosition) / _spells[SpellSlot.E].Speed * 1000 + 100);
                //var delayPrediction = Prediction.GetPrediction(eqTarget, delay);
                //E AA
                if (afterEPosition.Distance(eqTarget.ServerPosition) <= Orbwalking.GetRealAutoAttackRange(null) - 50 && ObjectManager.Player.GetAutoAttackDamage(eqTarget) >= eqTarget.Health + 20)
                {
                    _spells[SpellSlot.E].Cast(WhereToEForPosition(eqTarget.ServerPosition));
                    LeagueSharp.Common.Utility.DelayAction.Add((int)(delay + Game.Ping / 2f), Orbwalking.ResetAutoAttackTimer);
                    _orbwalker.ForceTarget(eqTarget);
                    return;
                }
                //E Q
                PredictionOutput customPrediction = PredictionHelper.GetP(afterEPosition, _spells[SpellSlot.Q], eqTarget, false);
                if (_spells[SpellSlot.Q].IsKillable(eqTarget) && _spells[SpellSlot.Q].IsReady() &&
                    afterEPosition.Distance(eqTarget.ServerPosition) <= _spells[SpellSlot.Q].Range &&
                    !(afterEPosition.Distance(eqTarget.ServerPosition) <= Orbwalking.GetRealAutoAttackRange(null) &&
                      ObjectManager.Player.GetAutoAttackDamage(eqTarget) >= eqTarget.Health + 20))
                {
                    _spells[SpellSlot.E].Cast(WhereToEForPosition(eqTarget.ServerPosition));
                    LeagueSharp.Common.Utility.DelayAction.Add(delay, () => _spells[SpellSlot.Q].Cast(customPrediction.CastPosition));
                }
            }
            #endregion
        }
コード例 #29
0
ファイル: Jayce.cs プロジェクト: betw01/detu
        public static void doCombo(Obj_AI_Hero target)
        {
            if (!isHammer)
            {
                if (castEonQ != null)
                {
                    castEonSpell(target);
                }
                //DO QE combo first
                if (E1.IsReady() && Q1.IsReady() && gotManaFor(true, false, true))
                {
                    PredictionOutput po = QEmp1.GetPrediction(target);
                    if (po.Hitchance == HitChance.High /* && Player.Distance(po.CastPosition) < (QEmp1.Range + target.BoundingRadius)*/)
                    {
                        // Vector3 bPos = Player.ServerPosition - (target.Position - Player.ServerPosition);

                        // Player.IssueOrder(GameObjectOrder.MoveTo, bPos);
                        castQon = po.CastPosition;
                        // shootQE(po.CastPosition);
                        // QEmp1.Cast(po.CastPosition);
                    }

                    // QEmp1.CastIfHitchanceEquals(target, HitChance.High);
                }
                else if (Q1.IsReady() && gotManaFor(true))
                {
                    PredictionOutput po = Q1.GetPrediction(target);
                    if (po.Hitchance >= HitChance.Low /* && Player.Distance(po.CastPosition) < (Q1.Range + target.BoundingRadius)*/)
                    {
                        Q1.Cast(po.CastPosition);
                    }
                }
                else if (W1.IsReady() && gotManaFor(false, true) && targetInRange(getClosestEnem(), 650f))
                {
                    W1.Cast();
                }//and wont die wih 1 AA
                else if (!Q1.IsReady() && !W1.IsReady() && R1.IsReady() && hammerWillKill(target) && hamQCDRem == 0 && hamECDRem == 0)// will need to add check if other form skills ready
                {
                    R1.Cast();
                }
            }
            else
            {
                if (!Q2.IsReady() && R2.IsReady() && Player.Distance(getClosestEnem()) > 350)
                {
                    R2.Cast();
                }
                if (Q2.IsReady() && gotManaFor(true) && targetInRange(target, Q2.Range) && Player.Distance(target) > 300)
                {
                    Q2.Cast(target);
                }
                if (E2.IsReady() && gotManaFor(false, false, true) && targetInRange(target, E2.Range) && shouldIKnockDatMadaFaka(target))
                {
                    E2.Cast(target);
                }
                if (W2.IsReady() && gotManaFor(false, true) && targetInRange(target, W2.Range))
                {
                    W2.Cast();
                }
            }
        }
コード例 #30
0
ファイル: Khazix.cs プロジェクト: hviethn1107/LeagueSharp-2
        void KillSteal()
        {
            Obj_AI_Hero target = HeroList
                                 .Where(x => x.IsValidTarget() && x.Distance(Khazix.Position) < 1375f && !x.IsZombie)
                                 .MinOrDefault(x => x.Health);

            if (target != null && target.IsInRange(Ignite.Range))
            {
                if (Config.GetBool("UseIgnite") && IgniteSlot != SpellSlot.Unknown &&
                    Khazix.Spellbook.CanUseSpell(IgniteSlot) == SpellState.Ready)
                {
                    double igniteDmg = Khazix.GetSummonerSpellDamage(target, Damage.SummonerSpell.Ignite);
                    if (igniteDmg > target.Health)
                    {
                        Khazix.Spellbook.CastSpell(IgniteSlot, target);
                        return;
                    }
                }

                if (Config.GetBool("Safety.autoescape") && !IsHealthy)
                {
                    var ally =
                        HeroList.FirstOrDefault(h => h.HealthPercent > 40 && h.CountEnemiesInRange(400) == 0 && !h.ServerPosition.PointUnderEnemyTurret());
                    if (ally != null && ally.IsValid)
                    {
                        E.Cast(ally.ServerPosition);
                        return;
                    }
                    var underTurret = EnemyTurrets.Any(x => x.Distance(Khazix.ServerPosition) <= 900f && !x.IsDead && x.IsValid);
                    if (underTurret || Khazix.CountEnemiesInRange(500) >= 1)
                    {
                        var bestposition = Khazix.ServerPosition.Extend(NexusPosition, E.Range);
                        E.Cast(bestposition);
                        return;
                    }
                }

                if (Config.GetBool("UseQKs") && Q.IsReady() &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= Q.Range)
                {
                    double QDmg = GetQDamage(target);
                    if (!Jumping && target.Health <= QDmg)
                    {
                        Q.Cast(target);
                        return;
                    }
                }

                if (Config.GetBool("UseEKs") && E.IsReady() && !Jumping &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= E.Range && Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) > Q.Range)
                {
                    double EDmg = Khazix.GetSpellDamage(target, SpellSlot.E);
                    if (!Jumping && target.Health < EDmg)
                    {
                        Utility.DelayAction.Add(
                            Game.Ping + Config.GetSlider("EDelay"), delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValid && !target.IsDead)
                            {
                                if (Config.GetBool("Ksbypass") || ShouldJump(pred.CastPosition))
                                {
                                    E.Cast(pred.CastPosition);
                                }
                            }
                        });
                    }
                }

                if (W.IsReady() && !EvolvedW && Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range &&
                    Config.GetBool("UseWKs"))
                {
                    double WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    if (target.Health <= WDmg)
                    {
                        var pred = W.GetPrediction(target);
                        if (pred.Hitchance >= HitChance.Medium)
                        {
                            W.Cast(pred.CastPosition);
                            return;
                        }
                    }
                }

                if (W.IsReady() && EvolvedW &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range &&
                    Config.GetBool("UseWKs"))
                {
                    double           WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    PredictionOutput pred = WE.GetPrediction(target);
                    if (target.Health <= WDmg && pred.Hitchance >= HitChance.Medium)
                    {
                        CastWE(target, pred.UnitPosition.To2D(), 0, Config.GetHitChance("WHitchance"));
                        return;
                    }

                    if (pred.Hitchance >= HitChance.Collision)
                    {
                        List <Obj_AI_Base> PCollision = pred.CollisionObjects;
                        var x =
                            PCollision
                            .FirstOrDefault(PredCollisionChar => Vector3.Distance(PredCollisionChar.ServerPosition, target.ServerPosition) <= 30);
                        if (x != null)
                        {
                            W.Cast(x.Position);
                            return;
                        }
                    }
                }


                // Mixed's EQ KS
                if (Q.IsReady() && E.IsReady() &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= E.Range + Q.Range &&
                    Config.GetBool("UseEQKs"))
                {
                    double QDmg = GetQDamage(target);
                    double EDmg = Khazix.GetSpellDamage(target, SpellSlot.E);
                    if ((target.Health <= QDmg + EDmg))
                    {
                        Utility.DelayAction.Add(Config.GetSlider("EDelay"), delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValidTarget() && !target.IsZombie && ShouldJump(pred.CastPosition))
                            {
                                if (Config.GetBool("Ksbypass") || ShouldJump(pred.CastPosition))
                                {
                                    E.Cast(pred.CastPosition);
                                }
                            }
                        });
                    }
                }

                // MIXED EW KS
                if (W.IsReady() && E.IsReady() && !EvolvedW &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range + E.Range &&
                    Config.GetBool("UseEWKs"))
                {
                    double WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    if (target.Health <= WDmg)
                    {
                        Utility.DelayAction.Add(Config.GetSlider("EDelay"), delegate
                        {
                            PredictionOutput pred = E.GetPrediction(target);
                            if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                            {
                                if (Config.GetBool("Ksbypass") || ShouldJump(pred.CastPosition))
                                {
                                    E.Cast(pred.CastPosition);
                                }
                            }
                        });
                    }
                }

                if (Tiamat.IsReady() &&
                    Vector2.Distance(Khazix.ServerPosition.To2D(), target.ServerPosition.To2D()) <= Tiamat.Range &&
                    Config.GetBool("UseTiamatKs"))
                {
                    double Tiamatdmg = Khazix.GetItemDamage(target, Damage.DamageItems.Tiamat);
                    if (target.Health <= Tiamatdmg)
                    {
                        Tiamat.Cast();
                        return;
                    }
                }
                if (Hydra.IsReady() &&
                    Vector2.Distance(Khazix.ServerPosition.To2D(), target.ServerPosition.To2D()) <= Hydra.Range &&
                    Config.GetBool("UseTiamatKs"))
                {
                    double hydradmg = Khazix.GetItemDamage(target, Damage.DamageItems.Hydra);
                    if (target.Health <= hydradmg)
                    {
                        Hydra.Cast();
                    }
                }
            }
        }
コード例 #31
0
        void Combo()
        {
            AIHeroClient target = null;

            if (SpellSlot.E.IsReady() && SpellSlot.Q.IsReady())
            {
                target = TargetSelector.GetTarget((E.Range + Q.Range) * 0.95f, DamageType.Physical);
            }

            if (target == null)
            {
                target = TargetSelector.GetTarget(W.Range, DamageType.Physical);
            }

            if ((target != null))
            {
                var dist = Khazix.Distance(target);

                // Normal abilities

                if (Q.IsReady() && !Jumping && getCheckBoxItem(combo, "UseQCombo"))
                {
                    if (dist <= Q.Range)
                    {
                        Q.Cast(target);
                    }
                }

                if (W.IsReady() && !EvolvedW && dist <= W.Range && getCheckBoxItem(combo, "UseWCombo"))
                {
                    var pred = W.GetPrediction(target);
                    if (pred.Hitchance >= Config.GetHitChance("WHitchance"))
                    {
                        W.Cast(pred.CastPosition);
                    }
                }

                if (E.IsReady() && !Jumping && dist <= E.Range && getCheckBoxItem(combo, "UseECombo") && dist > Q.Range + (0.7 * Khazix.MoveSpeed))
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                    {
                        E.Cast(pred.CastPosition);
                    }
                }

                // Use EQ AND EW Synergy
                if ((dist <= E.Range + Q.Range + (0.7 * Khazix.MoveSpeed) && dist > Q.Range && E.IsReady() &&
                     getCheckBoxItem(combo, "UseEGapclose")) || (dist <= E.Range + W.Range && dist > Q.Range && E.IsReady() && W.IsReady() &&
                                                                 getCheckBoxItem(combo, "UseEGapcloseW")))
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                    {
                        E.Cast(pred.CastPosition);
                    }
                    if (getCheckBoxItem(combo, "UseRGapcloseW") && R.IsReady())
                    {
                        R.CastOnUnit(Khazix);
                    }
                }


                // Ult Usage
                if (R.IsReady() && !Q.IsReady() && !W.IsReady() && !E.IsReady() &&
                    getCheckBoxItem(combo, "UseRCombo"))
                {
                    R.Cast();
                }
                // Evolved

                if (W.IsReady() && EvolvedW && dist <= WE.Range && getCheckBoxItem(combo, "UseWCombo"))
                {
                    PredictionOutput pred = WE.GetPrediction(target);
                    if (pred.Hitchance >= Config.GetHitChance("WHitchance"))
                    {
                        CastWE(target, pred.UnitPosition.To2D(), 0, Config.GetHitChance("WHitchance"));
                    }
                    if (pred.Hitchance >= HitChance.Collision)
                    {
                        List <Obj_AI_Base> PCollision = pred.CollisionObjects;
                        var x = PCollision.Where(PredCollisionChar => PredCollisionChar.Distance(target) <= 30).FirstOrDefault();
                        if (x != null)
                        {
                            W.Cast(x.Position);
                        }
                    }
                }

                if (dist <= E.Range + (0.7 * Khazix.MoveSpeed) && dist > Q.Range &&
                    getCheckBoxItem(combo, "UseECombo") && E.IsReady())
                {
                    PredictionOutput pred = E.GetPrediction(target);
                    if (target.IsValid && !target.IsDead && ShouldJump(pred.CastPosition))
                    {
                        E.Cast(pred.CastPosition);
                    }
                }

                if (getCheckBoxItem(combo, "UseItems"))
                {
                    UseItems(target);
                }
            }
        }
コード例 #32
0
        private void CastR()
        {
            Spell R = Spells.get("R");

            if (!R.IsReady())
            {
                return;
            }

            Obj_AI_Hero target = SimpleTs.GetTarget(Menu.Item("Auto_maxrange").GetValue <Slider>().Value, SimpleTs.DamageType.Physical);

            if (target == null || Player.Distance(target) < Menu.Item("Auto_minrange").GetValue <Slider>().Value)
            {
                return;
            }

            float predictedHealth = HealthPrediction.GetHealthPrediction(target, (int)(R.Delay + (Player.Distance(target) / R.Speed) * 1000));

            if (UltimateDamage(target) < predictedHealth || predictedHealth <= 0)
            {
                return;
            }

            bool cast = true;

            PredictionOutput output = R.GetPrediction(target);

            Vector2 direction = output.CastPosition.To2D() - Player.Position.To2D();

            direction.Normalize();

            if (output.Hitchance >= HitChance.VeryHigh)
            {
                List <Obj_AI_Hero> enemies = ObjectManager.Get <Obj_AI_Hero>().Where(x => x.IsEnemy && x.IsValidTarget()).ToList();
                foreach (var enemy in enemies)
                {
                    if (enemy.SkinName == target.SkinName || !cast)
                    {
                        continue;
                    }

                    PredictionOutput prediction        = R.GetPrediction(enemy);
                    Vector3          predictedPosition = prediction.CastPosition;

                    Vector3 v = output.CastPosition - Player.Position;
                    Vector3 w = predictedPosition - Player.Position;

                    double c1 = Vector3.Dot(w, v);
                    double c2 = Vector3.Dot(v, v);
                    double b  = c1 / c2;

                    Vector3 pb     = Player.Position + ((float)b * v);
                    float   length = Vector3.Distance(predictedPosition, pb);

                    if (length < (R.Width + enemy.BoundingRadius / 2) && Player.Distance(predictedPosition) < Player.Distance(target))
                    {
                        cast = false;
                    }
                }

                if (cast)
                {
                    R.Cast(target, true);
                }
            }
        }
コード例 #33
0
        internal void CastWE(Obj_AI_Base unit, Vector2 unitPosition, int minTargets = 0, HitChance hc = HitChance.Medium)
        {
            var points   = new List <Vector2>();
            var hitBoxes = new List <int>();

            Vector2 startPoint        = Khazix.ServerPosition.To2D();
            Vector2 originalDirection = W.Range * (unitPosition - startPoint).Normalized();

            foreach (AIHeroClient enemy in HeroManager.Enemies)
            {
                if (enemy.IsValidTarget() && enemy.NetworkId != unit.NetworkId)
                {
                    PredictionOutput pos = WE.GetPrediction(enemy);
                    if (pos.Hitchance >= hc)
                    {
                        points.Add(pos.UnitPosition.To2D());
                        hitBoxes.Add((int)enemy.BoundingRadius + 275);
                    }
                }
            }

            var posiblePositions = new List <Vector2>();

            for (int i = 0; i < 3; i++)
            {
                if (i == 0)
                {
                    posiblePositions.Add(unitPosition + originalDirection.Rotated(0));
                }
                if (i == 1)
                {
                    posiblePositions.Add(startPoint + originalDirection.Rotated(Wangle));
                }
                if (i == 2)
                {
                    posiblePositions.Add(startPoint + originalDirection.Rotated(-Wangle));
                }
            }


            if (startPoint.Distance(unitPosition) < 900)
            {
                for (int i = 0; i < 3; i++)
                {
                    Vector2 pos       = posiblePositions[i];
                    Vector2 direction = (pos - startPoint).Normalized().Perpendicular();
                    float   k         = (2 / 3 * (unit.BoundingRadius + W.Width));
                    posiblePositions.Add(startPoint - k * direction);
                    posiblePositions.Add(startPoint + k * direction);
                }
            }

            var bestPosition = new Vector2();
            int bestHit      = -1;

            foreach (Vector2 position in posiblePositions)
            {
                int hits = CountHits(position, points, hitBoxes);
                if (hits > bestHit)
                {
                    bestPosition = position;
                    bestHit      = hits;
                }
            }

            if (bestHit + 1 <= minTargets)
            {
                return;
            }

            W.Cast(bestPosition.To3D(), false);
        }
コード例 #34
0
ファイル: Khazix.cs プロジェクト: qazji3/LeagueSharp-5
        void Combo()
        {
            Obj_AI_Hero target = null;

            TargetSelector.TargetSelectionConditionDelegate conditions = targ => targ.IsIsolated() || targ.Health <= GetBurstDamage(targ);

            float targetSelectionRange = Khazix.AttackRange;

            if (SpellSlot.Q.IsReady())
            {
                targetSelectionRange += Q.Range;
            }

            if (SpellSlot.E.IsReady())
            {
                targetSelectionRange += E.Range;
            }

            else if (SpellSlot.W.IsReady())
            {
                targetSelectionRange += W.Range;
            }

            //Get Optimal target if available
            target = TargetSelector.GetTarget(targetSelectionRange, TargetSelector.DamageType.Physical, true, null, null, conditions);

            //If could not find then settle for anything
            if (target == null)
            {
                target = TargetSelector.GetTarget(targetSelectionRange, TargetSelector.DamageType.Physical, true, null, null);
            }

            //If a target has been found
            if ((target != null && target.IsValidEnemy()))
            {
                var dist = Khazix.Distance(target.ServerPosition);

                // Normal abilities

                if (Config.GetBool("UseQCombo") && Q.IsReady() && !Jumping)
                {
                    if (dist <= Q.Range)
                    {
                        Q.Cast(target);
                    }
                }

                if (Config.GetBool("UseWCombo") && W.IsReady() && !EvolvedW && dist <= W.Range)
                {
                    var pred = W.GetPrediction(target);
                    if (pred.Hitchance >= Config.GetHitChance("WHitchance"))
                    {
                        W.Cast(pred.CastPosition);
                    }
                }

                if (Config.GetBool("UseECombo") && E.IsReady() && !Jumping && dist <= E.Range && dist > Q.Range + (0.4 * Khazix.MoveSpeed))
                {
                    var jump = GetJumpPosition(target);
                    if (jump.shouldJump)
                    {
                        E.Cast(jump.position);
                    }
                }

                // Use EQ
                if ((Config.GetBool("UseEGapcloseQ") && Q.IsReady() && E.IsReady() && dist > Q.Range + (0.4 * Khazix.MoveSpeed) && dist <= E.Range + Q.Range))
                {
                    var jump = GetJumpPosition(target);
                    if (jump.shouldJump)
                    {
                        E.Cast(jump.position);
                    }
                    if (Config.GetBool("UseRGapcloseL") && R.IsReady())
                    {
                        R.CastOnUnit(Khazix);
                    }
                }


                // Ult Usage
                if (R.IsReady() && !Q.IsReady() && !W.IsReady() && !E.IsReady() &&
                    Config.GetBool("UseRCombo") && Khazix.CountEnemiesInRange(500) > 0)
                {
                    R.Cast();
                }

                // Evolved

                if (W.IsReady() && EvolvedW && dist <= WE.Range && Config.GetBool("UseWCombo"))
                {
                    PredictionOutput pred = WE.GetPrediction(target);
                    if (pred.Hitchance >= Config.GetHitChance("WHitchance"))
                    {
                        CastWE(target, pred.UnitPosition.To2D(), 0, Config.GetHitChance("WHitchance"));
                    }
                    if (pred.Hitchance >= HitChance.Collision)
                    {
                        List <Obj_AI_Base> PCollision = pred.CollisionObjects;
                        var x = PCollision.Where(PredCollisionChar => PredCollisionChar.Distance(target) <= 30).FirstOrDefault();
                        if (x != null)
                        {
                            W.Cast(x.Position);
                        }
                    }
                }


                if (Config.GetBool("Combo.Smite"))
                {
                    if (SmiteManager.CanCast(target))
                    {
                        SmiteManager.Cast(target);
                    }
                }

                if (Config.GetBool("UseItems"))
                {
                    UseItems(target);
                }
            }
        }
コード例 #35
0
        public static void castQ(Obj_AI_Base target, String Source)
        {
            if (IsBallMoving)
            {
                return;
            }

            var hitC       = HitChance.High;
            int qHit       = menu.Item("qHit").GetValue <Slider>().Value;
            int harassQHit = menu.Item("qHit2").GetValue <Slider>().Value;

            // HitChance.Low = 3, Medium , High .... etc..
            if (Source == "Combo")
            {
                switch (qHit)
                {
                case 1:
                    hitC = HitChance.Low;
                    break;

                case 2:
                    hitC = HitChance.Medium;
                    break;

                case 3:
                    hitC = HitChance.High;
                    break;

                case 4:
                    hitC = HitChance.VeryHigh;
                    break;
                }
            }
            else if (Source == "Harass")
            {
                switch (harassQHit)
                {
                case 1:
                    hitC = HitChance.Low;
                    break;

                case 2:
                    hitC = HitChance.Medium;
                    break;

                case 3:
                    hitC = HitChance.High;
                    break;

                case 4:
                    hitC = HitChance.VeryHigh;
                    break;
                }
            }

            PredictionOutput prediction = GetP(CurrentBallPosition, Q, target, true);

            if (Q.IsReady() && prediction.Hitchance >= hitC && Player.Distance(target) <= Q.Range + Q.Width)
            {
                Q.Cast(prediction.CastPosition, packets());
            }
        }
コード例 #36
0
ファイル: Khazix.cs プロジェクト: qazji3/LeagueSharp-5
        void KillSteal()
        {
            //Avoid interrupting our assasination attempt
            if (jumpManager.MidAssasination)
            {
                return;
            }

            Obj_AI_Hero target = HeroList
                                 .Where(x => x.IsValidTarget() && x.Distance(Khazix.Position) < 1375f && !x.IsZombie)
                                 .MinOrDefault(x => x.Health);

            if (target != null)
            {
                if (Config.GetBool("UseIgnite") && Ignite.IsReady() && target.IsInRange(Ignite.Range))
                {
                    double igniteDmg = Khazix.GetSummonerSpellDamage(target, Damage.SummonerSpell.Ignite);
                    if (igniteDmg > target.Health)
                    {
                        Ignite.Cast(target);
                        return;
                    }
                }

                if (Config.GetBool("UseQKs") && Q.IsReady() &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= Q.Range)
                {
                    double QDmg = GetQDamage(target);
                    if (!Jumping && target.Health <= QDmg)
                    {
                        Q.Cast(target);
                        return;
                    }
                }

                if (Config.GetBool("UseEKs") && E.IsReady() && !Jumping &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= E.Range && Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) > Q.Range)
                {
                    double EDmg = Khazix.GetSpellDamage(target, SpellSlot.E);
                    if (!Jumping && target.Health < EDmg)
                    {
                        Utility.DelayAction.Add(
                            Game.Ping + Config.GetSlider("EDelay"), delegate
                        {
                            var jump = GetJumpPosition(target);
                            if (jump.shouldJump)
                            {
                                if (target.IsValid && !target.IsDead)
                                {
                                    E.Cast(jump.position);
                                }
                            }
                        });
                    }
                }

                if (W.IsReady() && !EvolvedW && Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range &&
                    Config.GetBool("UseWKs"))
                {
                    double WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    if (target.Health <= WDmg)
                    {
                        var pred = W.GetPrediction(target);
                        if (pred.Hitchance >= HitChance.Medium)
                        {
                            W.Cast(pred.CastPosition);
                            return;
                        }
                    }
                }

                if (W.IsReady() && EvolvedW &&
                    Vector3.Distance(Khazix.ServerPosition, target.ServerPosition) <= W.Range &&
                    Config.GetBool("UseWKs"))
                {
                    double           WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    PredictionOutput pred = WE.GetPrediction(target);
                    if (target.Health <= WDmg && pred.Hitchance >= HitChance.Medium)
                    {
                        CastWE(target, pred.UnitPosition.To2D(), 0, Config.GetHitChance("WHitchance"));
                        return;
                    }

                    if (pred.Hitchance >= HitChance.Collision)
                    {
                        List <Obj_AI_Base> PCollision = pred.CollisionObjects;
                        var x =
                            PCollision
                            .FirstOrDefault(PredCollisionChar => Vector3.Distance(PredCollisionChar.ServerPosition, target.ServerPosition) <= 30);
                        if (x != null)
                        {
                            W.Cast(x.Position);
                            return;
                        }
                    }
                }


                // Mixed's EQ KS
                if (Q.IsReady() && E.IsReady() &&
                    target.IsValidEnemy(0.90f * (E.Range + Q.Range)) &&
                    Config.GetBool("UseEQKs"))
                {
                    double QDmg = GetQDamage(target);
                    double EDmg = Khazix.GetSpellDamage(target, SpellSlot.E);
                    if ((target.Health <= QDmg + EDmg))
                    {
                        Utility.DelayAction.Add(Config.GetSlider("EDelay"), delegate
                        {
                            var jump = GetJumpPosition(target);
                            if (jump.shouldJump)
                            {
                                E.Cast(jump.position);
                            }
                        });
                    }
                }

                // MIXED EW KS
                if (W.IsReady() && E.IsReady() && !EvolvedW &&
                    target.IsValidEnemy(W.Range + E.Range) &&
                    Config.GetBool("UseEWKs"))
                {
                    double WDmg = Khazix.GetSpellDamage(target, SpellSlot.W);
                    if (target.Health <= WDmg)
                    {
                        Utility.DelayAction.Add(Config.GetSlider("EDelay"), delegate
                        {
                            var jump = GetJumpPosition(target);
                            if (jump.shouldJump)
                            {
                                E.Cast(jump.position);
                            }
                        });
                    }
                }

                if (Tiamat.IsReady() &&
                    Vector2.Distance(Khazix.ServerPosition.To2D(), target.ServerPosition.To2D()) <= Tiamat.Range &&
                    Config.GetBool("UseTiamatKs"))
                {
                    double Tiamatdmg = Khazix.GetItemDamage(target, Damage.DamageItems.Tiamat);
                    if (target.Health <= Tiamatdmg)
                    {
                        Tiamat.Cast();
                        return;
                    }
                }

                if (Config.GetBool("UseSmiteKs"))
                {
                    if (SmiteManager.CanCast(target))
                    {
                        var dmg = SmiteManager.GetSmiteDamage(target);
                        if (dmg >= target.Health)
                        {
                            SmiteManager.Cast(target);
                        }
                    }
                }

                if (Hydra.IsReady() &&
                    Vector2.Distance(Khazix.ServerPosition.To2D(), target.ServerPosition.To2D()) <= Hydra.Range &&
                    Config.GetBool("UseTiamatKs"))
                {
                    double hydradmg = Khazix.GetItemDamage(target, Damage.DamageItems.Hydra);
                    if (target.Health <= hydradmg)
                    {
                        Hydra.Cast();
                    }
                }
            }
        }
コード例 #37
0
ファイル: Program.cs プロジェクト: princer007/LSResurrected
        /// <summary>
        /// Comboing
        /// </summary>
        static void Combo()
        {
            Console.WriteLine("Combo");
            bool        useQ    = Q1.IsReady() && menu.SubMenu("combo").Item("UseQ").GetValue <bool>();
            bool        useW    = W.IsReady() && menu.SubMenu("combo").Item("UseW").GetValue <bool>();
            bool        useE    = E.IsReady() && menu.SubMenu("combo").Item("UseE").GetValue <bool>();
            bool        useR    = R.IsReady() && (menu.SubMenu("combo").Item("UseR").GetValue <bool>() || menu.SubMenu("ulti").Item("forceR").GetValue <KeyBind>().Active);
            Obj_AI_Hero targetQ = TargetSelector.GetTarget(Q3.Range, TargetSelector.DamageType.Magical);
            Obj_AI_Hero targetW = TargetSelector.GetTarget(W.Range, TargetSelector.DamageType.Magical);
            Obj_AI_Hero targetE = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Magical);
            Obj_AI_Hero targetR = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Magical);

            if (targetW.IsValid && CalculateDamage(targetW) > targetW.Health)
            {
                if (IgniteSlot != SpellSlot.Unknown && player.Spellbook.CanUseSpell(IgniteSlot) == SpellState.Ready && menu.Item("UseIgnite").GetValue <bool>())
                {
                    player.Spellbook.CastSpell(IgniteSlot, targetW);
                }
                SMouse.addMouseEvent(targetW.Position, false, CRB);

                /*
                 *              if(DFG.IsReady())
                 *  DFG.Cast(targetW);*/
            }

            if (useW)
            {
                PredictionOutput prediction = W.GetPrediction(targetW);
                if (menu.SubMenu("misc").Item("GETOVERHERE").GetValue <bool>() && (prediction.Hitchance >= HitChance.Medium))
                {
                    Vector3 pos = V3E(player.Position, prediction.CastPosition, Vector3.Distance(player.Position, prediction.CastPosition) + 30);
                    if (Vector3.Distance(player.Position, prediction.CastPosition) >=
                        Vector3.Distance(player.Position, targetW.Position))
                    {
                        W.Cast(pos);
                        SMouse.addMouseEvent(pos, false, CRB);
                        Wmode = WModes.COMBAT;
                    }
                    else
                    {
                        //pos = V3E(player.Position, prediction.CastPosition, Vector3.Distance(player.Position, prediction.CastPosition));
                        W.Cast(targetW.Position);
                        SMouse.addMouseEvent(targetW.Position, false, CRB);
                        Wmode = WModes.COMBAT;
                    }
                }
                else
                {
                    Vector3 pos = V3E(player.Position, targetW.Position, Vector3.Distance(player.Position, prediction.CastPosition) - 10);
                    W.Cast(pos);
                    SMouse.addMouseEvent(pos, false, CRB);
                    Wmode = WModes.COMBAT;
                }
            }
            if (useQ)
            {
                CastQ(targetQ);
                SMouse.addMouseEvent(V3E(player.Position, targetQ.Position, Vector3.Distance(player.Position, targetQ.Position) * 0.5f), false, CRB);
            }
            if (useE)
            {
                PredictionOutput prediction = E.GetPrediction(targetE);
                Vector3          pos        = V3E(player.Position, prediction.CastPosition,
                                                  Vector3.Distance(player.Position, prediction.CastPosition) + 30);
                if (prediction.Hitchance >= HitChance.Medium)
                {
                    E.Cast(pos);
                    SMouse.addMouseEvent(pos, false, CRB);
                }
            }
            if (useR)//TEST IT!
            {
                //Honda's way to predict ulti
                R.Delay = 1900 + 1500 * targetR.Distance(player.Position) / 5300;
                PredictionOutput prediction = R.GetPrediction(targetR);
                if ((menu.SubMenu("ulti").Item("ultiOnKillable").GetValue <bool>() && (player.GetSpellDamage(targetR, SpellSlot.R, 0) > targetR.Health && !(CalculateDamage(targetR, true) > targetR.Health) && Vector3.Distance(player.Position, targetR.Position) < W.Range && lastQ + 3 < Game.Time) || menu.SubMenu("ulti").Item("forceR").GetValue <KeyBind>().Active))
                {
                    if (prediction.Hitchance >= HitChance.Medium || menu.SubMenu("ulti").Item("forceRPrediction").GetValue <bool>())
                    {
                        R.Cast(prediction.CastPosition);
                        SMouse.addMouseEvent(prediction.CastPosition, false, CRB);
                    }
                }

                if (!menu.SubMenu("ulti").Item("AOE").GetValue <bool>())
                {
                    return;
                }
                {
                    if (R.CastIfWillHit(targetR, menu.SubMenu("ulti").Item("enemiesToHit").GetValue <Slider>().Value))
                    {
                        SMouse.addMouseEvent(targetR.Position, false, CRB);
                    }
                }
            }
        }
コード例 #38
0
ファイル: OKTWPrediction.cs プロジェクト: Faqer/LeagueSharp-3
        internal static PredictionOutput WayPointAnalysis(PredictionOutput result, PredictionInput input)
        {

            if (!input.Unit.IsValid<Obj_AI_Hero>() || input.Radius == 1)
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            //Program.debug("PRED: FOR CHAMPION " + input.Unit.BaseSkinName);

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

            if (UnitTracker.GetSpecialSpellEndTime(input.Unit) > 0 || input.Unit.HasBuff("Recall"))
            {

                result.Hitchance = HitChance.VeryHigh;
                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);

            float speedDelay = distanceFromToUnit / input.Speed;

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

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

            if (angleMove < 31)
                angleMove = 31;

            if (UnitTracker.GetLastNewPathTime(input.Unit) < 0.1d)
            {
                pathMinLen = 600f + backToFront;
                result.Hitchance = HitChance.High;
            }

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

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

            if (UnitTracker.PathCalc(input.Unit))
            {
                if (distanceFromToUnit < input.Range - fixRange)
                {
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }

                result.Hitchance = HitChance.High;
                return result;
            }

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

            if (UnitTracker.GetLastVisableTime(input.Unit) < 0.08d)
            {
                result.Hitchance = HitChance.Medium;
                return result;
            }

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

            if (distanceFromToUnit < 300 || distanceFromToWaypoint < 200)
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;

            }

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

            if (distanceUnitToWaypoint > pathMinLen)
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            // RUN IN LANE DETECTION ///////////////////////////////////////////////////////////////////////////////////

            if (distanceFromToWaypoint > distanceFromToUnit + fixRange && GetAngle(input.From, input.Unit) < angleMove)
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

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

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

            // AUTO ATTACK LOGIC ///////////////////////////////////////////////////////////////////////////////////

            if (UnitTracker.GetLastAutoAttackTime(input.Unit) < 0.1d)
            {
                if (input.Type == SkillshotType.SkillshotLine && totalDelay < 0.6 + (input.Radius * 0.001))
                    result.Hitchance = HitChance.VeryHigh;
                else if (input.Type == SkillshotType.SkillshotCircle && totalDelay < 0.7 + (input.Radius * 0.001))
                    result.Hitchance = HitChance.VeryHigh;
                else
                    result.Hitchance = HitChance.High;

                return result;
            }

            // STOP LOGIC ///////////////////////////////////////////////////////////////////////////////////

            else
            {
                if (input.Unit.IsWindingUp)
                {
                    result.Hitchance = HitChance.High;
                    return result;
                }
                else if (input.Unit.Path.Count() == 0 && !input.Unit.IsMoving)
                {
                    if (distanceFromToUnit > input.Range - fixRange)
                        result.Hitchance = HitChance.Medium;
                    else if (UnitTracker.GetLastStopMoveTime(input.Unit) < 0.8d)
                        result.Hitchance = HitChance.High;
                    else
                        result.Hitchance = HitChance.VeryHigh;

                    return result;
                }
            }

            // ANGLE HIT CHANCE ///////////////////////////////////////////////////////////////////////////////////

            if (input.Type == SkillshotType.SkillshotLine && input.Unit.Path.Count() > 0 && input.Unit.IsMoving)
            {
                if (UnitTracker.GetLastNewPathTime(input.Unit) < 0.1d && GetAngle(input.From, input.Unit) < angleMove && distanceUnitToWaypoint > moveArea * 0.6)
                {
                    result.Hitchance = HitChance.VeryHigh;
                    return result;

                }
            }

            // CIRCLE NEW PATH ///////////////////////////////////////////////////////////////////////////////////

            if (input.Type == SkillshotType.SkillshotCircle)
            {
                if (UnitTracker.GetLastNewPathTime(input.Unit) < 0.1d && distanceUnitToWaypoint > fixRange && distanceFromToUnit < input.Range - fixRange && distanceUnitToWaypoint > fixRange)
                {
                    result.Hitchance = HitChance.VeryHigh;
                    return result;
                }
            }
            //Program.debug("PRED: NO DETECTION");

            return result;
        }
コード例 #39
0
        public static PredictionOutput GetBadaoPrediction(this Spell spell, Obj_AI_Base target, bool collideyasuowall = true)
        {
            PredictionOutput result = null;

            if (!target.IsValidTarget(float.MaxValue, false))
            {
                return(new PredictionOutput());
            }
            if (target.IsDashing())
            {
                var dashDtata = target.GetDashInfo();
                result = spell.GetBadaoStandarPrediction(target,
                                                         new List <Vector2>()
                {
                    target.ServerPosition.ToVector2(), dashDtata.Path.Last()
                }, dashDtata.Speed);
                if (result.Hitchance >= HitChance.High)
                {
                    result.Hitchance = HitChance.Dashing;
                }
            }
            else
            {
                //Unit is immobile.
                var remainingImmobileT = UnitIsImmobileUntil(target);
                if (remainingImmobileT >= 0d)
                {
                    var timeToReachTargetPosition = spell.Delay + target.Position.ToVector2().Distance(spell.From.ToVector2()) / spell.Speed;
                    if (spell.RangeCheckFrom.ToVector2().Distance(target.Position.ToVector2()) <= spell.Range)
                    {
                        if (timeToReachTargetPosition <=
                            remainingImmobileT + (target.BoundingRadius + spell.Width - 40) / target.MoveSpeed)
                        {
                            result = new PredictionOutput
                            {
                                CastPosition = target.ServerPosition,
                                UnitPosition = target.ServerPosition,
                                Hitchance    = HitChance.Immobile
                            };
                        }

                        else
                        {
                            result = new PredictionOutput
                            {
                                CastPosition = target.ServerPosition,
                                UnitPosition = target.ServerPosition,
                                Hitchance    = HitChance.High
                                               /*timeToReachTargetPosition - remainingImmobileT + input.RealRadius / input.Unit.MoveSpeed < 0.4d ? HitChance.High : HitChance.Medium*/
                            }
                        };
                    }
                    else
                    {
                        result = new PredictionOutput();
                    }
                }
            }
            //Normal prediction
            if (result == null)
            {
                result = spell.GetBadaoStandarPrediction(target, target.GetWaypoints());
            }
            //Check for collision
            if (spell.Collision)
            {
                var positions = new List <Vector3> {
                    result.UnitPosition, result.CastPosition, target.Position
                };
                var originalUnit = target;
                result.CollisionObjects = spell.GetCollision(positions);
                result.CollisionObjects.RemoveAll(x => x.NetworkId == originalUnit.NetworkId);
                result.Hitchance = result.CollisionObjects.Count > 0 ? HitChance.Collision : result.Hitchance;
            }
            //Check yasuo wall collision
            else if (collideyasuowall)
            {
                var positions = new List <Vector3> {
                    result.UnitPosition, result.CastPosition, target.Position
                };
                var originalUnit = target;
                result.CollisionObjects = spell.GetCollision(positions);
                result.CollisionObjects.Any(x => x.NetworkId == ObjectManager.Player.NetworkId);
                result.Hitchance = result.CollisionObjects.Any(x => x.NetworkId == ObjectManager.Player.NetworkId) ? HitChance.Collision : result.Hitchance;
            }
            return(result);
        }
コード例 #40
0
        internal static PredictionOutput WayPointAnalysis(PredictionOutput result, PredictionInput input)
        {
            if (!input.Unit.IsValid<Obj_AI_Hero>())
            {
                result.Hitchance = HitChance.VeryHigh;
                return result;
            }

            result.Hitchance = HitChance.High;

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

            double angleMove = 30 + (input.Radius / 15);
            float BackToFront = input.Unit.MoveSpeed * totalDelay * 1.5f;
            float pathMinLen = 500f + BackToFront;

            if (UnitTracker.GetLastNewPathTime(input.Unit) < 0.1d)
            {
                BackToFront = input.Unit.MoveSpeed * totalDelay;
                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() > 1)
                {
                    result.Hitchance = HitChance.Medium;
                }
                else 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 && UnitTracker.GetLastAutoAttackTime(input.Unit) < 0.1d)
                    result.Hitchance = HitChance.VeryHigh;
                else if (totalDelay < 1.1 && UnitTracker.GetLastNewPathTime(input.Unit) < 0.1d)
                    result.Hitchance = HitChance.VeryHigh;
            }

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

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

            if (UnitTracker.GetLastAutoAttackTime(input.Unit) < 0.1d)
            {
                if (totalDelay < 0.7)
                    result.Hitchance = HitChance.High;
                else
                    result.Hitchance = HitChance.Medium;
            }

            if (result.Hitchance != HitChance.Medium)
            {
                if (input.Unit.IsWindingUp && UnitTracker.GetLastAutoAttackTime(input.Unit) > 0.1d)
                {
                    result.Hitchance = HitChance.Medium;
                }

                if (input.Unit.Path.Count() == 0 && input.Unit.Position != input.Unit.ServerPosition)
                    result.Hitchance = HitChance.Medium;

                if (input.Unit.Path.Count() > 0)
                {
                    if (input.Unit.Distance(LastWaypiont) < BackToFront || input.Unit.Position == input.Unit.ServerPosition)
                    {
                        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;
        }