public static void CastSpell(Spell QWER, AIBaseClient target)
        {
            var predIndex = 0;
            var hitchance = HitChance.Low;

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

            if (predIndex == 3)
            {
                if (QWER.Type == SkillshotType.Circle)
                {
                    Core.PredictionAio.CCast(QWER, target, hitchance);
                }
                else if (QWER.Type == SkillshotType.Line)
                {
                    Core.PredictionAio.LCast(QWER, target, hitchance);
                }
                else if (QWER.Type == SkillshotType.Cone)
                {
                    Core.PredictionAio.ConeCast(QWER, target, hitchance);
                }
                else
                {
                    QWER.CastIfHitchanceMinimum(target, hitchance);
                }
            }
            else if (predIndex == 2)
            {
                if (target is AIHeroClient)
                {
                    QWER.SPredictionCast(target as AIHeroClient, hitchance);
                }
                else
                {
                    QWER.CastIfHitchanceMinimum(target, hitchance);
                }
            }
            else if (predIndex == 1)
            {
                var aoe = false;

                if (QWER.Type == SkillshotType.Circle)
                {
                    aoe = true;
                }

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

                var predInput = new SpellPrediction.PredictionInput
                {
                    Aoe            = aoe,
                    Collision      = QWER.Collision,
                    Speed          = QWER.Speed,
                    Delay          = QWER.Delay,
                    Range          = QWER.Range,
                    From           = Player.PreviousPosition,
                    RangeCheckFrom = Player.PreviousPosition,
                    Radius         = QWER.Width,
                    Unit           = target,
                    Type           = QWER.Type
                };

                var predOutput = SpellPrediction.GetPrediction(predInput);

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

                if (predOutput.Hitchance >= hitchance)
                {
                    QWER.Cast(predOutput.CastPosition);
                }

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

                DrawSpellPos = predOutput;
            }
            else if (predIndex == 0)
            {
                QWER.CastIfHitchanceMinimum(target, hitchance);
            }
        }
Exemple #2
0
        private static void EcomboCastPostion(AIHeroClient aiheroClient_0)
        {
            Vector3 vector  = Vector3.Zero;
            Vector3 vector2 = Vector3.Zero;

            if (!Extensions.IsValidTarget(aiheroClient_0, E.Range, true))
            {
                aiheroClient_0 = TargetSelector.GetTarget(E.Range, false);
            }
            if (aiheroClient_0 != null && !aiheroClient_0.HasBuffOfType(BuffType.SpellImmunity) && !aiheroClient_0.HasBuffOfType(BuffType.SpellShield))
            {
                SpellPrediction.PredictionOutput prediction = E.GetPrediction(aiheroClient_0);
                if (prediction.Hitchance >= HitChance.High)
                {
                    if (objPlayer.HasBuff("IreliaE"))
                    {
                        Geometry.Circle circle = new Geometry.Circle(ObjectManager.Player.Position, 730);
                        foreach (Vector2 vector3 in circle.Points.Where(i => i.DistanceToPlayer() < 775
                                                                        //&& (
                                                                        //((aiheroClient_0.DistanceToPlayer() > 264 && aiheroClient_0.DistanceToPlayer() < 424) ? i.DistanceToPlayer() / 2000 <= prediction.CastPosition.DistanceToPlayer() / 1600 + 0.2 : i.DistanceToPlayer() / 2000 <= prediction.CastPosition.DistanceToPlayer() / 1600 + 0.4)
                                                                        //&& ((aiheroClient_0.DistanceToPlayer() < 504 && aiheroClient_0.DistanceToPlayer() > 424) ? i.DistanceToPlayer() / 2000 <= prediction.CastPosition.DistanceToPlayer() / 1600 + 0.1 : i.DistanceToPlayer() / 2000 <= prediction.CastPosition.DistanceToPlayer() / 1600 + 0.4)
                                                                        //&& ((aiheroClient_0.DistanceToPlayer() > 504) ? i.DistanceToPlayer() / 2000 <= prediction.CastPosition.DistanceToPlayer() / 1600 + 0.05 : i.DistanceToPlayer() / 2000 <= prediction.CastPosition.DistanceToPlayer() / 1600 + 0.4)
                                                                        //)
                                                                        ))
                        {
                            var projectionInfo = prediction.CastPosition.ProjectOn(vector3.ToVector3(), ECatPos);
                            if (projectionInfo.IsOnSegment && projectionInfo.LinePoint.Distance(prediction.CastPosition) <= 50)
                            {
                                vector  = vector3.ToVector3();
                                vector2 = ECatPos;
                            }
                        }
                        if (vector.DistanceToPlayer() <= E.Range)
                        {
                            if (vector != Vector3.Zero && vector2 != Vector3.Zero && Extensions.Distance(vector, vector2) > 200)
                            {
                                if (objPlayer.HasBuff("IreliaE"))
                                {
                                    E.Cast(vector, false);
                                }
                                else
                                {
                                    return;
                                }
                            }
                            else
                            {
                                return;
                            }
                        }
                    }
                    else
                    {
                        Geometry.Circle circle = new Geometry.Circle(ObjectManager.Player.Position, 450);
                        foreach (Vector2 vector3 in circle.Points)
                        {
                            foreach (Vector2 vector4 in circle.Points)
                            {
                                var projectionInfo = prediction.CastPosition.ProjectOn(vector3.ToVector3(), vector4.ToVector3());
                                if (projectionInfo.IsOnSegment && projectionInfo.LinePoint.Distance(aiheroClient_0.Position) <= 120 && projectionInfo.LinePoint.Distance(prediction.CastPosition) <= 120)
                                {
                                    vector  = Extensions.ToVector3(vector3, 0f);
                                    vector2 = Extensions.ToVector3(vector4, 0f);
                                }
                            }
                        }
                        if (Extensions.DistanceToPlayer(vector) <= E.Range && Extensions.DistanceToPlayer(vector2) <= E.Range)
                        {
                            if (vector.Distance(vector2) > 100 && vector != Vector3.Zero && vector2 != Vector3.Zero)
                            {
                                if (!objPlayer.HasBuff("IreliaE") && vector2.Distance(aiheroClient_0) > 100)
                                {
                                    E.Cast(vector2, false);
                                }
                                else
                                {
                                    return;
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #3
0
        static void Clear()
        {
            var minions = GameObjects.EnemyMinions.Where(x => x.IsValidTarget(Q1.Range) && x.IsMinion());

            var mobs = GameObjects.Jungle.Where(x => x.IsValidTarget(Q1.Range));

            var lMobs = GameObjects.Jungle.Where(x => x.IsValidTarget(Q1.Range) && x.GetJungleType() == JungleType.Legendary);

            var bMobs = GameObjects.Jungle.Where(x => x.IsValidTarget(Q1.Range) && x.GetJungleType() == JungleType.Large);

            IEnumerable <AIMinionClient> targets;

            if (minions.Any())
            {
                targets = minions;
            }
            else if (lMobs.Any())
            {
                targets = lMobs;
            }
            else if (bMobs.Any())
            {
                targets = bMobs;
            }
            else
            {
                targets = mobs;
            }

            if (targets.Any())
            {
                if (laneclear.check("LQ") && Q1.IsReady() && !(laneclear.check("LQCLOSE") && !targets.Any(x => x.DistanceToPlayer() < 350)))
                {
                    foreach (var minion in targets)
                    {
                        SpellPrediction.PredictionOutput pred = null;

                        if (minion.DistanceToPlayer() < Q2.Range)
                        {
                            if (HealthPrediction.GetPrediction(minion, 250) < 5)
                            {
                                continue;
                            }

                            pred = Q2.GetPrediction(minion, true);
                            Q2.Cast(pred.CastPosition);
                        }
                        else
                        {
                            if (HealthPrediction.GetPrediction(minion, minion.qtt(Q1.Speed, 250)) < 5)
                            {
                                continue;
                            }

                            pred = Q2.GetPrediction(minion);
                            Q1.Cast(pred.CastPosition);
                        }
                    }
                }

                if (laneclear.check("LW") && W.IsReady() && targets.Count(x => x.DistanceToPlayer() < W.Range) > slider(laneclear, "LWMIN"))
                {
                    W.Cast();
                }

                if (laneclear.check("LE") && E.IsReady() && targets.Where(x => x.DistanceToPlayer() < E.Range).Count() > slider(laneclear, "LEMIN"))
                {
                    foreach (var minion in targets)
                    {
                        if (myhero.Position.Extend(minion.Position, E.Range + 400f).IsUnderEnemyTurret())
                        {
                            continue;
                        }
                        var pred = E.GetPrediction(minion, false, -1, CollisionObjects.Minions);

                        if (pred.CollisionObjects.Count() > slider(laneclear, "LEMIN"))
                        {
                            E.Cast(minion);
                        }
                    }
                }
            }
        }