Example #1
0
        public static bool Cast(this Spells spell, Vector3 from, Vector3 rangecheckfrom, Obj_AI_Base ToTarget, Spells.HitChances minhitchance = Spells.HitChances.VeryLow, bool UseExtendRadiusSSCirle = true)
        {
            if (spell.spellslot.IsReady())
            {
                if (GetHiChance(from, ToTarget, spell) >= spell.MinHitChance && GetHiChance(from, ToTarget, spell) >= minhitchance)
                {
                    Vector3 y = new Vector3(0, 0, 0);
                    Vector3 pos = Predictions.GetPrediction(from, ToTarget, spell, true);
                    if (rangecheckfrom.Distance(pos) <= spell.range && pos != y)
                    {
                        if (spell.collision == false)
                            return Player.Spellbook.CastSpell(spell.spellslot, pos);
                        else
                        {
                            List<Obj_AI_Base> list = Collisions.GetCollision(from, pos, spell);

                            if (list.Count == 0 || spell == Lux.Q && list.Count <= 1)
                            {
                                Vector3 pos1 = Predictions.GetPrediction(from, ToTarget, spell);
                                return Player.Spellbook.CastSpell(spell.spellslot, pos1);
                            }
                            else return false;
                        }
                    }
                    else if (UseExtendRadiusSSCirle == true && spell.skillshottype == SkillshotType.SkillshotCircle)
                    {
                        Spells x = new Spells(spell.spellslot, spell.skillshottype, spell.range + spell.radius - 20, spell.delay, 20, false, spell.speed);
                        Vector3 y1 = new Vector3(0, 0, 0);
                        Vector3 pos1 = Predictions.GetPrediction(from, ToTarget, x, true);
                        if (rangecheckfrom.Distance(pos1) <= x.range && pos1 != y1)
                        {
                            var pos2 = Player.Position.Extend(pos1, spell.range);
                            return Player.Spellbook.CastSpell(spell.spellslot, pos2);
                        }
                        else return false;
                    }
                    else return false;
                }
                else return false;
            }
            else return false;
        }
 public static Vector3 GetPrediction(Vector3 from, Obj_AI_Base target, Spells spell)
 {
     Vector3 chuot = Prediction.GetPrediction(target, 1).CastPosition;
     float dis = from.Distance(target.Position);
     float rad = target.BoundingRadius + spell.radius - 50;
     double x = math.t(target.MoveSpeed, spell.speed, dis, spell.delay + Game.Ping / 2 / 1000, rad, from, target.Position, chuot);
     if (x != 0 && !target.IsDashing()) { return target.Position.Extend(chuot, (float)x * target.MoveSpeed - rad); }
     else return target.Position;
 }
        public static List<Obj_AI_Base> GetCollision(Vector3 from, Vector3 to, Spells spell)
        {
            var result = new List<Obj_AI_Base>();
            var list = new List<CollisionableObjects>(); list.Add(CollisionableObjects.Minions); list.Add(CollisionableObjects.YasuoWall);
            float time = spell.delay + Game.Ping / 2 / 1000 + from.Distance(to) / spell.speed;
            foreach (var objectType in list)
            {
                switch (objectType)
                {
                    case CollisionableObjects.Minions:
                        foreach (var minion in
                            ObjectManager.Get<Obj_AI_Minion>()
                                .Where(
                                    minion =>
                                        minion.IsValidTarget(
                                            Math.Min(spell.range + spell.radius + 100, 2000), true,
                                            from)))
                        {
                            //var chuot = Prediction.GetPrediction(minion, 100).CastPosition;
                            //float y = minion.MoveSpeed * 100 / 1000;
                            //bool moving = !(minion.Distance(chuot) < y);
                            //var minionPrediction = moving == false ? minion.Position : minion.Position.Extend(chuot, time * minion.MoveSpeed);
                            var minionPrediction = Prediction.GetPrediction(minion, time * 1000).UnitPosition;
                            if (
                                minionPrediction.To2D()
                                    .Distance(from.To2D(), to.To2D(), true, true) <=
                                Math.Pow((spell.radius * 2 + 15 + minion.BoundingRadius), 2) ||
                                minion.Position.To2D().Distance(from.To2D(), to.To2D(), true, true) <=
                                Math.Pow((spell.radius * 2 + 15 + minion.BoundingRadius), 2))
                            {
                                result.Add(minion);
                            }
                        }
                        break;
                    //case CollisionableObjects.Heroes:
                    //    foreach (var hero in
                    //        HeroManager.Enemies.FindAll(
                    //            hero =>
                    //                hero.IsValidTarget(
                    //                    Math.Min(input.Range + input.Radius + 100, 2000), true, input.RangeCheckFrom))
                    //        )
                    //    {
                    //        input.Unit = hero;
                    //        var prediction = Prediction.GetPrediction(input, false, false);
                    //        if (
                    //            prediction.UnitPosition.To2D()
                    //                .Distance(input.From.To2D(), position.To2D(), true, true) <=
                    //            Math.Pow((input.Radius + 50 + hero.BoundingRadius), 2))
                    //        {
                    //            result.Add(hero);
                    //        }
                    //    }
                    //    break;

                    //case CollisionableObjects.Walls:
                    //    var step = position.Distance(input.From) / 20;
                    //    for (var i = 0; i < 20; i++)
                    //    {
                    //        var p = input.From.To2D().Extend(position.To2D(), step * i);
                    //        if (NavMesh.GetCollisionFlags(p.X, p.Y).HasFlag(CollisionFlags.Wall))
                    //        {
                    //            result.Add(ObjectManager.Player);
                    //        }
                    //    }
                    //    break;

                    case CollisionableObjects.YasuoWall:

                        if (Utils.TickCount - _wallCastT > 4000)
                        {
                            break;
                        }

                        GameObject wall = null;
                        foreach (var gameObject in
                            ObjectManager.Get<GameObject>()
                                .Where(
                                    gameObject =>
                                        gameObject.IsValid &&
                                        Regex.IsMatch(
                                            gameObject.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase))
                            )
                        {
                            wall = gameObject;
                        }
                        if (wall == null)
                        {
                            break;
                        }
                        var level = wall.Name.Substring(wall.Name.Length - 6, 1);
                        var wallWidth = (300 + 50 * Convert.ToInt32(level));

                        var wallDirection =
                            (wall.Position.To2D() - _yasuoWallCastedPos).Normalized().Perpendicular();
                        var wallStart = wall.Position.To2D() + wallWidth / 2f * wallDirection;
                        var wallEnd = wallStart - wallWidth * wallDirection;

                        if (wallStart.Intersection(wallEnd, to.To2D(), from.To2D()).Intersects)
                        {
                            var t = Utils.TickCount +
                                    (wallStart.Intersection(wallEnd, to.To2D(), from.To2D())
                                        .Point.Distance(from) / spell.speed + spell.delay) * 1000;
                            if (t < _wallCastT + 4000)
                            {
                                result.Add(ObjectManager.Player);
                            }
                        }

                        break;
                }
            }

            return result.Distinct().ToList();
        }
 //public Predictions (Obj_AI_Base dasher,Dash.DashItem args)
 //{
 //    Dasher = dasher;
 //    Args = args;
 //}
 //public Obj_AI_Base Dasher { get; set; }
 //public Dash.DashItem Args { get; set; }
 //private static List<Predictions> Dashes;
 //static Predictions()
 //{
 //     CustomEvents.Unit.OnDash += OnDash;
 //     foreach (var x in Dashes)
 //     {
 //         if (Utils.TickCount - Game.Ping/2 >= x.Args.EndTick) Dashes.Remove(x);
 //     }
 //}
 //public static void OnDash(Obj_AI_Base sender, Dash.DashItem args)
 //{
 //    if (sender.IsEnemy) Dashes.Add(new Predictions(sender,args));
 //}
 //public static Vector3 GetPrediction(Vector3 from, Obj_AI_Base target, Spells spell, bool DashPredict, bool Immobile)
 //{
 //    if (target.HasBuffOfType(BuffType.Knockup) || target.HasBuffOfType(BuffType.Snare) || target.HasBuffOfType(BuffType.Stun) && Immobile == true && !target.IsDashing())
 //    {
 //        float time = CastSpell.GetImmobileTime(target);
 //        if (time / 1000 + (spell.radius + target.BoundingRadius - 20) / target.MoveSpeed >= spell.delay + Game.Ping / 2 / 1000 + from.Distance(target.Position) / spell.speed)
 //            return target.Position;
 //        else { return GetPrediction(from, target, spell); }
 //    }
 //    else
 //    {
 //        if (DashPredict == false) { return GetPrediction(from, target, spell); }
 //        else if (!target.IsDashing()) { return GetPrediction(from, target, spell); }
 //        else
 //        {
 //            Predictions x = null;
 //            foreach (var y in Dashes) { if (y.Dasher.Name == target.Name)x = y; }
 //            if (x == null) { return GetPrediction(from, target, spell); }
 //            else
 //            {
 //                if (Utils.TickCount + Game.Ping / 2 + spell.delay * 1000 + (from.To2D().Distance(x.Args.EndPos) / spell.speed) * 1000 <= x.Args.EndTick)
 //                {
 //                    Vector3 chuot = x.Args.EndPos.To3D();
 //                    float dis = from.Distance(target.Position);
 //                    float rad = target.BoundingRadius + spell.radius - 20;
 //                    double z = math.t(x.Args.Speed, spell.speed, dis, spell.delay + Game.Ping / 2 / 1000, rad, from, target.Position, chuot);
 //                    if (z != 0) { return target.Position.Extend(chuot, (float)z * x.Args.Speed - rad); }
 //                    else return new Vector3(0, 0, 0);
 //                }
 //                else { return GetPrediction(from, target, spell); }
 //            }
 //        }
 //    }
 //}
 public static Vector3 GetPrediction(Vector3 from, Obj_AI_Base target, Spells spell, bool Immobile)
 {
     if (target.HasBuffOfType(BuffType.Knockup) || target.HasBuffOfType(BuffType.Snare) || target.HasBuffOfType(BuffType.Stun) && Immobile == true && !target.IsDashing())
     {
         float time = CastSpell.GetImmobileTime(target);
         if (time / 1000 + (spell.radius + target.BoundingRadius - 20) / target.MoveSpeed >= spell.delay + Game.Ping / 2 / 1000 + from.Distance(target.Position) / spell.speed)
             return target.Position;
         else { return GetPrediction(from, target, spell); }
     }
     else
     {
         return GetPrediction(from, target, spell);
     }
 }
        public static List<Obj_AI_Base> GetCollisions(Vector3 from, Vector3 to, Spells spell)
        {
            var result = new List<Obj_AI_Base>();
            float t = spell.delay + Game.Ping / 2 / 1000 + from.Distance(to) / spell.speed;
            foreach (var obj in ObjectManager.Get<Obj_AI_Base>().Where(obj => obj.Type != GameObjectType.obj_AI_Turret && obj.Type != GameObjectType.obj_Building && obj.IsEnemy || obj.Team == GameObjectTeam.Neutral))
            {
                if (obj.IsMoving)
                {
                    var chuot = Prediction.GetPrediction(obj, 100).CastPosition;
                    Vector3 obj2 = obj.Position.Extend(chuot, t * obj.MoveSpeed);
                    var x = Geometry.Intersection(from.To2D(), to.To2D(), obj.Position.To2D(), obj2.To2D());
                    if (x.Intersects == true) result.Add(obj);
                    else
                    {
                        Vector2 y;
                        double d; math.FindDistanceToSegment(obj2.To2D(), from.To2D(), to.To2D(), out y, out d);
                        if (from.To2D().Distance(y) <= from.To2D().Distance(to.To2D()) && to.To2D().Distance(y) <= from.To2D().Distance(to.To2D()))
                        { if (d <= obj.BoundingRadius + spell.radius) result.Add(obj); }
                    }
                }
                else
                {
                    Vector2 y;
                    double d; math.FindDistanceToSegment(obj.Position.To2D(), from.To2D(), to.To2D(), out y, out d);
                    if (from.To2D().Distance(y) <= from.To2D().Distance(to.To2D()) && to.To2D().Distance(y) <= from.To2D().Distance(to.To2D()))
                    { if (d <= obj.BoundingRadius + spell.radius) result.Add(obj); }
                }

            }
            GameObject wall = null;
            foreach (var gameObject in
                                ObjectManager.Get<GameObject>()
                                    .Where(
                                        gameObject =>
                                            gameObject.IsValid &&
                                            Regex.IsMatch(
                                                gameObject.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase)))
            {
                if (Utils.TickCount - _wallCastT > 4000)
                {
                    break;
                }
                wall = gameObject;
                if (wall == null)
                {
                    break;
                }
                var level = wall.Name.Substring(wall.Name.Length - 6, 1);
                var wallWidth = (300 + 50 * Convert.ToInt32(level));

                var wallDirection =
                    (wall.Position.To2D() - _yasuoWallCastedPos).Normalized().Perpendicular();
                var wallStart = wall.Position.To2D() + wallWidth / 2f * wallDirection;
                var wallEnd = wallStart - wallWidth * wallDirection;
                var x = Geometry.Intersection(wallStart, wallEnd, from.To2D(), to.To2D());
                if (x.Intersects == true) result.Add(ObjectManager.Player);
                else
                {
                    Vector2 y;
                    double d; math.FindDistanceToSegment(wallStart, from.To2D(), to.To2D(), out y, out d);
                    Vector2 y1; double d1; math.FindDistanceToSegment(wallEnd, from.To2D(), to.To2D(), out y1, out d1);
                    if (from.To2D().Distance(y) <= from.To2D().Distance(to.To2D()) && to.To2D().Distance(y) <= from.To2D().Distance(to.To2D()))
                    { if (d <= spell.radius) result.Add(ObjectManager.Player); }
                    if (from.To2D().Distance(y1) <= from.To2D().Distance(to.To2D()) && to.To2D().Distance(y1) <= from.To2D().Distance(to.To2D()))
                    { if (d1 <= spell.radius) result.Add(ObjectManager.Player); }

                }

            }
            return result.Distinct().ToList();
        }
Example #6
0
        public static void OnLoad(EventArgs args)
        {
            Printmsg("Sucessfully loaded - Patch: " + Game.Version);
            Printmsg("Assembly Version: 1.0.0.2 Test-Version [Please PM any bugs/glitches to ScienceARK]");
            Console.WriteLine("Cheerloader Lux loaded.");

            Q1 = new Spell(SpellSlot.Q, 1300);
            W1 = new Spell(SpellSlot.W, 1075);
            E1 = new Spell(SpellSlot.E, 1100);
            R1 = new Spell(SpellSlot.R, 3300);

            Q1.SetSkillshot(0.25f, 110f, 1300f, false, SkillshotType.SkillshotLine);
            W1.SetSkillshot(0.25f, 110f, 1200f, false, SkillshotType.SkillshotLine);
            E1.SetSkillshot(0.25f, 275f, 1100f, false, SkillshotType.SkillshotCircle);
            R1.SetSkillshot(1f, 190f, float.MaxValue, false, SkillshotType.SkillshotLine);

            Q = new Extensions.Spells(SpellSlot.Q, SkillshotType.SkillshotLine, 1300, 0.25f, 70, true, 1100f);
            E = new Extensions.Spells(SpellSlot.E, SkillshotType.SkillshotCircle, 1300, 0.25f, 275, false, 1300f);
            W = new Extensions.Spells(SpellSlot.W, SkillshotType.SkillshotLine, 1075, 0.25f, 70, false, 1200f);
            R = new Extensions.Spells(SpellSlot.R, SkillshotType.SkillshotLine, 3300, 1f, 190, false, float.MaxValue);

            #region Menu

            Config = new Menu("Cheerleader Lux", "Lux", true);
            TargetSelector.AddToMenu(Config.AddSubMenu(new Menu("Target Selector", "Target Selector")));
            Orbwalker = new Orbwalking.Orbwalker(Config.AddSubMenu(new Menu("Orbwalker Settings", "Orbwalker Settings")));
            var combo = Config.AddSubMenu(new Menu("Combat Settings", "Combat Settings"));
            var prediction = Config.AddSubMenu(new Menu("Prediction Settings", "Prediction Settings"));
            var farm = Config.AddSubMenu(new Menu("Farm Settings", "Farm Settings"));
            var lane = farm.AddSubMenu(new Menu("Laneclear Settings", "Laneclear Farm Settings"));
            var jungle = farm.AddSubMenu(new Menu("Jungleclear Settings", "Jungleclear Settings"));
            var misc = Config.AddSubMenu(new Menu("Misc Settings", "Misc Settings"));
            var drawing = Config.AddSubMenu(new Menu("Draw Settings", "Draw Settings"));

            Config.AddItem(new MenuItem("blank1", "                          "));

            Config.AddItem(new MenuItem("blank3", "Made by ScienceARK").SetFontStyle(System.Drawing.FontStyle.Bold));

            //Combo Menu
            var Rsettings = combo.AddSubMenu(new Menu("Advanced [R] Settings", "advR").SetFontStyle(System.Drawing.FontStyle.Bold));
            Rsettings.AddItem(new MenuItem("advanced.R.aoe", "Use [R] on X amount of Enemies").SetValue(true));
            Rsettings.AddItem(new MenuItem("advanced.R.aoe.count", "Enemy Count").SetValue(new Slider(3, 5, 1)));
            combo.AddItem(new MenuItem("combo.Q", "Use Q").SetValue(true));
            combo.AddItem(new MenuItem("combo.W", "Use W").SetValue(true));
            combo.AddItem(new MenuItem("combo.E", "Use E").SetValue(true));
            combo.AddItem(new MenuItem("combo.R", "Use R").SetValue(true));

            //Harras Menu
            var Harass = combo.AddSubMenu(new Menu("Harass Settings", "harras").SetFontStyle(System.Drawing.FontStyle.Bold));
            Harass.AddItem(new MenuItem("harass.support", "Disable Autoattack").SetValue(false));
            Harass.AddItem(new MenuItem("harass.mana.slider", "Enemy Count").SetValue(new Slider(3, 5, 1)));
            Harass.AddItem(new MenuItem("harass.Q", "Use [Q] in Harass").SetValue(true));
            Harass.AddItem(new MenuItem("harass.E", "Use [E] in Harass").SetValue(true));
            //AutoSpells
            var autospells = combo.AddSubMenu(new Menu("Auto Spell Settings", "ASS").SetFontStyle(System.Drawing.FontStyle.Bold));
            autospells.AddItem(new MenuItem("autospells.E.aoe", "Auto [E] on X amount of Enemies").SetValue(true));
            autospells.AddItem(new MenuItem("autospells.E.aoe.count", "Enemy Count").SetValue(new Slider(3, 5, 1)));
            autospells.AddItem(new MenuItem("autospells.W.aoe", "Auto [W] on X amount of allies").SetValue(true));
            autospells.AddItem(new MenuItem("autospells.W.aoe.count", "Ally Count").SetValue(new Slider(3, 5, 1)));
            autospells.AddItem(new MenuItem("autospells.Q", "Auto [Q] on CC'd enemies").SetValue(true));

            //Drawings
            var dmgdraw = drawing.AddSubMenu(new Menu("Damage Indicator Settings", "DMGI"));
            dmgdraw.AddItem(new MenuItem("drawing.dmg", "[Damage Indicator]:").SetValue(new StringList(new[] { "Custom", "Common" })));
            dmgdraw.AddItem(new MenuItem("drawing.dmg.color", "Color").SetValue(new Circle(true, System.Drawing.Color.Orange)));

            var miscdraw = drawing.AddSubMenu(new Menu("Misc Drawings", "MiscD"));
            miscdraw.AddItem(new MenuItem("drawing.minimap", "Draw Lux [R] Minimap Range").SetValue(true));
            miscdraw.AddItem(new MenuItem("draw.LuxE.position", "Draw Lux [E] Position").SetValue(true));
            miscdraw.AddItem(new MenuItem("drawing.indicator", "Draw Enemy Indicator").SetValue(true));
            miscdraw.AddItem(new MenuItem("print.debug.chat", "Print Debug Messages").SetValue(true));

            drawing.AddItem(new MenuItem("disable.draws", "Disable all Drawings").SetValue(false));
            drawing.AddItem(new MenuItem("draw.Q", "Draw Q Range").SetValue(new Circle(true, System.Drawing.Color.Gray)));
            drawing.AddItem(new MenuItem("draw.W", "Draw W Range").SetValue(new Circle(true, System.Drawing.Color.DodgerBlue)));
            drawing.AddItem(new MenuItem("draw.E", "Draw E Range").SetValue(new Circle(true, System.Drawing.Color.LightBlue)));
            drawing.AddItem(new MenuItem("draw.R", "Draw R Range").SetValue(new Circle(true, System.Drawing.Color.CornflowerBlue)));

            //laneclear
            lane.AddItem(new MenuItem("laneclear.level", "Don't use abilities till level").SetValue(new Slider(8, 18, 1)));
            lane.AddItem(new MenuItem("laneclear.mana.slider", "Player Mana Percentage").SetValue(new Slider(75, 100, 0)));
            lane.AddItem(new MenuItem("laneclear.Q", "Use Q").SetValue(true));
            lane.AddItem(new MenuItem("laneclear.Q.count", "[Q] Minions Hit").SetValue(new Slider(2, 2, 1)));
            lane.AddItem(new MenuItem("laneclear.E", "Use E").SetValue(true));
            lane.AddItem(new MenuItem("laneclear.E.count", "[E] Minions Hit").SetValue(new Slider(3, 10, 1)));

            jungle.AddItem(new MenuItem("jungle.mana.slider", "Player Mana Percentage").SetValue(new Slider(25, 100, 0)));
            lane.AddItem(new MenuItem("jungle.Q", "Use Q").SetValue(true));
            lane.AddItem(new MenuItem("jungle.E", "Use E").SetValue(true));

            //Misc
            misc.AddItem(new MenuItem("antigap.Q", "Anti-Gapcloser [Q]").SetValue(true));
            misc.AddItem(new MenuItem("anti.rengar", "Anti-Rengar [Q]").SetValue(true));
            misc.AddItem(new MenuItem("anti.khazix", "Anti-Khazix [Q]").SetValue(true));

            var skin = misc.AddSubMenu(new Menu("Skin Manager", "Skin Manager"));
            skin.AddItem(new MenuItem("skinmanager", "Use Skin Changer").SetValue(false));
            skin.AddItem(new MenuItem("skinmanager.skin", "Skin choice").SetValue(new StringList(new[]
            { "Classic", "Sorceress", "Spellthief", "Imperial", "Commando", "Steel Legion", "Star Guardian" })));

            //Prediction

            prediction.AddItem(new MenuItem("prediction.draw", "Draw Prediction Line").SetValue(false));
            prediction.AddItem(new MenuItem("prediction.Q", "[Q] Hitchance").SetValue(
                    new StringList(new[] { HitChance.Low.ToString(), HitChance.Medium.ToString(), HitChance.High.ToString(), HitChance.VeryHigh.ToString() }, 3)));
            prediction.AddItem(new MenuItem("prediction.E", "[E] Hitchance").SetValue(
                    new StringList(new[] { HitChance.Low.ToString(), HitChance.Medium.ToString(), HitChance.High.ToString(), HitChance.VeryHigh.ToString() }, 3)));
            prediction.AddItem(new MenuItem("prediction.R", "[R] Hitchance").SetValue(
                    new StringList(new[] { HitChance.Low.ToString(), HitChance.Medium.ToString(), HitChance.High.ToString(), HitChance.VeryHigh.ToString() }, 3)));
            prediction.AddItem(new MenuItem("ayy", "Modified LeagueSharp.Common Prediction"));
            prediction.AddItem(new MenuItem("ayy2", "Credits: Badao"));

            Config.AddToMainMenu();

            #endregion Menu

            Game.OnUpdate += OrbwalkerModes;
            Game.OnUpdate += RefreshObjects;
            Game.OnUpdate += AutoSpells;
            Obj_AI_Base.OnProcessSpellCast += Wlogic;
            AntiGapcloser.OnEnemyGapcloser += Antigapcloser;
            Orbwalking.BeforeAttack += SupportMode;
            GameObject.OnCreate += EisGone;
            GameObject.OnCreate += EisAlive;
            Obj_AI_Base.OnProcessSpellCast += Tickcount;
            Drawing.OnDraw += Drawings;
            Extensions.Drawmethods.DrawEvent();
        }
Example #7
0
 public static Spells.HitChances GetHiChance(Vector3 From, Obj_AI_Base target, Spells spell)
 {
     if (target == null) return Spells.HitChances.Notarget;
     else
     {
         //Game.PrintChat("1");
         if (target.HasBuffOfType(BuffType.Knockup) || target.HasBuffOfType(BuffType.Snare) || target.HasBuffOfType(BuffType.Stun))
         {
             //Game.PrintChat("2");
             float time = GetImmobileTime(target) - Utils.TickCount;
             if (time / 1000 + (spell.radius + target.BoundingRadius - 20) / target.MoveSpeed >= spell.delay + Game.Ping / 2 / 1000 + From.Distance(target.Position) / spell.speed)
                 return Spells.HitChances.Immobile;
             else return Spells.HitChances.VeryLow;
         }
         else
         {
             //Game.PrintChat("3");
             var predict = Prediction.GetPrediction(target, 100).CastPosition;
             float y = target.MoveSpeed * 100 / 1000;
             bool moving = !(target.Distance(predict) < y);
             var chuot = moving == false ? target.Position : target.Position.Extend(predict, y);
             if (chuot == target.Position) return Spells.HitChances.VeryLow;
             else
             {
                 //Game.PrintChat("4");
                 var cosB = math.CosB(From, target.Position, chuot);
                 var gocB = Math.Acos(cosB) * (180 / Math.PI);
                 if (gocB <= 40) { return Spells.HitChances.VeryHigh; }
                 else if (gocB <= 90) return Spells.HitChances.High;
                 else if (gocB <= 165) return Spells.HitChances.Medium;
                 else return Spells.HitChances.Low;
             }
         }
     }
 }
Example #8
0
 public static bool Cast(this Spells spell, Obj_AI_Base ToTarget, Spells.HitChances minhitchance = Spells.HitChances.VeryLow)
 {
     return Cast(spell, Player.Position, ToTarget, minhitchance);
 }
Example #9
0
        public static bool Cast(this Spells spell, bool DragSpell, Vector3 from, Obj_AI_Base ToTarget, Spells.HitChances minhitchance = Spells.HitChances.VeryLow, bool UseExtendRadiusSSCirle = true)
        {
            if (spell.spellslot.IsReady())
            {
                if (GetHiChance(from, ToTarget, spell) >= spell.MinHitChance && GetHiChance(from, ToTarget, spell) >= minhitchance)
                {
                    Vector3 y = new Vector3(0, 0, 0);
                    Vector3 pos = Predictions.GetPrediction(from, ToTarget, spell, true);
                    if (Player.Distance(from) <= spell.range && from.Distance(pos) <= spell.extrarange && pos != y)
                    {
                        if (spell.collision == false)
                            return Player.Spellbook.CastSpell(spell.spellslot, from, pos);
                        else
                        {
                            List<Obj_AI_Base> list = Collisions.GetCollision(from, pos, spell);
                            if (list.Count == 0 || spell == Lux.Q && list.Count <= 1)
                            {
                                Vector3 pos1 = Predictions.GetPrediction(from, ToTarget, spell);
                                return Player.Spellbook.CastSpell(spell.spellslot, from, pos1);
                            }
                            else return false;
                        }
                    }

                    else return false;
                }
                else return false;
            }
            else return false;
        }