Exemple #1
0
 private void WOnOnSpellCasted(Spell.SpellBase spell, GameObjectProcessSpellCastEventArgs args)
 {
     WArea = new Geometry.Polygon.Circle(args.Start,W.Range);
     var timer = new Timer
     {
         Interval = Math.Max(0, Player.Instance.GetBuff( /*Todo Passive name*/"").EndTime - Game.Time)*100
     };
     timer.Start();
     timer.Elapsed += TimerOnElapsed;
 }
Exemple #2
0
        private static void GameObject_OnCreate(GameObject sender, EventArgs args)
        {
            var missile = sender as MissileClient;
            if (missile == null) return;

            var missileInfo =
                SpellDatabase.GetSpellInfoList(missile.SpellCaster).FirstOrDefault(s => s.RealSlot == missile.Slot);
            if (missileInfo == null) return;

            switch (missileInfo.Type)
            {
                case SpellType.Self:
                    break;
                case SpellType.Circle:
                    var polCircle = new Geometry.Polygon.Circle(missile.Position, missileInfo.Radius);
                    Missiles.Add(missile, polCircle);
                    break;
                case SpellType.Line:
                    var polLine = new Geometry.Polygon.Rectangle(missile.StartPosition,
                        missile.StartPosition.Extend(missile.EndPosition, missileInfo.Range).To3D(), 5);
                    Missiles.Add(missile, polLine);
                    break;
                case SpellType.Cone:
                    var polCone = new Geometry.Polygon.Sector(missile.StartPosition, missile.EndPosition, missileInfo.Radius, missileInfo.Range, 80);
                    Missiles.Add(missile, polCone);
                    break;
                case SpellType.Ring:
                    break;
                case SpellType.Arc:
                    break;
                case SpellType.MissileLine:
                    var polMissileLine = new Geometry.Polygon.Rectangle(missile.StartPosition,
                        missile.StartPosition.Extend(missile.EndPosition, missileInfo.Range).To3D(), 5);
                    Missiles.Add(missile, polMissileLine);
                    break;
                case SpellType.MissileAoe:
                    var polMissileAoe = new Geometry.Polygon.Rectangle(missile.StartPosition,
                        missile.StartPosition.Extend(missile.EndPosition, missileInfo.Range).To3D(), 5);
                    Missiles.Add(missile, polMissileAoe);
                    break;
            }

            var polygons = new List<Geometry.Polygon>();
            polygons.AddRange(Missiles.Values);

            Joined = polygons.JoinPolygons();
        }
Exemple #3
0
        /// <summary>
        ///     Melee Champions Logic.
        /// </summary>
        public static Vector3 MeleeLogic()
        {
            var AllySpawn = ObjectsManager.AllySpawn;

            // if there is a TeamFight follow NearestEnemy.
            var NearestEnemy = ObjectsManager.NearestEnemy;

            if (Brain.TeamFightActive && Player.Instance.PredictHealthPercent() > 20 && !(ModesManager.CurrentMode == ModesManager.Modes.None || ModesManager.CurrentMode == ModesManager.Modes.Flee) &&
                NearestEnemy != null && NearestEnemy.TeamTotal() >= NearestEnemy.TeamTotal(true) &&
                NearestEnemy.CountAllyHeros(SafeValue) > 1)
            {
                // if there is a TeamFight move from NearestEnemy to nearestally.
                if (ObjectsManager.SafestAllyToFollow != null)
                {
                    var pos = NearestEnemy.KitePos(ObjectsManager.SafestAllyToFollow);
                    if (Player.Instance.SafePath(pos))
                    {
                        Program.Moveto = "NearestEnemyToNearestAlly";
                        Position       = pos;
                        return(pos);
                    }
                }

                // if there is a TeamFight move from NearestEnemy to AllySpawn.
                if (AllySpawn != null)
                {
                    var pos = NearestEnemy.KitePos(AllySpawn);
                    if (Player.Instance.SafePath(pos))
                    {
                        Program.Moveto = "NearestEnemyToAllySpawn";
                        Position       = pos;
                        return(Position);
                    }
                }
            }

            // Tower Defence
            var FarthestAllyTurret = ObjectsManager.FarthestAllyTurret;

            if (Player.Instance.IsUnderHisturret() && FarthestAllyTurret != null && Player.Instance.PredictHealthPercent() >= 20 &&
                !(ModesManager.CurrentMode == ModesManager.Modes.None || ModesManager.CurrentMode == ModesManager.Modes.Flee))
            {
                if (FarthestAllyTurret.CountEnemyHeros((int)FarthestAllyTurret.GetAutoAttackRange(Player.Instance) + 50) > 0)
                {
                    var enemy = EntityManager.Heroes.Enemies.OrderBy(o => o.Distance(AllySpawn)).FirstOrDefault(e => e.IsKillable(3000) &&
                                                                                                                e.TeamTotal() >= e.TeamTotal(true) && (e.CountAllyHeros(SafeValue) > 1 || e.CountEnemyHeros(SafeValue) < 2) && e.UnderEnemyTurret());
                    if (enemy != null && enemy.UnderEnemyTurret())
                    {
                        Program.Moveto = "EnemyUnderTurret";
                        Position       = enemy.KitePos(AllySpawn);
                        return(Position);
                    }
                }
            }

            var NearestEnemyObject = ObjectsManager.NearestEnemyObject;

            // if Can AttackObject then start attacking THE DAMN OBJECT FFS.
            if (NearestEnemyObject != null && Player.Instance.PredictHealthPercent() > 20 && ModesManager.AttackObject &&
                (NearestEnemyObject.Position.TeamTotal() > NearestEnemyObject.Position.TeamTotal(true) ||
                 NearestEnemyObject.CountEnemyHeros(SafeValue + 100) == 0))
            {
                var extendto = new Vector3();
                if (AllySpawn != null)
                {
                    extendto = AllySpawn.Position;
                }
                if (ObjectsManager.NearestMinion != null)
                {
                    extendto = ObjectsManager.NearestMinion.Position;
                }
                if (ObjectsManager.NearestAlly != null)
                {
                    extendto = ObjectsManager.NearestAlly.Position;
                }
                var extendtopos = NearestEnemyObject.KitePos(extendto);
                var rect        = new Geometry.Polygon.Rectangle(Player.Instance.ServerPosition, NearestEnemyObject.Position, 400);
                var Enemy       = EntityManager.Heroes.Enemies.Any(a => a != null && a.IsValid && a.TeamTotal(true) > a.TeamTotal() && !a.IsDead && new Geometry.Polygon.Circle(a.PredictPosition(), a.GetAutoAttackRange(Player.Instance)).Points.Any(p => rect.IsInside(p)));
                if (!Enemy)
                {
                    if (ObjectsManager.EnemyTurret != null)
                    {
                        var TurretCircle = new Geometry.Polygon.Circle(ObjectsManager.EnemyTurret.ServerPosition, ObjectsManager.EnemyTurret.GetAutoAttackRange(Player.Instance));


                        if (NearestEnemyObject.IsTurret())
                        {
                            if (SafeToDive)
                            {
                                Program.Moveto = "NearestEnemyObject";
                                Position       = extendtopos;
                                return(Position);
                            }
                        }
                        if (!TurretCircle.Points.Any(p => rect.IsInside(p)))
                        {
                            Program.Moveto = "NearestEnemyObject2";
                            Position       = extendtopos;
                            return(Position);
                        }
                    }
                    else
                    {
                        Program.Moveto = "NearestEnemyObject3";
                        Position       = extendtopos;
                        return(Position);
                    }
                }
            }

            // if NearestEnemyMinion exsists moves to NearestEnemyMinion.
            if (ObjectsManager.NearestEnemyMinion != null && AllySpawn != null && ModesManager.LaneClear && Player.Instance.PredictHealthPercent() > 25)
            {
                Program.Moveto = "NearestEnemyMinion";
                Position       = ObjectsManager.NearestEnemyMinion.PredictPosition().Extend(AllySpawn.Position.Random(), KiteDistance(ObjectsManager.NearestEnemyMinion)).To3D();
                return(Position);
            }

            // if SafestAllyToFollow not exsist picks other to follow.
            if (ObjectsManager.SafestAllyToFollow != null)
            {
                // if SafestAllyToFollow exsist follow BestAllyToFollow.
                Program.Moveto = "SafestAllyToFollow";
                Position       = ObjectsManager.SafestAllyToFollow.PredictPosition().Random();
                return(Position);
            }

            // if Minion exsists moves to Minion.
            if (ObjectsManager.AllyMinion != null)
            {
                Program.Moveto = "AllyMinion";
                Position       = ObjectsManager.AllyMinion.PredictPosition().Random();
                return(Position);
            }

            // if FarthestAllyToFollow exsists moves to FarthestAllyToFollow.
            if (ObjectsManager.FarthestAllyToFollow != null)
            {
                Program.Moveto = "FarthestAllyToFollow";
                Position       = ObjectsManager.FarthestAllyToFollow.PredictPosition().Random();
                return(Position);
            }

            // if SecondTurret exsists moves to SecondTurret.
            if (ObjectsManager.SecondTurret != null)
            {
                Program.Moveto = "SecondTurret";
                Position       = ObjectsManager.SecondTurret.PredictPosition().Extend(AllySpawn, 400).To3D().Random();
                return(Position);
            }

            // if SafeAllyTurret exsists moves to SafeAllyTurret.
            if (ObjectsManager.SafeAllyTurret != null)
            {
                Program.Moveto = "SafeAllyTurret";
                Position       = ObjectsManager.SafeAllyTurret.ServerPosition.Extend(AllySpawn, 400).To3D().Random();
                return(Position);
            }

            // if ClosesetAllyTurret exsists moves to ClosesetAllyTurret.
            if (ObjectsManager.ClosesetAllyTurret != null)
            {
                Program.Moveto = "ClosesetAllyTurret";
                Position       = ObjectsManager.ClosesetAllyTurret.ServerPosition.Extend(AllySpawn, 400).To3D().Random();
                return(Position);
            }

            // Well if it ends up like this then best thing is to let it end.
            if (AllySpawn != null)
            {
                Program.Moveto = "AllySpawn3";
                Position       = AllySpawn.Position.Random();
                return(Position);
            }
            return(Vector3.Zero);
        }
        private Tuple <int, Vector3> BestQPosition(Obj_AI_Base target, List <Obj_AI_Base> targets, HitChance hitChance)
        {
            var castPos   = Vector3.Zero;
            var totalHits = 0;

            try
            {
                var enemies        = targets.Where(e => e.IsValidTarget(Q.Range * 1.5f)).ToList();
                var enemyPositions = new List <Tuple <Obj_AI_Base, Vector3> >();
                var circle         = new Geometry.Polygon.Circle(Player.Position, Player.BoundingRadius, 30).Points;

                foreach (var h in enemies)
                {
                    var ePred = Q.GetPrediction(h);
                    if (ePred.Hitchance >= hitChance)
                    {
                        circle.Add(Player.Position.Extend(ePred.UnitPosition, Player.BoundingRadius).To2D());
                        enemyPositions.Add(new Tuple <Obj_AI_Base, Vector3>(h, ePred.UnitPosition));
                    }
                }
                var targetPos = target?.Position ?? Vector3.Zero;
                if (target == null)
                {
                    var possibilities = ListExtensions.ProduceEnumeration(enemyPositions).Where(p => p.Count > 0).ToList();
                    var count         = 0;
                    foreach (var possibility in possibilities)
                    {
                        var mec = MEC.GetMec(possibility.Select(p => p.Item2.To2D()).ToList());
                        if (mec.Radius < Q.Width && possibility.Count > count)
                        {
                            count     = possibility.Count;
                            targetPos = mec.Center.To3D();
                        }
                    }
                }
                if (targetPos.Equals(Vector3.Zero))
                {
                    return(new Tuple <int, Vector3>(totalHits, castPos));
                }
                circle = circle.OrderBy(c => c.Distance(targetPos)).ToList();
                if (!enemyPositions.Any())
                {
                    return(new Tuple <int, Vector3>(totalHits, castPos));
                }

                foreach (var point in circle)
                {
                    var hits           = 0;
                    var containsTarget = false;
                    var direction      = Q.Range * (point.To3D() - Player.Position).Normalized().To2D();
                    var rect1          = new Geometry.Polygon.Rectangle(
                        Player.Position, Player.Position.Extend(Player.Position + direction.To3D(), Q.Range), Q.Width);
                    var rect2 = new Geometry.Polygon.Rectangle(
                        Player.Position,
                        Player.Position.Extend(Player.Position + direction.Rotated(QAngle).To3D(), Q.Range), Q.Width);
                    var rect3 = new Geometry.Polygon.Rectangle(
                        Player.Position,
                        Player.Position.Extend(Player.Position + direction.Rotated(-QAngle).To3D(), Q.Range), Q.Width);
                    foreach (var enemy in enemyPositions)
                    {
                        var bounding = new Geometry.Polygon.Circle(enemy.Item2, enemy.Item1.BoundingRadius * 0.85f);
                        if (bounding.Points.Any(p => rect1.IsInside(p) || rect2.IsInside(p) || rect3.IsInside(p)))
                        {
                            hits++;
                            if (target != null && enemy.Item1.NetworkId.Equals(target.NetworkId))
                            {
                                containsTarget = true;
                            }
                        }
                    }
                    if ((containsTarget || target == null) && hits > totalHits)
                    {
                        totalHits = hits;
                        castPos   = Player.Position.Extend(point.To3D(), Q.Range);
                        if (totalHits >= enemies.Count)
                        {
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(new Tuple <int, Vector3>(totalHits, castPos));
        }
Exemple #5
0
        public static Result Circle(Spell spell, Obj_AI_Hero target, HitChance hitChance, bool boundingRadius = true)
        {
            try
            {
                if (spell == null || target == null)
                {
                    return(new Result(Vector3.Zero, new List <Obj_AI_Hero>()));
                }
                var hits   = new List <Obj_AI_Hero>();
                var center = Vector3.Zero;
                var radius = float.MaxValue;
                var range  = spell.Range + (spell.Width * 0.85f) +
                             (boundingRadius ? target.BoundingRadius * BoundingRadiusMultiplicator : 0);
                var positions = (from t in GameObjects.EnemyHeroes
                                 where t.IsValidTarget(range * 1.5f, true, spell.RangeCheckFrom)
                                 let prediction = spell.GetPrediction(t)
                                                  where prediction.Hitchance >= hitChance
                                                  select new Position(t, prediction.UnitPosition)).ToList();
                var spellWidth = spell.Width;
                //+ (boundingRadius ? positions.Select(p => p.Hero).Min(p => p.BoundingRadius) : 0);
                if (positions.Any())
                {
                    var mainTarget    = positions.FirstOrDefault(p => p.Hero.NetworkId == target.NetworkId);
                    var possibilities =
                        ListExtensions.ProduceEnumeration(
                            positions.Where(
                                p => p.UnitPosition.Distance(mainTarget.UnitPosition) <= spell.Width * 0.85f).ToList())
                        .Where(p => p.Count > 0 && p.Any(t => t.Hero.NetworkId == mainTarget.Hero.NetworkId))
                        .ToList();
                    foreach (var possibility in possibilities)
                    {
                        var mec      = MEC.GetMec(possibility.Select(p => p.UnitPosition.To2D()).ToList());
                        var distance = spell.From.Distance(mec.Center.To3D());
                        if (mec.Radius < spellWidth && distance < range)
                        {
                            var lHits  = new List <Obj_AI_Hero>();
                            var circle =
                                new Geometry.Polygon.Circle(
                                    spell.From.Extend(
                                        mec.Center.To3D(), spell.Range > distance ? distance : spell.Range), spell.Width);

                            if (boundingRadius)
                            {
                                lHits.AddRange(
                                    (from position in positions
                                     where
                                     new Geometry.Polygon.Circle(
                                         position.UnitPosition,
                                         (position.Hero.BoundingRadius * BoundingRadiusMultiplicator)).Points.Any
                                         (p => circle.IsInside(p))
                                     select position.Hero));
                            }
                            else
                            {
                                lHits.AddRange(
                                    from position in positions
                                    where circle.IsInside(position.UnitPosition)
                                    select position.Hero);
                            }

                            if ((lHits.Count > hits.Count || lHits.Count == hits.Count && mec.Radius < radius ||
                                 lHits.Count == hits.Count &&
                                 spell.From.Distance(circle.Center.To3D()) < spell.From.Distance(center)) &&
                                lHits.Any(p => p.NetworkId == target.NetworkId))
                            {
                                center = circle.Center.To3D2();
                                radius = mec.Radius;
                                hits.Clear();
                                hits.AddRange(lHits);
                            }
                        }
                    }
                    if (!center.Equals(Vector3.Zero))
                    {
                        return(new Result(center, hits));
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(new Result(Vector3.Zero, new List <Obj_AI_Hero>()));
        }
Exemple #6
0
        public static Vector3 GetTumblePos(this Obj_AI_Base target)
        {

            if (target.IsFacing(Player.Instance))
            {
                return target.ServerPosition.Shorten(Player.Instance.ServerPosition, 300);
            }
            else
            {
                var aRc = new Geometry.Polygon.Circle(Player.Instance.ServerPosition.To2D(), 300).ToClipperPath();
                var cursorPos = Game.CursorPos;
                var targetPosition = target.ServerPosition;
                var pList = new List<Vector3>();
                var additionalDistance = (0.106 + Game.Ping / 2000f) * target.MoveSpeed;
                foreach (var v3 in aRc.Select(p => new Vector2(p.X, p.Y).To3D()))
                {
                    if (target.IsFacing(Player.Instance))
                    {
                        if (v3.Distance(targetPosition) < 350) pList.Add(v3);
                    }
                    else
                    {
                        if (v3.Distance(targetPosition) < 350 - additionalDistance) pList.Add(v3);
                    }
                }
                return pList.Count > 1
                    ? pList.OrderByDescending(el => el.Distance(cursorPos)).FirstOrDefault()
                    : Vector3.Zero;
            }
        }
Exemple #7
0
        // TODO PRIORITY: MEDIUM - LOW
        /// <summary>
        ///     Removes every PathBase that intersects with a skillshot
        /// </summary>
        public void RemovePathesThroughSkillshots(List <Skillshot> skillshots)
        {
            if (GlobalVariables.Debug)
            {
                Console.WriteLine($"GridGenerator.Cs > RemovePathesThroughSkillshots() > {skillshots.Count}");
            }

            if (this.Grid?.Connections == null || !this.Grid.Connections.Any() || this.Grid.Points == null)
            {
                return;
            }

            var skillshotDict = new Dictionary <Skillshot, Geometry.Polygon>();

            if (skillshots.Any())
            {
                foreach (var skillshot in skillshots)
                {
                    var polygon = new Geometry.Polygon();

                    switch (skillshot.SData.SpellType)
                    {
                    case LeagueSharp.Data.Enumerations.SpellType.SkillshotLine:
                        polygon = new Geometry.Polygon.Rectangle(
                            skillshot.StartPosition,
                            skillshot.EndPosition,
                            skillshot.SData.Radius);
                        break;

                    case LeagueSharp.Data.Enumerations.SpellType.SkillshotCircle:
                        polygon = new Geometry.Polygon.Circle(skillshot.EndPosition, skillshot.SData.Radius);
                        break;

                    case LeagueSharp.Data.Enumerations.SpellType.SkillshotArc:
                        polygon = new Geometry.Polygon.Sector(
                            skillshot.StartPosition,
                            skillshot.Direction,
                            skillshot.SData.Angle,
                            skillshot.SData.Radius);
                        break;
                    }

                    skillshotDict.Add(skillshot, polygon);
                }
            }

            if (skillshotDict.Any())
            {
                foreach (var skillshot in skillshotDict)
                {
                    //foreach (var point in Grid.Points.ToList())
                    //{
                    //    if (skillshot.Value.IsInside(point.Position))
                    //    {
                    //        Grid?.Points?.Remove(point);
                    //    }
                    //}

                    foreach (var connection in
                             this.Grid.Connections.Where(x => x is YasuoDashConnection))
                    {
                        var clipperpath       = skillshot.Value.ToClipperPath();
                        var connectionpolygon = new Geometry.Polygon.Line(
                            connection.Start.Position,
                            connection.End.Position);
                        var connectionclipperpath = connectionpolygon.ToClipperPath();

                        if (clipperpath.Intersect(connectionclipperpath).Any())
                        {
                            Console.WriteLine(@"Removing YasuoConnection");
                            this.Grid?.Connections?.Remove(connection);
                        }
                    }
                }
            }

            this.RemoveDisconnectedConnections();
        }
        private static void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (Player.Instance.IsDead || !Settings.UseSeraph || !Program.Seraph.IsOwned() || !Program.Seraph.IsReady())
                return;

            if (sender.IsMe)
                return;

            var heroSender = sender as AIHeroClient;
            var target = args.Target as AIHeroClient;

               if (heroSender != null && target != null && target.IsMe)
            {
                IncomingDamages.Add(new IncomingDamageArgs
                {
                    Sender = heroSender,
                    Target = target,
                    Tick = (int)Game.Time * 1000,
                    Damage = heroSender.GetSpellDamage(target, args.Slot),
                    IsTargetted = true
                });
            }
            if (heroSender != null && target == null)
            {
                if (args.SData.TargettingType == SpellDataTargetType.LocationAoe)
                {
                    {
                        var polygon = new Geometry.Polygon.Circle(args.End, args.SData.CastRadius);
                        var polygon2 = new Geometry.Polygon.Circle(args.End, args.SData.CastRadiusSecondary);
                        if (polygon.IsInside(Player.Instance) || polygon2.IsInside(Player.Instance))
                        {
                            IncomingDamages.Add(new IncomingDamageArgs
                            {
                                Sender = heroSender,
                                Target = Player.Instance,
                                IsSkillShot = true,
                                Damage =
                                    heroSender.GetSpellDamage(Player.Instance,
                                        heroSender.GetSpellSlotFromName(args.SData.Name)),
                                Tick = (int) Game.Time*1000,
                                IsTargetted = false,
                                IsTurretShot = false
                            });
                        }
                    }
                }
                else if (args.SData.TargettingType == SpellDataTargetType.Location ||
                         args.SData.TargettingType == SpellDataTargetType.Location2 ||
                         args.SData.TargettingType == SpellDataTargetType.Location3 ||
                         args.SData.TargettingType == SpellDataTargetType.LocationVector ||
                         args.SData.TargettingType == SpellDataTargetType.LocationVector ||
                         args.SData.TargettingType == SpellDataTargetType.LocationVector)
                {
                    var range = SpellDatabase.GetSpellInfoList(heroSender).FirstOrDefault();
                    var polygon = new Geometry.Polygon.Rectangle(args.Start.To2D(),
                        args.Start.Extend(args.End, range?.Range ?? 1), args.SData.LineWidth);

                    if (polygon.IsInside(Player.Instance))
                    {
                        IncomingDamages.Add(new IncomingDamageArgs
                        {
                            Sender = heroSender,
                            Target = Player.Instance,
                            IsSkillShot = true,
                            Tick = (int) Game.Time*1000,
                            Damage =
                                heroSender.GetSpellDamage(Player.Instance,
                                    heroSender.GetSpellSlotFromName(args.SData.Name)),
                            IsTargetted = false,
                            IsTurretShot = false
                        });
                    }
                }
            }
        }
Exemple #9
0
        private static Vector3 GetAggressiveTumblePos(this Obj_AI_Base target)
        {
            var cursorPos = Game.CursorPos;

            if (!cursorPos.IsDangerousPosition()) return cursorPos;
            //if the target is not a melee and he's alone he's not really a danger to us, proceed to 1v1 him :^ )
            if (!target.IsMelee && Variables._Player.CountEnemiesInRange(800) == 1) return cursorPos;

            var aRC = new Geometry.Polygon.Circle(Variables._Player.ServerPosition.To2D(), 300).ToClipperPath();
            var targetPosition = target.ServerPosition;

            foreach (var p in aRC)
            {
                var v3 = new Vector2(p.X, p.Y).To3D();
                var dist = v3.Distance(targetPosition);
                if (dist > 325 && dist < 450)
                {
                    return v3;
                }
            }
            return Vector3.Zero;
        }
Exemple #10
0
        public Skillshot(DetectionType detectionType, SpellData spellData, int startT, Vector2 start, Vector2 end, Obj_AI_Base unit)
        {
            DetectionType   = detectionType;
            SpellData       = spellData;
            StartTick       = startT;
            Start           = start;
            End             = end;
            MissilePosition = start;
            Direction       = (end - start).Normalized();

            Unit = unit;
            if (ObjectManager.GetLocalPlayer().ChampionName == "Janna" ||
                ObjectManager.GetLocalPlayer().ChampionName == "Rakan" || ObjectManager.GetLocalPlayer().ChampionName == "Ivern" ||
                ObjectManager.GetLocalPlayer().ChampionName == "Lulu" ||
                ObjectManager.GetLocalPlayer().ChampionName == "Karma")
            {
                bestAllies = GameObjects.AllyHeroes
                             .Where(t =>
                                    t.Distance(ObjectManager.GetLocalPlayer()) < Support_AIO.Bases.Champion.E.Range)
                             .OrderBy(x => x.Health);
            }
            if (ObjectManager.GetLocalPlayer().ChampionName == "Lux" ||
                ObjectManager.GetLocalPlayer().ChampionName == "Sona" ||
                ObjectManager.GetLocalPlayer().ChampionName == "Taric")

            {
                bestAllies = GameObjects.AllyHeroes
                             .Where(t =>
                                    t.Distance(ObjectManager.GetLocalPlayer()) < Support_AIO.Bases.Champion.W.Range)
                             .OrderBy(x => x.Health);
            }
            foreach (var ally in bestAllies)
            {
                switch (spellData.Type)
                {
                case SkillShotType.SkillshotCircle:
                    Circle = new Geometry.Polygon.Circle(CollisionEnd, spellData.Radius, 22);
                    break;

                case SkillShotType.SkillshotLine:
                    Rectangle = new Geometry.Polygon.Rectangle(Start, CollisionEnd, spellData.Radius);
                    break;

                case SkillShotType.SkillshotMissileLine:
                    Rectangle = new Geometry.Polygon.Rectangle(Start, CollisionEnd, spellData.Radius);
                    break;

                case SkillShotType.SkillshotCone:
                    Sector = new Geometry.Polygon.Sector(
                        start, CollisionEnd - start, spellData.Radius * (float)Math.PI / 180, spellData.Range, 22);
                    break;

                case SkillShotType.SkillshotRing:
                    Ring = new Geometry.Polygon.Ring(CollisionEnd, spellData.Radius, spellData.RingRadius, 22);
                    break;

                case SkillShotType.SkillshotArc:
                    Arc = new Geometry.Polygon.Arc(start, end,
                                                   EvadeManager.SkillShotsExtraRadius + (int)ally.BoundingRadius, 22);
                    break;
                }
            }
            UpdatePolygon();
        }
Exemple #11
0
        private void Orbwalker_OnPostAttack(AttackableUnit target, System.EventArgs args)
        {
            var hero = target as AIHeroClient;

            if (hero == null || hero.IsDead || hero.IsZombie ||
                !Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo) ||
                (Tumble.To2StacksOnly && hero.GetSilverStacks() != 1))
            {
                Orbwalker.OnPostAttack -= Orbwalker_OnPostAttack;
                return;
            }

            var unit =
                EntityManager.Heroes.Enemies.Where(
                    index => index.IsValidTarget(Player.Instance.GetAutoAttackRange() + 300))
                .OrderBy(by => by.Distance(Player.Instance.Position.ExtendPlayerVector()))
                .FirstOrDefault();

            if (unit == null)
            {
                Orbwalker.OnPostAttack -= Orbwalker_OnPostAttack;
                return;
            }

            if (Tumble.Mode == 1)
            {
                var polygons  = Helpers.SegmentedAutoattackPolygons();
                var positions = new List <IEnumerable <Vector2> >();
                var enemies   = Player.Instance.CountEnemiesInRange(1200);

                for (var i = 0; i < 4; i++)
                {
                    positions.Add(
                        polygons[i].Points.Where(
                            e =>
                            e.ToVector3().ExtendPlayerVector().IsPositionSafe() &&
                            e.ToVector3().ExtendPlayerVector().Distance(unit, true) > (enemies <= 2 ? 150 * 150 : 300 * 300)));
                }

                foreach (var points in positions)
                {
                    if (unit.Distance(Player.Instance.ServerPosition, true) < 425 * 425 && unit.Health > Player.Instance.GetAutoAttackDamage(unit) + (Player.Instance.GetAutoAttackDamage(unit) + Player.Instance.GetAutoAttackDamage(unit) * Helpers.QAdditionalDamage[Q.Level]))
                    {
                        foreach (var point in points.OrderByDescending(index => index.Distance(unit, true)))
                        {
                            if (Tumble.BlockQIfEnemyIsOutsideAaRange)
                            {
                                var polygon = new Geometry.Polygon.Circle(point.ToVector3().GetTumbleEndPos(),
                                                                          Player.Instance.GetAutoAttackRange());

                                if (polygon.IsInside(unit))
                                {
                                    Q.Cast(point.To3DWorld().ExtendPlayerVector(250));
                                }
                            }
                            else
                            {
                                Q.Cast(point.To3DWorld().ExtendPlayerVector(250));
                            }
                        }
                    }
                    else
                    {
                        foreach (var point in points.OrderBy(index => index.Distance(unit, true)))
                        {
                            if (Tumble.BlockQIfEnemyIsOutsideAaRange)
                            {
                                var polygon = new Geometry.Polygon.Circle(point.ToVector3().GetTumbleEndPos(),
                                                                          Player.Instance.GetAutoAttackRange());

                                if (polygon.IsInside(unit))
                                {
                                    Q.Cast(point.To3DWorld().ExtendPlayerVector(250));
                                }
                            }
                            else
                            {
                                Q.Cast(point.To3DWorld().ExtendPlayerVector(250));
                            }
                        }
                    }
                }
            }
            else
            {
                if (Game.CursorPos.GetTumbleEndPos().IsPositionSafe())
                {
                    Q.Cast(Game.CursorPos.ExtendPlayerVector(250));
                }
            }
            Orbwalker.OnPostAttack -= Orbwalker_OnPostAttack;
        }
Exemple #12
0
        private static void AIHeroClient_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo))
            {
                if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass))
                {
                    if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.LaneClear))
                    {
                        if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Flee))
                        {
                            if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.None))
                            {
                                if ((args.Slot == SpellSlot.Q || args.Slot == SpellSlot.W || args.Slot == SpellSlot.E ||
                                     args.Slot == SpellSlot.R) && sender.IsEnemy && W.IsReady())
                                {
                                    if (args.SData.TargettingType == SpellDataTargetType.Unit ||
                                        args.SData.TargettingType == SpellDataTargetType.SelfAndUnit ||
                                        args.SData.TargettingType == SpellDataTargetType.Self)
                                    {
                                        if ((args.Target.NetworkId == Player.NetworkId && args.Time < 1.5 ||
                                             args.End.Distance(Player.ServerPosition) <= Player.BoundingRadius * 3) &&
                                            VladimirTheTrollMeNu.EvadeMenu[args.SData.Name].Cast <CheckBox>()
                                            .CurrentValue)
                                        {
                                            W1.Cast();
                                        }
                                    }
                                    else if (args.SData.TargettingType == SpellDataTargetType.LocationAoe)
                                    {
                                        var castvector =
                                            new Geometry.Polygon.Circle(args.End, args.SData.CastRadius).IsInside(
                                                Player.ServerPosition);

                                        if (castvector &&
                                            VladimirTheTrollMeNu.EvadeMenu[args.SData.Name].Cast <CheckBox>()
                                            .CurrentValue)
                                        {
                                            W1.Cast();
                                        }
                                    }

                                    else if (args.SData.TargettingType == SpellDataTargetType.Cone)
                                    {
                                        var castvector =
                                            new Geometry.Polygon.Arc(args.Start, args.End, args.SData.CastConeAngle,
                                                                     args.SData.CastRange)
                                            .IsInside(Player.ServerPosition);

                                        if (castvector &&
                                            VladimirTheTrollMeNu.EvadeMenu[args.SData.Name].Cast <CheckBox>()
                                            .CurrentValue)
                                        {
                                            W1.Cast();
                                        }
                                    }

                                    else if (args.SData.TargettingType == SpellDataTargetType.SelfAoe)
                                    {
                                        var castvector =
                                            new Geometry.Polygon.Circle(sender.ServerPosition, args.SData.CastRadius)
                                            .IsInside(
                                                Player.ServerPosition);

                                        if (castvector &&
                                            VladimirTheTrollMeNu.EvadeMenu[args.SData.Name].Cast <CheckBox>()
                                            .CurrentValue)
                                        {
                                            W1.Cast();
                                        }
                                    }
                                    else
                                    {
                                        var castvector =
                                            new Geometry.Polygon.Rectangle(args.Start, args.End, args.SData.LineWidth)
                                            .IsInside(
                                                Player.ServerPosition);

                                        if (castvector &&
                                            VladimirTheTrollMeNu.EvadeMenu[args.SData.Name].Cast <CheckBox>()
                                            .CurrentValue)
                                        {
                                            W1.Cast();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #13
0
        private static void UpdatePolygons()
        {
            Polygons = new List <Geometry.Polygon>();

            foreach (var myMissile in Missiles)
            {
                var missile = myMissile.Missile;
                var info    = myMissile.SpellInfo;

                // ReSharper disable once SwitchStatementMissingSomeCases
                switch (info.Type)
                {
                case SpellType.Self:
                    return;

                case SpellType.Circle:
                    var polygonCircle = new Geometry.Polygon.Circle(missile.Position,
                                                                    myMissile.SpellInfo.Radius, 80);
                    myMissile.Polygon = polygonCircle;

                    Polygons.Add(polygonCircle);
                    return;

                case SpellType.Line:
                    var polygonLine = new Geometry.Polygon.Line(missile.StartPosition, missile.EndPosition, 5f);
                    myMissile.Polygon = polygonLine;

                    Polygons.Add(polygonLine);
                    return;

                case SpellType.Cone:
                    var polygonCone = new Geometry.Polygon.Sector(missile.StartPosition, missile.EndPosition, info.Radius, info.Range, 80);
                    myMissile.Polygon = polygonCone;

                    Polygons.Add(polygonCone);
                    return;

                case SpellType.Ring:
                    return;

                case SpellType.Arc:
                    return;

                case SpellType.MissileLine:
                    var polygonMissileLine = new Geometry.Polygon.Line(missile.StartPosition, missile.EndPosition, 5f);
                    myMissile.Polygon = polygonMissileLine;

                    Polygons.Add(polygonMissileLine);
                    return;

                case SpellType.MissileAoe:
                    var polygonMissileAOE = new Geometry.Polygon.Circle(missile.EndPosition, 5f);
                    myMissile.Polygon = polygonMissileAOE;

                    Polygons.Add(polygonMissileAOE);
                    return;
                }
            }

            Polygons = Polygons.JoinPolygons();
        }
Exemple #14
0
 public Skillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit)
 {
     this.DetectionType = detectionType;
     this.SpellData = spellData;
     this.StartTick = startT;
     this.Start = start;
     this.End = end;
     this.Direction = (end - start).Normalized();
     this.Unit = unit;
     switch (spellData.Type)
     {
         case SkillShotType.SkillshotCircle:
             this.Circle = new Geometry.Polygon.Circle(this.CollisionEnd, spellData.Radius, 22);
             break;
         case SkillShotType.SkillshotLine:
         case SkillShotType.SkillshotMissileLine:
             this.Rectangle = new Geometry.Polygon.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotCone:
             this.Sector = new Geometry.Polygon.Sector(
                 start,
                 this.CollisionEnd - start,
                 spellData.Radius * (float)Math.PI / 180,
                 spellData.Range,
                 22);
             break;
         case SkillShotType.SkillshotRing:
             this.Ring = new Geometry.Polygon.Ring(this.CollisionEnd, spellData.Radius, spellData.RingRadius, 22);
             break;
         case SkillShotType.SkillshotArc:
             this.Arc = new Geometry.Polygon.Arc(
                 start,
                 end,
                 Configs.SkillShotsExtraRadius + (int)ObjectManager.Player.BoundingRadius,
                 22);
             break;
     }
     this.UpdatePolygon();
 }
Exemple #15
0
        /// <summary>
        ///     Ranged Champions Logic.
        /// </summary>
        public static bool RangedLogic()
        {
            // TeamFighting Logic.
            if (Core.GameTickCount - Brain.LastTeamFight < 1000 && Player.Instance.PredictHealthPercent() > 25 && !ModesManager.Flee && ObjectsManager.NearestEnemy != null &&
                EntityManager.Heroes.Allies.Any(a => a.IsValidTarget() && a.Distance(ObjectsManager.NearestEnemy) < Player.Instance.Distance(ObjectsManager.NearestEnemy) && !a.IsMe) &&
                TeamTotal(ObjectsManager.NearestEnemy.PredictPosition()) >= TeamTotal(ObjectsManager.NearestEnemy.PredictPosition(), true) && ObjectsManager.NearestEnemy.CountAllyHeros(SafeValue) > 1)
            {
                // if there is a TeamFight move from NearestEnemy to nearestally.
                if (ObjectsManager.SafestAllyToFollow2 != null)
                {
                    var pos = ObjectsManager.NearestEnemy.KitePos(ObjectsManager.SafestAllyToFollow2);
                    if (pos.IsSafe())
                    {
                        Program.Moveto = "NearestEnemyToNearestAlly";
                        Position       = pos;
                        return(true);
                    }
                }
                // if there is a TeamFight move from NearestEnemy to AllySpawn.
                if (ObjectsManager.AllySpawn != null)
                {
                    var pos = ObjectsManager.NearestEnemy.KitePos(ObjectsManager.AllySpawn);
                    if (pos.IsSafe())
                    {
                        Program.Moveto = "NearestEnemyToAllySpawn";
                        Position       = pos;
                        return(true);
                    }
                }
            }

            // Tower Defence
            if (Player.Instance.IsUnderHisturret() && ObjectsManager.FarthestAllyTurret != null && Player.Instance.PredictHealthPercent() >= 20)
            {
                if (ObjectsManager.FarthestAllyTurret.CountEnemyHeros((int)ObjectsManager.FarthestAllyTurret.GetAutoAttackRange() + 50) > 0)
                {
                    var enemy = EntityManager.Heroes.Enemies.OrderBy(o => o.Distance(ObjectsManager.FarthestAllyTurret)).FirstOrDefault(e => e.IsKillable(3000));
                    if (enemy != null && enemy.UnderEnemyTurret() && TeamTotal(enemy.PredictPosition()) >= TeamTotal(enemy.PredictPosition(), true))
                    {
                        Program.Moveto = "DefendingTower";
                        Position       = enemy.KitePos(ObjectsManager.AllySpawn);
                        return(true);
                    }
                }
            }

            // if Can AttackObject then start attacking THE DAMN OBJECT FFS.
            if (ObjectsManager.NearestEnemyObject != null && Player.Instance.PredictHealthPercent() > 20 && ModesManager.AttackObject &&
                (TeamTotal(ObjectsManager.NearestEnemyObject.Position) > TeamTotal(ObjectsManager.NearestEnemyObject.Position, true) || ObjectsManager.NearestEnemyObject.CountEnemyHeros(SafeValue + 100) < 1))
            {
                var extendto = new Vector3();
                if (ObjectsManager.AllySpawn != null)
                {
                    extendto = ObjectsManager.AllySpawn.Position;
                }
                if (ObjectsManager.NearestMinion != null)
                {
                    extendto = ObjectsManager.NearestMinion.Position;
                }
                if (ObjectsManager.NearestAlly != null)
                {
                    extendto = ObjectsManager.NearestAlly.Position;
                }
                var extendtopos = ObjectsManager.NearestEnemyObject.KitePos(extendto);
                var rect        = new Geometry.Polygon.Rectangle(Player.Instance.ServerPosition, ObjectsManager.NearestEnemyObject.Position, 400);
                var Enemy       = EntityManager.Heroes.Enemies.Any(a => a != null && a.IsValid && !a.IsDead && new Geometry.Polygon.Circle(a.PredictPosition(), a.GetAutoAttackRange(Player.Instance)).Points.Any(p => rect.IsInside(p)));
                if (!Enemy)
                {
                    if (ObjectsManager.EnemyTurret != null)
                    {
                        var TurretCircle = new Geometry.Polygon.Circle(ObjectsManager.EnemyTurret.ServerPosition, ObjectsManager.EnemyTurret.GetAutoAttackRange(Player.Instance));

                        if (!TurretCircle.Points.Any(p => rect.IsInside(p)))
                        {
                            if (ObjectsManager.NearestEnemyObject is Obj_AI_Turret)
                            {
                                if (SafeToDive)
                                {
                                    Program.Moveto = "NearestEnemyObject";
                                    Position       = extendtopos;
                                    return(true);
                                }
                            }
                            else
                            {
                                Program.Moveto = "NearestEnemyObject2";
                                Position       = extendtopos;
                                return(true);
                            }
                        }
                    }
                    else
                    {
                        Program.Moveto = "NearestEnemyObject3";
                        Position       = extendtopos;
                        return(true);
                    }
                }
            }

            // if SafestAllyToFollow2 exsists moves to SafestAllyToFollow2.
            if (ObjectsManager.SafestAllyToFollow2 != null)
            {
                Program.Moveto = "SafestAllyToFollow2";
                Position       = ObjectsManager.SafestAllyToFollow2.PredictPosition().Extend(ObjectsManager.AllySpawn, 100).Random();
                return(true);
            }

            // if NearestEnemyMinion exsists moves to NearestEnemyMinion.
            if (ObjectsManager.NearestEnemyMinion != null && ObjectsManager.AllySpawn != null && ModesManager.LaneClear && Player.Instance.PredictHealthPercent() > 20)
            {
                Program.Moveto = "NearestEnemyMinion";
                Position       = ObjectsManager.NearestEnemyMinion.PredictPosition().Extend(ObjectsManager.AllySpawn.Position.Random(), KiteDistance(ObjectsManager.NearestEnemyMinion)).To3D();
                return(true);
            }

            // if Minion not exsist picks other to follow.
            if (ObjectsManager.AllyMinion != null)
            {
                Program.Moveto = "AllyMinion";
                Position       = ObjectsManager.AllyMinion.PredictPosition().Extend(ObjectsManager.AllySpawn, 100).Random();
                return(true);
            }

            // if SecondTurret exsists moves to SecondTurret.
            if (ObjectsManager.SecondTurret != null)
            {
                Program.Moveto = "SecondTurret";
                Position       = ObjectsManager.SecondTurret.ServerPosition.Extend(ObjectsManager.AllySpawn, 425).To3D().Random();
                return(true);
            }

            // if SafeAllyTurret exsists moves to SafeAllyTurret.
            if (ObjectsManager.SafeAllyTurret != null)
            {
                Program.Moveto = "SafeAllyTurret";
                Position       = ObjectsManager.SafeAllyTurret.ServerPosition.Extend(ObjectsManager.AllySpawn, 425).To3D().Random();
                return(true);
            }

            // if ClosesetAllyTurret exsists moves to ClosesetAllyTurret.
            if (ObjectsManager.ClosesetAllyTurret != null)
            {
                Program.Moveto = "ClosesetAllyTurret";
                Position       = ObjectsManager.ClosesetAllyTurret.ServerPosition.Extend(ObjectsManager.AllySpawn, 425).To3D().Random();
                return(true);
            }

            // Well if it ends up like this then best thing is to let it end.
            if (ObjectsManager.AllySpawn != null)
            {
                Program.Moveto = "AllySpawn3";
                Position       = ObjectsManager.AllySpawn.Position.Random();
                return(true);
            }
            return(false);
        }
Exemple #16
0
        /// <summary>
        ///     Picking best Position to move to.
        /// </summary>
        public static void BestPosition()
        {
            if (EnableTeleport && ObjectsManager.ClosestAlly != null)
            {
                Program.Moveto = "Teleporting";
                Teleport.Cast();
            }

            // If player is Zombie moves follow nearest Enemy.
            if (Player.Instance.IsZombie())
            {
                var ZombieTarget = TargetSelector.GetTarget(1000, DamageType.True);
                if (ZombieTarget != null)
                {
                    Program.Moveto = "ZombieTarget";
                    Position       = ZombieTarget.PredictPosition();
                    return;
                }
                if (ObjectsManager.NearestEnemy != null)
                {
                    Program.Moveto = "NearestEnemy";
                    Position       = ObjectsManager.NearestEnemy.PredictPosition();
                    return;
                }
                if (ObjectsManager.NearestEnemyMinion != null)
                {
                    Program.Moveto = "NearestEnemyMinion";
                    Position       = ObjectsManager.NearestEnemyMinion.PredictPosition();
                    return;
                }
            }

            // Feeding Poros
            if (ObjectsManager.ClosesetPoro != null)
            {
                var porosnax = new Item(2052);
                if (porosnax != null && porosnax.IsOwned(Player.Instance) && porosnax.IsReady())
                {
                    porosnax.Cast(ObjectsManager.ClosesetPoro);
                    Logger.Send("Feeding ClosesetPoro");
                }
            }

            // Hunting Bard chimes kappa.
            if (PickBardChimes && ObjectsManager.BardChime != null)
            {
                Program.Moveto = "BardChime";
                Position       = ObjectsManager.BardChime.Position.Random();
                return;
            }

            // Moves to HealthRelic if the bot needs heal.
            if ((Player.Instance.PredictHealthPercent() <= HealthRelicHP || (Player.Instance.ManaPercent <= HealthRelicMP && !Player.Instance.IsNoManaHero())) && ObjectsManager.HealthRelic != null &&
                ((DontStealHR && !EntityManager.Heroes.Allies
                  .Any(a => Player.Instance.PredictHealth() > a.PredictHealth() && a.Path.LastOrDefault().IsInRange(ObjectsManager.HealthRelic, ObjectsManager.HealthRelic.BoundingRadius + a.BoundingRadius) &&
                       !a.IsMe && a.IsValidTarget())) || !DontStealHR))
            {
                var formana = Player.Instance.ManaPercent < HealthRelicMP && !Player.Instance.IsNoManaHero();
                var rect    = new Geometry.Polygon.Rectangle(Player.Instance.ServerPosition, ObjectsManager.HealthRelic.Position, 375);
                if (ObjectsManager.EnemyTurret != null)
                {
                    var Circle = new Geometry.Polygon.Circle(ObjectsManager.EnemyTurret.ServerPosition, ObjectsManager.EnemyTurret.GetAutoAttackRange());
                    if ((!Circle.Points.Any(p => rect.IsInside(p)) || Circle.Points.Any(p => rect.IsInside(p)) && SafeToDive) && !EntityManager.Heroes.Enemies.Any(e => rect.IsInside(e.PredictPosition()) && e.IsValid && !e.IsDead))
                    {
                        if (ObjectsManager.HealthRelic.Name.Contains("Bard"))
                        {
                            if (!formana)
                            {
                                Program.Moveto = "BardShrine";
                                Position       = ObjectsManager.HealthRelic.Position;
                                return;
                            }
                        }
                        else
                        {
                            Program.Moveto = "HealthRelic";
                            Position       = ObjectsManager.HealthRelic.Position;
                            return;
                        }
                    }
                }
                else
                {
                    if (!EntityManager.Heroes.Enemies.Any(e => rect.IsInside(e.PredictPosition()) && e.IsValid && !e.IsDead))
                    {
                        if (ObjectsManager.HealthRelic.Name.Contains("Bard"))
                        {
                            if (!formana)
                            {
                                Program.Moveto = "BardShrine2";
                                Position       = ObjectsManager.HealthRelic.Position;
                                return;
                            }
                        }
                        else
                        {
                            Program.Moveto = "HealthRelic2";
                            Position       = ObjectsManager.HealthRelic.Position;
                            return;
                        }
                    }
                }
            }

            // Pick Thresh Lantern
            if (ObjectsManager.ThreshLantern != null)
            {
                if (Player.Instance.Distance(ObjectsManager.ThreshLantern) > 300)
                {
                    Program.Moveto = "ThreshLantern";
                    Position       = ObjectsManager.ThreshLantern.Position.Random();
                }
                else
                {
                    Program.Moveto = "ThreshLantern";
                    Player.UseObject(ObjectsManager.ThreshLantern);
                }
                return;
            }

            if (PickDravenAxe && ObjectsManager.DravenAxe != null)
            {
                Program.Moveto = "DravenAxe";
                Position       = ObjectsManager.DravenAxe.Position;
                return;
            }

            if (PickZacBlops && ObjectsManager.ZacBlop != null)
            {
                Program.Moveto = "ZacBlop";
                Position       = ObjectsManager.ZacBlop.Position;
                return;
            }

            /* fix core pls not working :pepe:
             * if (PickCorkiBomb && ObjectsManager.CorkiBomb != null)
             * {
             *  Program.Moveto = "CorkiBomb";
             *  if (Player.Instance.IsInRange(ObjectsManager.CorkiBomb, 300))
             *  {
             *      Program.Moveto = "UsingCorkiBomb";
             *      Player.UseObject(ObjectsManager.CorkiBomb);
             *  }
             *  Position = ObjectsManager.CorkiBomb.Position;
             *  return;
             * }*/

            // Moves to the Farthest Ally if the bot has Autsim
            if (Brain.Alone() && ObjectsManager.FarthestAllyToFollow != null && Player.Instance.Distance(ObjectsManager.AllySpawn) <= 3000)
            {
                Program.Moveto = "FarthestAllyToFollow";
                Position       = ObjectsManager.FarthestAllyToFollow.PredictPosition().Random();
                return;
            }

            // Stays Under tower if the bot health under 10%.
            if ((ModesManager.CurrentMode == ModesManager.Modes.Flee || (Player.Instance.PredictHealthPercent() < 10 && Player.Instance.CountAllyHeros(SafeValue + 2000) < 3)) &&
                EntityManager.Heroes.Enemies.Count(e => e.IsValid && !e.IsDead && e.IsInRange(Player.Instance, SafeValue + 200)) > 0)
            {
                if (ObjectsManager.SafeAllyTurret != null)
                {
                    Program.Moveto = "SafeAllyTurretFlee";
                    Position       = ObjectsManager.SafeAllyTurret.PredictPosition().Random().Extend(ObjectsManager.AllySpawn.Position.Random(), 400).To3D();
                    return;
                }
                if (ObjectsManager.AllySpawn != null)
                {
                    Program.Moveto = "AllySpawnFlee";
                    Position       = ObjectsManager.AllySpawn.Position.Random();
                    return;
                }
            }

            // Moves to AllySpawn if the bot is diving and it's not safe to dive.
            if (((Player.Instance.UnderEnemyTurret() && !SafeToDive) || Core.GameTickCount - Brain.LastTurretAttack < 2000) && ObjectsManager.AllySpawn != null)
            {
                Program.Moveto = "AllySpawn2";
                Position       = ObjectsManager.AllySpawn.Position.Random();
                return;
            }

            if (Player.Instance.GetAutoAttackRange() < 425)
            {
                MeleeLogic();
            }
            else
            {
                RangedLogic();
            }
        }
Exemple #17
0
        private static void AIHeroClient_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            var useW      = ComboMenu["WLowHp"].Cast <CheckBox>().CurrentValue;
            var MinHealth = ComboMenu["minHealth"].Cast <Slider>().CurrentValue;

            if (useW && !_Player.IsRecalling() && !_Player.IsInShopRange() && _Player.CountEnemiesInRange(425) >= 1)
            {
                if (Player.Instance.HealthPercent <= MinHealth)
                {
                    W.Cast();
                }
            }

            if ((args.Slot == SpellSlot.Q || args.Slot == SpellSlot.W || args.Slot == SpellSlot.E ||
                 args.Slot == SpellSlot.R) && sender.IsEnemy && Q.IsReady() && _Player.Distance(sender) <= args.SData.CastRange && Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo))
            {
                if (args.SData.TargettingType == SpellDataTargetType.Unit || args.SData.TargettingType == SpellDataTargetType.SelfAndUnit || args.SData.TargettingType == SpellDataTargetType.Self)
                {
                    if ((args.Target.NetworkId == Player.Instance.NetworkId && args.Time < 1.5 ||
                         args.End.Distance(Player.Instance.ServerPosition) <= Player.Instance.BoundingRadius * 3) &&
                        Evade[args.SData.Name].Cast <CheckBox>().CurrentValue)
                    {
                        QEvade();
                    }
                }
                else if (args.SData.TargettingType == SpellDataTargetType.LocationAoe)
                {
                    var castvector =
                        new Geometry.Polygon.Circle(args.End, args.SData.CastRadius).IsInside(
                            Player.Instance.ServerPosition);

                    if (castvector && Evade[args.SData.Name].Cast <CheckBox>().CurrentValue)
                    {
                        QEvade();
                    }
                }

                else if (args.SData.TargettingType == SpellDataTargetType.Cone)
                {
                    var castvector =
                        new Geometry.Polygon.Arc(args.Start, args.End, args.SData.CastConeAngle, args.SData.CastRange)
                        .IsInside(Player.Instance.ServerPosition);

                    if (castvector && Evade[args.SData.Name].Cast <CheckBox>().CurrentValue)
                    {
                        QEvade();
                    }
                }

                else if (args.SData.TargettingType == SpellDataTargetType.SelfAoe)
                {
                    var castvector =
                        new Geometry.Polygon.Circle(sender.ServerPosition, args.SData.CastRadius).IsInside(
                            Player.Instance.ServerPosition);

                    if (castvector && Evade[args.SData.Name].Cast <CheckBox>().CurrentValue)
                    {
                        QEvade();
                    }
                }
                else
                {
                    var castvector =
                        new Geometry.Polygon.Rectangle(args.Start, args.End, args.SData.LineWidth).IsInside(
                            Player.Instance.ServerPosition);

                    if (castvector && Evade[args.SData.Name].Cast <CheckBox>().CurrentValue)
                    {
                        QEvade();
                    }
                }

                if (args.SData.Name == "yasuoq3w")
                {
                    QEvade();
                }

                if (args.SData.Name == "ZedR")
                {
                    if (Q.IsReady())
                    {
                        Core.DelayAction(() => QEvade(), 2000 - Game.Ping - 200);
                    }
                    else
                    {
                        if (W.IsReady())
                        {
                            Core.DelayAction(() => W.Cast(), 500);
                        }
                    }
                }

                if (args.SData.Name == "KarthusFallenOne")
                {
                    Core.DelayAction(() => QEvade(), 2000 - Game.Ping - 200);
                }

                if (args.SData.Name == "SoulShackles")
                {
                    Core.DelayAction(() => QEvade(), 2000 - Game.Ping - 200);
                }

                if (args.SData.Name == "AbsoluteZero")
                {
                    Core.DelayAction(() => QEvade(), 2000 - Game.Ping - 200);
                }

                if (args.SData.Name == "NocturneUnspeakableHorror")
                {
                    Core.DelayAction(() => QEvade(), 2000 - Game.Ping - 200);
                }
            }
        }
Exemple #18
0
        private static void UpdatePolygons()
        {
            foreach (var missile in Missiles)
            {
                var missileInfo =
                    SpellDatabase.GetSpellInfoList(missile.Key.SpellCaster)
                        .FirstOrDefault(s => s.RealSlot == missile.Key.Slot);
                if (missileInfo == null) return;

                switch (missileInfo.Type)
                {
                    case SpellType.Self:
                        break;
                    case SpellType.Circle:
                        var polCircle = new Geometry.Polygon.Circle(missile.Key.Position, missileInfo.Radius);
                        Missiles[missile.Key] = polCircle;
                        break;
                    case SpellType.Line:
                        var polLine = new Geometry.Polygon.Rectangle(missile.Key.StartPosition,
                            missile.Key.StartPosition.Extend(missile.Key.EndPosition, missileInfo.Range).To3D(), 5);
                        Missiles[missile.Key] = polLine;
                        break;
                    case SpellType.Cone:
                        var polCone = new Geometry.Polygon.Sector(missile.Key.StartPosition, missile.Key.EndPosition, missileInfo.Radius, missileInfo.Range, 80);
                        Missiles[missile.Key] = polCone;
                        break;
                    case SpellType.Ring:
                        break;
                    case SpellType.Arc:
                        break;
                    case SpellType.MissileLine:
                        var polMissileLine = new Geometry.Polygon.Rectangle(missile.Key.StartPosition,
                            missile.Key.StartPosition.Extend(missile.Key.EndPosition, missileInfo.Range).To3D(), 5);
                        Missiles[missile.Key] = polMissileLine;
                        break;
                    case SpellType.MissileAoe:
                        var polMissileAoe = new Geometry.Polygon.Rectangle(missile.Key.StartPosition,
                            missile.Key.StartPosition.Extend(missile.Key.EndPosition, missileInfo.Range).To3D(), 5);
                        Missiles[missile.Key] = polMissileAoe;
                        break;
                }
            }

            var polygons = new List<Geometry.Polygon>();
            polygons.AddRange(Missiles.Values);

            Joined = polygons.JoinPolygons();
        }
        public Skillshot(DetectionType detectionType, SpellData spellData, int startT, Vector2 start, Vector2 end, AIBaseClient unit)
        {
            DetectionType   = detectionType;
            SpellData       = spellData;
            StartTick       = startT;
            Start           = start;
            End             = end;
            MissilePosition = start;
            Direction       = (Vector2)(end - start).ToVector3().Normalized();

            Unit = unit;
            //if (ObjectManager.Player.CharacterName == "Janna" ||
            //    ObjectManager.Player.CharacterName == "Rakan" || ObjectManager.Player.CharacterName == "Ivern" ||
            //    ObjectManager.Player.CharacterName == "Lulu" ||
            //    ObjectManager.Player.CharacterName == "Karma")
            //{
            //    bestAllies = GameObjects.AllyHeroes
            //        .Where(t =>
            //            t.Distance(ObjectManager.Player) < Helper.Spells[Helper.E].Range)
            //        .OrderBy(x => x.Health);
            //}
            //if (ObjectManager.Player.CharacterName == "Lux" ||
            //    ObjectManager.Player.CharacterName == "Sona" ||
            //    ObjectManager.Player.CharacterName == "Taric")

            //{
            //    bestAllies = GameObjects.AllyHeroes
            //        .Where(t =>
            //            t.Distance(ObjectManager.Player) < Helper.Spells[Helper.W].Range)
            //        .OrderBy(x => x.Health);
            //}
            foreach (var ally in bestAllies)
            {
                switch (spellData.Type)
                {
                case SpellType.SkillshotCircle:
                    Circle = new Geometry.Polygon.Circle(CollisionEnd, spellData.Radius, 22);
                    break;

                case SpellType.SkillshotLine:
                    Rectangle = new Geometry.Polygon.Rectangle(Start, CollisionEnd, spellData.Radius);
                    break;

                case SpellType.SkillshotMissileLine:
                    Rectangle = new Geometry.Polygon.Rectangle(Start, CollisionEnd, spellData.Radius);
                    break;

                case SpellType.SkillshotCone:
                    Sector = new Geometry.Polygon.Sector(
                        start, CollisionEnd - start, spellData.Radius * (float)Math.PI / 180, spellData.Range, 22);
                    break;

                case SpellType.SkillshotRing:
                    Ring = new Geometry.Polygon.Ring(CollisionEnd, spellData.Radius, spellData.RingRadius, 22);
                    break;

                case SpellType.SkillshotArc:
                    Arc = new Geometry.Polygon.Arc(start, end,
                                                   EvadeManager.SkillShotsExtraRadius + (int)ally.BoundingRadius, 22);
                    break;
                }
            }
            UpdatePolygon();
        }
Exemple #20
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static Geometry.Polygon[] SegmentedAutoattackPolygons()
        {
            var aaPolygon = new Geometry.Polygon.Circle(Player.Instance.Position,
                Player.Instance.GetAutoAttackRange(), 24);

            var points = new Vector2[24];
            var i = 0;

            foreach (var point in aaPolygon.Points)
            {
                points[i] = point;
                i++;
            }

            var polygons = new Geometry.Polygon[4];

            var dictionary = new Dictionary<int, List<Vector2>>
            {
                {
                    0, // 1
                    new List<Vector2>
                    {
                        aaPolygon.Center,
                        points[3],
                        points[4],
                        points[5],
                        points[6],
                        points[7],
                        points[8],
                        points[9]
                    }
                },
                {
                    1, // 2
                    new List<Vector2>
                    {
                        aaPolygon.Center,
                        points[9],
                        points[10],
                        points[11],
                        points[12],
                        points[13],
                        points[14],
                        points[15]
                    }
                },
                {
                    2,// Reverse 1
                    new List<Vector2>
                    {
                        aaPolygon.Center,
                        points[15],
                        points[16],
                        points[17],
                        points[18],
                        points[19],
                        points[20],
                        points[21]
                    }
                },
                {
                    3, // Reverse 2
                    new List<Vector2>
                    {
                        aaPolygon.Center,
                        points[21],
                        points[22],
                        points[23],
                        points[0],
                        points[1],
                        points[2],
                        points[3]
                    }
                }
            };

            for (var x = 0; x < 4; x++)
            {
                polygons[x] = new Geometry.Polygon();
                polygons[x].Add(dictionary[x].ToPolygon());
            }
            return polygons;
        }
Exemple #21
0
 private void TimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
 {
     Chat.Print("Teste");
     WArea = null;
 }
Exemple #22
0
        public override void Combo()
        {
            Orbwalker.ForcedTarget = null;
            if (R.IsReady() && ComboMenu.CheckBoxValue(SpellSlot.R))
            {
                R.CastAOE(ComboMenu.SliderValue("RAOE"), 3000);
            }

            var target =
                EntityManager.Heroes.Enemies.OrderByDescending(TargetSelector.GetPriority).FirstOrDefault(e => e.IsKillable() &&
                                                                                                          BarrelsList.Any(b => b.Barrel.IsValidTarget(Q.Range) && (KillableBarrel(b)?.Distance(e) <= E.Width || BarrelsList.Any(a => KillableBarrel(b)?.Distance(a.Barrel) <= ConnectionRange && e.Distance(b.Barrel) <= E.Width))))
                ?? TargetSelector.GetTarget(E.Range, DamageType.Physical);

            if (target == null || !target.IsKillable())
            {
                return;
            }

            var pred    = target.PrediectPosition((int)QTravelTime(target));
            var castpos = E.GetPrediction(target).CastPosition;

            if (AABarrel(target) != null)
            {
                var extended = AABarrel(target).ServerPosition.Extend(pred, ConnectionRange).To3D();
                castpos = !E.IsInRange(extended) ? pred : extended;
                Orbwalker.ForcedTarget = AABarrel(target);
                if (E.IsReady() && ComboMenu.CheckBoxValue(SpellSlot.E))
                {
                    if (BarrelsList.Count(b => b.Barrel.Distance(user) <= Q.Range) > 0 && BarrelsList.Count(b => b.Barrel.Distance(castpos) <= E.Width) < 1)
                    {
                        E.Cast(castpos);
                    }
                }
                Player.IssueOrder(GameObjectOrder.AttackUnit, AABarrel(target));
                return;
            }

            if (Q.IsReady())
            {
                if (ComboMenu.CheckBoxValue(SpellSlot.Q))
                {
                    if (((BarrelsList.Count(b => b.Barrel.IsInRange(target, E.Radius + ConnectionRange)) < 1 && (!E.IsReady() || E.Handle.Ammo < 1)) || Q.WillKill(target)) && target.IsKillable(Q.Range))
                    {
                        Q.Cast(target);
                    }

                    foreach (var A in BarrelsList.OrderBy(b => b.Barrel.Distance(target)))
                    {
                        if (KillableBarrel(A) != null && KillableBarrel(A).IsValidTarget(Q.Range))
                        {
                            if (pred.IsInRange(KillableBarrel(A), E.Width))
                            {
                                Q.Cast(KillableBarrel(A));
                            }

                            var Secondbarrel = BarrelsList.OrderBy(b => b.Barrel.Distance(target)).FirstOrDefault(b => b.Barrel.NetworkId != KillableBarrel(A).NetworkId&& b.Barrel.Distance(KillableBarrel(A)) <= ConnectionRange);
                            if (Secondbarrel != null)
                            {
                                if (pred.IsInRange(Secondbarrel.Barrel, E.Width))
                                {
                                    Q.Cast(KillableBarrel(A));
                                }
                                if (BarrelsList.OrderBy(b => b.Barrel.Distance(target)).Any(b => b.Barrel.NetworkId != Secondbarrel.Barrel.NetworkId && b.Barrel.Distance(Secondbarrel.Barrel) <= ConnectionRange && b.Barrel.CountEnemiesInRange(E.Width) > 0))
                                {
                                    Q.Cast(KillableBarrel(A));
                                }
                            }
                            else
                            {
                                if (BarrelsList.OrderBy(b => b.Barrel.Distance(target)).Any(b => b.Barrel.NetworkId != KillableBarrel(A).NetworkId&& b.Barrel.Distance(KillableBarrel(A)) <= ConnectionRange && b.Barrel.CountEnemiesInRange(E.Width) > 0))
                                {
                                    Q.Cast(KillableBarrel(A));
                                }
                            }
                        }
                    }
                }
                if (E.IsReady() && ComboMenu.CheckBoxValue(SpellSlot.E))
                {
                    if (BarrelsList.OrderBy(b => b.Barrel.Distance(target)).Count(b => b.Barrel.IsInRange(target, E.Width)) < 1)
                    {
                        if (BarrelsList.OrderBy(b => b.Barrel.Distance(target)).Count(b => b.Barrel.IsInRange(target, E.Radius + ConnectionRange)) > 0)
                        {
                            var targetbarrel = BarrelsList.OrderBy(b => b.Barrel.Distance(target)).FirstOrDefault(b => KillableBarrel(b) != null && (b.Barrel.IsValidTarget(Q.Range) || b.Barrel.IsValidTarget(user.GetAutoAttackRange())) && b.Barrel.IsInRange(target, E.Radius + ConnectionRange));
                            if (KillableBarrel(targetbarrel) != null)
                            {
                                var Secondbarrel = BarrelsList.OrderBy(b => b.Barrel.Distance(target)).FirstOrDefault(b => b.Barrel.NetworkId != targetbarrel?.Barrel.NetworkId && b.Barrel.Distance(targetbarrel?.Barrel) <= ConnectionRange);

                                if (Secondbarrel != null)
                                {
                                    var extended = Secondbarrel.Barrel.ServerPosition.Extend(pred, ConnectionRange).To3D();
                                    castpos = !E.IsInRange(extended) ? pred : extended;
                                }
                                if ((castpos.Distance(KillableBarrel(targetbarrel)) <= ConnectionRange || Secondbarrel?.Barrel.Distance(castpos) <= ConnectionRange) && E.IsInRange(castpos))
                                {
                                    E.Cast(castpos);
                                }
                            }
                        }
                        else
                        {
                            if (E.Handle.Ammo > 1 && ComboMenu.CheckBoxValue("FB"))
                            {
                                if (Q.IsInRange(castpos))
                                {
                                    if (HPTiming() <= 1000 || target.IsCC())
                                    {
                                        E.Cast(castpos);
                                    }
                                }
                                else
                                {
                                    if (E.IsInRange(castpos))
                                    {
                                        E.Cast(castpos.Extend(user, ConnectionRange - 300).To3D());
                                    }
                                }

                                var circle = new Geometry.Polygon.Circle(castpos, ConnectionRange);
                                foreach (var point in circle.Points)
                                {
                                    circle = new Geometry.Polygon.Circle(point, E.Width);
                                    var grass = circle.Points.OrderBy(p => p.Distance(castpos)).FirstOrDefault(p => p.IsGrass() && Q.IsInRange(p.To3D()) && p.Distance(castpos) <= ConnectionRange);
                                    if (grass != null)
                                    {
                                        E.Cast(grass.To3D());
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #23
0
        public static bool IsInDanger(this Obj_AI_Base target)
        {
            var HitBox = new Geometry.Polygon.Circle(target.PredictPosition(), target.BoundingRadius + 10);

            return(dangerPolygons.Any(s => HitBox.Points.Any(s.IsInside)));
        }
        //complete
        public static void Flee()
        {
            WallDash activeDash = null;

            if (MenuHandler.GetCheckboxValue(MenuHandler.Flee, "Wall Dash") && Program.E.IsReady() && !YasuoCalcs.IsDashing())
            {
                //walldash
                foreach (WallDash wd in YasuoWallDashDatabase.wallDashDatabase.Where(a=>a.startPosition.Distance(Yasuo) <= 1300))
                    if (EntityManager.MinionsAndMonsters.Combined.Where(a => a.MeetsCriteria() && a.Name == wd.unitName && a.ServerPosition.Distance(wd.dashUnitPosition) <= 2).FirstOrDefault() != null)
                    {
                        Geometry.Polygon.Circle dashCircle = new Geometry.Polygon.Circle(wd.endPosition, 120);
                        if (dashCircle.IsInside(Game.CursorPos))
                        {
                            activeDash = wd;
                            break;
                        }
                    }
            }

            if (MenuHandler.GetCheckboxValue(MenuHandler.Flee, "Use E") || activeDash != null)
            {
                if (activeDash == null)
                {
                    Orbwalker.MoveTo(Game.CursorPos);
                    didActionThisTick = EToMouse(MenuHandler.GetCheckboxValue(MenuHandler.Flee, "Use E Under Tower"), MenuHandler.GetCheckboxValue(MenuHandler.Flee, "Stack Q"), false);
                }
                else
                {
                    //first check if the positions are exact
                    if (Yasuo.Position.To2D() == activeDash.startPosition.To2D())
                        didActionThisTick = CastE(EntityManager.MinionsAndMonsters.Combined.Where(a => a.Name == activeDash.unitName).ToList().ToObj_AI_BaseList(), false, MenuHandler.GetCheckboxValue(MenuHandler.Flee, "Use E Under Tower"));
                    else
                        Orbwalker.MoveTo(activeDash.startPosition);

                    //if the positions aren't exact
                    //if (Yasuo.Position.Distance(activeDash.startPosition) > 50)
                    //    return;

                    Vector3 startPos = Yasuo.Position,
                        dashEndPos = YasuoCalcs.GetDashingEnd(EntityManager.MinionsAndMonsters.Combined.Where(a=>a.MeetsCriteria() && YasuoCalcs.ERequirements(a, MenuHandler.GetCheckboxValue(MenuHandler.Flee, "Use E Under Tower")) && a.Name == activeDash.unitName).FirstOrDefault()),
                        fakeEndPos = startPos.To2D().Extend(dashEndPos.To2D(), 1000).To3D() + new Vector3(0, 0, startPos.Z),
                        slope = new Vector3(dashEndPos.X - startPos.X, dashEndPos.Y - startPos.Y, 0),
                        fakeSlope = new Vector3(fakeEndPos.X - startPos.X, fakeEndPos.Y - startPos.Y, 0),
                        actualDashPosition = Vector3.Zero;
                    
                    List<Vector3> pointsAlongPath = new List<Vector3>();
                    List<Vector3> straightLinePath = new List<Vector3>();

                    int points = 100;

                    pointsAlongPath.Add(startPos);

                    //get all points in a line from start to fake end
                    for (int i = 0; i < points; i++)
                        straightLinePath.Add(startPos + (i * (fakeSlope / points)));

                    bool isWall = false;

                    //get all wall start and end positions
                    for (int i = 0; i < points; i++)
                    {
                        //wall start
                        if (!isWall && straightLinePath[i].IsWall())
                        {
                            pointsAlongPath.Add(straightLinePath[i]);
                            isWall = true;
                        }
                        //wall end
                        if (isWall && !straightLinePath[i].IsWall())
                        {
                            pointsAlongPath.Add(straightLinePath[i]);
                            isWall = false;
                        }
                    }

                    pointsAlongPath.Add(fakeEndPos);
                    
                    Vector3 closestWall = pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(dashEndPos)).FirstOrDefault(),
                        closestWallsEndPosition = (pointsAlongPath.IndexOf(closestWall) + 1 == pointsAlongPath.Count) ? Vector3.Zero : pointsAlongPath[pointsAlongPath.IndexOf(closestWall) + 1];

                    //none of the points are a wall so the end point is the dash position
                    if (!pointsAlongPath.Any(a => a.IsWall()))
                        actualDashPosition = dashEndPos;
                    // OR none of the walls are in the E range
                    else if (pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(startPos)).FirstOrDefault() != null &&
                        pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(startPos)).FirstOrDefault().Distance(startPos) > Program.E.Range)
                        actualDashPosition = dashEndPos;
                    //or the dashing end is not a wall
                    else if (!dashEndPos.IsWall())
                        actualDashPosition = dashEndPos;
                    //find the nearest wall to the dash position
                    else if (closestWall != Vector3.Zero && closestWallsEndPosition != Vector3.Zero &&
                        closestWall != null && closestWallsEndPosition != null &&
                        closestWallsEndPosition.Distance(dashEndPos) < closestWall.Distance(dashEndPos) &&
                        startPos.Distance(closestWallsEndPosition) <= 630)
                        actualDashPosition = closestWallsEndPosition;
                    //the end position is the first wall
                    else
                        actualDashPosition = pointsAlongPath.First(a => a.IsWall());

                    //if the end position is close enough to the walldash position, dash
                    if (actualDashPosition.Distance(activeDash.endPosition) <= MenuHandler.GetSliderValue(MenuHandler.Flee, "Wall Dash Extra Space"))
                    {
                        Chat.Print("did the dash");
                        didActionThisTick = Program.E.Cast(EntityManager.MinionsAndMonsters.Combined.Where(a => a.MeetsCriteria() && YasuoCalcs.ERequirements(a, MenuHandler.GetCheckboxValue(MenuHandler.Flee, "Use E Under Tower")) && a.Name == activeDash.unitName).FirstOrDefault());
                    }
                    else
                        Chat.Print("did not do the dash");
                }
            }
        }
Exemple #25
0
        private bool ELogic(Obj_AI_Hero mainTarget,
                            List <Obj_AI_Base> targets,
                            HitChance hitChance,
                            int minHits,
                            float overrideExtendedDistance = -1)
        {
            try
            {
                var input = new PredictionInput
                {
                    Range  = ELength,
                    Delay  = E.Delay,
                    Radius = E.Width,
                    Speed  = E.Speed,
                    Type   = E.Type
                };
                var input2 = new PredictionInput
                {
                    Range  = MaxERange,
                    Delay  = E.Delay,
                    Radius = E.Width,
                    Speed  = E.Speed,
                    Type   = E.Type
                };
                var startPos = Vector3.Zero;
                var endPos   = Vector3.Zero;
                var hits     = 0;
                targets = targets.Where(t => t.IsValidTarget(MaxERange + E.Width * 1.1f)).ToList();
                var targetCount = targets.Count;

                foreach (var target in targets)
                {
                    bool containsTarget;
                    var  lTarget = target;
                    if (target.Distance(Player.Position) <= E.Range)
                    {
                        containsTarget = mainTarget == null || lTarget.NetworkId == mainTarget.NetworkId;
                        var cCastPos = target.Position;
                        foreach (var t in targets.Where(t => t.NetworkId != lTarget.NetworkId))
                        {
                            var count   = 1;
                            var cTarget = t;
                            input.Unit           = t;
                            input.From           = cCastPos;
                            input.RangeCheckFrom = cCastPos;
                            var pred = Prediction.GetPrediction(input);
                            if (pred.Hitchance >= (hitChance - 1))
                            {
                                count++;
                                if (!containsTarget)
                                {
                                    containsTarget = t.NetworkId == mainTarget.NetworkId;
                                }
                                var rect = new Geometry.Polygon.Rectangle(
                                    cCastPos.To2D(), cCastPos.Extend(pred.CastPosition, ELength).To2D(), E.Width);
                                foreach (var c in
                                         targets.Where(
                                             c => c.NetworkId != cTarget.NetworkId && c.NetworkId != lTarget.NetworkId))
                                {
                                    input.Unit = c;
                                    var cPredPos = c.Type == GameObjectType.obj_AI_Minion
                                        ? c.Position
                                        : Prediction.GetPrediction(input).UnitPosition;
                                    if (
                                        new Geometry.Polygon.Circle(
                                            cPredPos,
                                            (c.Type == GameObjectType.obj_AI_Minion && c.IsMoving
                                                ? (c.BoundingRadius / 2f)
                                                : (c.BoundingRadius) * 0.9f)).Points.Any(p => rect.IsInside(p)))
                                    {
                                        count++;
                                        if (!containsTarget && c.NetworkId == mainTarget.NetworkId)
                                        {
                                            containsTarget = true;
                                        }
                                    }
                                }
                                if (count > hits && containsTarget)
                                {
                                    hits     = count;
                                    startPos = cCastPos;
                                    endPos   = cCastPos.Extend(pred.CastPosition, ELength);
                                    if (hits == targetCount)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                        if (endPos.Equals(Vector3.Zero) && containsTarget)
                        {
                            startPos = target.IsFacing(Player) && IsSpellUpgraded(E)
                                ? Player.Position.Extend(cCastPos, Player.Distance(cCastPos) - (ELength / 10f))
                                : cCastPos;
                            endPos = Player.Position.Extend(cCastPos, ELength);
                            hits   = 1;
                        }
                    }
                    else
                    {
                        input2.Unit = lTarget;
                        var castPos  = Prediction.GetPrediction(input2).CastPosition;
                        var sCastPos = Player.Position.Extend(castPos, E.Range);

                        var extDist = overrideExtendedDistance > 0 ? overrideExtendedDistance : (ELength / 4f);
                        var circle  =
                            new Geometry.Polygon.Circle(Player.Position, sCastPos.Distance(Player.Position), 45).Points
                            .Where(p => p.Distance(sCastPos) < extDist).OrderBy(p => p.Distance(lTarget));
                        foreach (var point in circle)
                        {
                            input2.From           = point.To3D();
                            input2.RangeCheckFrom = point.To3D();
                            input2.Range          = ELength;
                            var pred2 = Prediction.GetPrediction(input2);
                            if (pred2.Hitchance >= hitChance)
                            {
                                containsTarget = mainTarget == null || lTarget.NetworkId == mainTarget.NetworkId;
                                var count = 1;
                                var rect  = new Geometry.Polygon.Rectangle(
                                    point, point.To3D().Extend(pred2.CastPosition, ELength).To2D(), E.Width);
                                foreach (var c in targets.Where(t => t.NetworkId != lTarget.NetworkId))
                                {
                                    input2.Unit = c;
                                    var cPredPos = c.Type == GameObjectType.obj_AI_Minion
                                        ? c.Position
                                        : Prediction.GetPrediction(input2).UnitPosition;
                                    if (
                                        new Geometry.Polygon.Circle(
                                            cPredPos,
                                            (c.Type == GameObjectType.obj_AI_Minion && c.IsMoving
                                                ? (c.BoundingRadius / 2f)
                                                : (c.BoundingRadius) * 0.9f)).Points.Any(p => rect.IsInside(p)))
                                    {
                                        count++;
                                        if (!containsTarget && c.NetworkId == mainTarget.NetworkId)
                                        {
                                            containsTarget = true;
                                        }
                                    }
                                }
                                if (count > hits && containsTarget ||
                                    count == hits && containsTarget && mainTarget != null &&
                                    point.Distance(mainTarget.Position) < startPos.Distance(mainTarget.Position))
                                {
                                    hits     = count;
                                    startPos = point.To3D();
                                    endPos   = startPos.Extend(pred2.CastPosition, ELength);
                                    if (hits == targetCount)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    if (hits == targetCount)
                    {
                        break;
                    }
                }
                if (hits >= minHits && !startPos.Equals(Vector3.Zero) && !endPos.Equals(Vector3.Zero))
                {
                    E.Cast(startPos, endPos);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(false);
        }
        private static void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (Player.Instance.IsDead || !Settings.UseSeraph || !Program.Seraph.IsOwned() || !Program.Seraph.IsReady())
            {
                return;
            }

            if (sender.IsMe)
            {
                return;
            }

            var heroSender = sender as AIHeroClient;
            var target     = args.Target as AIHeroClient;

            if (heroSender != null && target != null && target.IsMe)
            {
                IncomingDamages.Add(new IncomingDamageArgs
                {
                    Sender      = heroSender,
                    Target      = target,
                    Tick        = (int)Game.Time * 1000,
                    Damage      = heroSender.GetSpellDamage(target, args.Slot),
                    IsTargetted = true
                });
            }
            if (heroSender != null && target == null)
            {
                if (args.SData.TargettingType == SpellDataTargetType.LocationAoe)
                {
                    {
                        var polygon  = new Geometry.Polygon.Circle(args.End, args.SData.CastRadius);
                        var polygon2 = new Geometry.Polygon.Circle(args.End, args.SData.CastRadiusSecondary);
                        if (polygon.IsInside(Player.Instance) || polygon2.IsInside(Player.Instance))
                        {
                            IncomingDamages.Add(new IncomingDamageArgs
                            {
                                Sender      = heroSender,
                                Target      = Player.Instance,
                                IsSkillShot = true,
                                Damage      =
                                    heroSender.GetSpellDamage(Player.Instance,
                                                              heroSender.GetSpellSlotFromName(args.SData.Name)),
                                Tick         = (int)Game.Time * 1000,
                                IsTargetted  = false,
                                IsTurretShot = false
                            });
                        }
                    }
                }
                else if (args.SData.TargettingType == SpellDataTargetType.Location ||
                         args.SData.TargettingType == SpellDataTargetType.Location2 ||
                         args.SData.TargettingType == SpellDataTargetType.Location3 ||
                         args.SData.TargettingType == SpellDataTargetType.LocationVector ||
                         args.SData.TargettingType == SpellDataTargetType.LocationVector ||
                         args.SData.TargettingType == SpellDataTargetType.LocationVector)
                {
                    var range   = SpellDatabase.GetSpellInfoList(heroSender).FirstOrDefault();
                    var polygon = new Geometry.Polygon.Rectangle(args.Start.To2D(),
                                                                 args.Start.Extend(args.End, range?.Range ?? 1), args.SData.LineWidth);

                    if (polygon.IsInside(Player.Instance))
                    {
                        IncomingDamages.Add(new IncomingDamageArgs
                        {
                            Sender      = heroSender,
                            Target      = Player.Instance,
                            IsSkillShot = true,
                            Tick        = (int)Game.Time * 1000,
                            Damage      =
                                heroSender.GetSpellDamage(Player.Instance,
                                                          heroSender.GetSpellSlotFromName(args.SData.Name)),
                            IsTargetted  = false,
                            IsTurretShot = false
                        });
                    }
                }
            }
        }
Exemple #27
0
        private static void AIHeroClient_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if ((args.Slot == SpellSlot.Q || args.Slot == SpellSlot.W || args.Slot == SpellSlot.E ||
                 args.Slot == SpellSlot.R) && sender.IsEnemy && _e.IsReady())
            {
                if (args.SData.TargettingType == SpellDataTargetType.Unit ||
                    args.SData.TargettingType == SpellDataTargetType.SelfAndUnit ||
                    args.SData.TargettingType == SpellDataTargetType.Self)
                {
                    if ((args.Target.NetworkId == Player.Instance.NetworkId && args.Time < 1.5 ||
                         args.End.Distance(Player.Instance.ServerPosition) <= Player.Instance.BoundingRadius * 3) &&
                        MainMenu.Misc[args.SData.Name].Cast <CheckBox>().CurrentValue)
                    {
                        _e.Cast();
                    }
                }
                else if (args.SData.TargettingType == SpellDataTargetType.LocationAoe)
                {
                    var castvector =
                        new Geometry.Polygon.Circle(args.End, args.SData.CastRadius).IsInside(
                            Player.Instance.ServerPosition);

                    if (castvector && MainMenu.Misc[args.SData.Name].Cast <CheckBox>().CurrentValue)
                    {
                        _e.Cast();
                    }
                }

                else if (args.SData.TargettingType == SpellDataTargetType.Cone)
                {
                    var castvector =
                        new Geometry.Polygon.Arc(args.Start, args.End, args.SData.CastConeAngle, args.SData.CastRange)
                        .IsInside(Player.Instance.ServerPosition);

                    if (castvector && MainMenu.Misc[args.SData.Name].Cast <CheckBox>().CurrentValue)
                    {
                        _e.Cast();
                    }
                }

                else if (args.SData.TargettingType == SpellDataTargetType.SelfAoe)
                {
                    var castvector =
                        new Geometry.Polygon.Circle(sender.ServerPosition, args.SData.CastRadius).IsInside(
                            Player.Instance.ServerPosition);

                    if (castvector && MainMenu.Misc[args.SData.Name].Cast <CheckBox>().CurrentValue)
                    {
                        _e.Cast();
                    }
                }
                else
                {
                    var castvector =
                        new Geometry.Polygon.Rectangle(args.Start, args.End, args.SData.LineWidth).IsInside(
                            Player.Instance.ServerPosition);

                    if (castvector && MainMenu.Misc[args.SData.Name].Cast <CheckBox>().CurrentValue)
                    {
                        _e.Cast();
                    }
                }
            }
        }
Exemple #28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="vector"></param>
        /// <param name="unit"></param>
        /// <param name="range"></param>
        /// <returns></returns>
        public static bool IsInsideUnitsRange(this Vector3 vector, AIHeroClient unit, float range)
        {
            var polygon = new Geometry.Polygon.Circle(unit.ServerPosition, range);

            return(polygon.IsInside(vector));
        }
Exemple #29
0
        private static void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (sender.IsMe)
            {
                return;
            }


            var enemy = sender as AIHeroClient;

            if (enemy == null)
            {
                return;
            }

            if (Config.GapcloserMenu.Enabled && Config.GapcloserMenu.foundgapclosers != 0)
            {
                var menudata = Config.AntiGapcloserMenuValues.FirstOrDefault(x => x.Champion == enemy.ChampionName);

                if (menudata == null)
                {
                    return;
                }

                if (enemy.Hero == Champion.Nidalee || enemy.Hero == Champion.Tristana || enemy.Hero == Champion.JarvanIV)
                {
                    if (enemy.Hero == Champion.JarvanIV && menudata.Enabled &&
                        args.SData.Name.ToLower() == "jarvanivdemacianstandard" &&
                        args.End.Distance(Player.Instance.Position) < 1000)
                    {
                        FlagPos.X      = args.End.X;
                        FlagPos.Y      = args.End.Y;
                        FlagPos.Z      = NavMesh.GetHeightForPosition(args.End.X, args.End.Y);
                        FlagCreateTick = (int)Game.Time * 1000;
                    }

                    if (enemy.Hero == Champion.Nidalee && menudata.Enabled && args.SData.Name.ToLower() == "pounce" &&
                        args.End.Distance(Player.Instance.Position) < 350)
                    {
                        CachedAntiGapclosers.Add(new ProcessSpellCastCache
                        {
                            Sender      = enemy,
                            NetworkId   = enemy.NetworkId,
                            DangerLevel = menudata.DangerLevel,
                            Tick        = (int)Game.Time * 1000
                        });
                    }

                    /*if (enemy.Hero == Champion.Tristana && menudata.Enabled &&
                     *  args.SData.Name.ToLower() == "tristanaw" &&
                     *  args.End.Distance(Player.Instance.Position) < 500)
                     * {
                     *  CachedAntiGapclosers.Add(new ProcessSpellCastCache
                     *  {
                     *      Sender = enemy,
                     *      NetworkId = enemy.NetworkId,
                     *      DangerLevel = menudata.DangerLevel,
                     *      Tick = (int) Game.Time*1000
                     *  });
                     * }*/
                    if (enemy.Hero == Champion.JarvanIV && menudata.Enabled &&
                        args.SData.Name.ToLower() == "jarvanivdragonstrike" &&
                        args.End.Distance(Player.Instance.Position) < 1000)
                    {
                        var flagpolygon   = new Geometry.Polygon.Circle(FlagPos, 150);
                        var playerpolygon = new Geometry.Polygon.Circle(Player.Instance.Position, 150);

                        for (var i = 0; i < 1000; i += 25)
                        {
                            if (flagpolygon.IsInside(enemy.Position.Extend(args.End, i)) && playerpolygon.IsInside(enemy.ServerPosition.Extend(args.End, i)))
                            {
                                CachedAntiGapclosers.Add(new ProcessSpellCastCache
                                {
                                    Sender      = enemy,
                                    NetworkId   = enemy.NetworkId,
                                    DangerLevel = menudata.DangerLevel,
                                    Tick        = (int)Game.Time * 1000
                                });
                                break;
                            }
                        }
                    }
                }
                else
                {
                    if (menudata.Enabled && args.Slot == menudata.SpellSlot &&
                        args.End.Distance(Player.Instance.Position) < 350)
                    {
                        CachedAntiGapclosers.Add(new ProcessSpellCastCache
                        {
                            Sender      = enemy,
                            NetworkId   = enemy.NetworkId,
                            DangerLevel = menudata.DangerLevel,
                            Tick        = (int)Game.Time * 1000
                        });
                    }
                }
            }
            if (Config.InterrupterMenu.Enabled && Config.InterrupterMenu.foundinterruptiblespells != 0)
            {
                var menudata = Config.InterrupterMenuValues.FirstOrDefault(info => info.Champion == enemy.Hero);

                if (menudata == null)
                {
                    return;
                }

                if (menudata.Enabled && args.Slot == menudata.SpellSlot)
                {
                    CachedInterruptibleSpells.Add(new ProcessSpellCastCache
                    {
                        Sender      = enemy,
                        NetworkId   = enemy.NetworkId,
                        DangerLevel = menudata.DangerLevel,
                        Tick        = (int)Game.Time * 1000
                    });
                }
            }
        }
Exemple #30
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static Geometry.Polygon[] SegmentedAutoattackPolygons()
        {
            var aaPolygon = new Geometry.Polygon.Circle(Player.Instance.Position,
                                                        Player.Instance.GetAutoAttackRange(), 24);

            var points = new Vector2[24];
            var i      = 0;

            foreach (var point in aaPolygon.Points)
            {
                points[i] = point;
                i++;
            }

            var polygons = new Geometry.Polygon[4];

            var dictionary = new Dictionary <int, List <Vector2> >
            {
                {
                    0, // 1
                    new List <Vector2>
                    {
                        aaPolygon.Center,
                        points[3],
                        points[4],
                        points[5],
                        points[6],
                        points[7],
                        points[8],
                        points[9]
                    }
                },
                {
                    1, // 2
                    new List <Vector2>
                    {
                        aaPolygon.Center,
                        points[9],
                        points[10],
                        points[11],
                        points[12],
                        points[13],
                        points[14],
                        points[15]
                    }
                },
                {
                    2,// Reverse 1
                    new List <Vector2>
                    {
                        aaPolygon.Center,
                        points[15],
                        points[16],
                        points[17],
                        points[18],
                        points[19],
                        points[20],
                        points[21]
                    }
                },
                {
                    3, // Reverse 2
                    new List <Vector2>
                    {
                        aaPolygon.Center,
                        points[21],
                        points[22],
                        points[23],
                        points[0],
                        points[1],
                        points[2],
                        points[3]
                    }
                }
            };

            for (var x = 0; x < 4; x++)
            {
                polygons[x] = new Geometry.Polygon();
                polygons[x].Add(dictionary[x].ToPolygon());
            }
            return(polygons);
        }
        public static void Combos()
        {
            //Target
            var Target = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);

            //Q Combo
            if (CamilleMenu.Item("Q").GetValue <bool>() && Q.IsReady() && Target.IsValidTarget() && CamilleMenu.Item("Q2").GetValue <bool>() && !Player.HasBuff("CamilleQPrimingStart"))
            {
                Q.Cast(Target);
            }

            if (CamilleMenu.Item("Q").GetValue <bool>() && Q.IsReady() && Target.IsValidTarget() && !CamilleMenu.Item("Q2").GetValue <bool>())
            {
                Q.Cast(Target);
            }

            //W Combo
            if (CamilleMenu.Item("W").GetValue <bool>() && W.IsReady() && Target.IsValidTarget() && !CamilleMenu.Item("W2").GetValue <bool>() && !Player.HasBuff("CamilleEOnWall") && !Player.HasBuff("CamilleEDash1") && !Player.HasBuff("camilleedashtoggle") && !Player.HasBuff("CamilleEDash2"))
            {
                W.Cast(Target);
            }
            if (CamilleMenu.Item("W").GetValue <bool>() && W.IsReady() && Target.IsValidTarget() && CamilleMenu.Item("W2").GetValue <bool>() && Player.Distance(Target) <= 630 && Player.Distance(Target) >= 350 && !Player.HasBuff("CamilleEOnWall") && !Player.HasBuff("camilleedashtoggle") && !Player.HasBuff("CamilleEDash2"))
            {
                W.Cast(Target);
            }

            //E Combo
            if (E.IsReady() && CamilleMenu.Item("E").GetValue <bool>() && Target.IsValidTarget(E.Range))
            {
                switch (CamilleMenu.Item("EMode", true).GetValue <StringList>().SelectedIndex)
                {
                case 0:
                {
                    var polygon = new Geometry.Polygon.Circle(Target.Position, 600).Points.FirstOrDefault(x => NavMesh.GetCollisionFlags(x.X, x.Y).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(x.X, x.Y).HasFlag(CollisionFlags.Building));

                    if (new Vector2(polygon.X, polygon.Y).Distance(ObjectManager.Player.Position) < E.Range)
                    {
                        E.Cast(new Vector2(polygon.X, polygon.Y));
                        if (E.Cast(new Vector2(polygon.X, polygon.Y)))
                        {
                            E.Cast(Target);
                        }
                    }
                }
                break;

                case 1:
                {
                    var polygon = new Geometry.Polygon.Circle(Target.Position, 600).Points.FirstOrDefault(x => NavMesh.GetCollisionFlags(x.X, x.Y).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(x.X, x.Y).HasFlag(CollisionFlags.Building));

                    if (new Vector2(polygon.X, polygon.Y).Distance(ObjectManager.Player.Position) < E.Range)
                    {
                        E.Cast(new Vector2(polygon.X, polygon.Y));
                    }
                }
                break;

                case 2:
                {
                    var target = TargetSelector.GetTarget(E.IsReady() ? E.Range * 2 : W.Range, TargetSelector.DamageType.Physical);
                    if (target.IsValidTarget() && !target.IsZombie)
                    {
                        if (CamilleMenu.Item("E").GetValue <bool>())
                        {
                            UseE(target.ServerPosition);
                        }
                    }
                }
                break;
                }
            }

            //R Combo
            if (CamilleMenu.Item("R").GetValue <bool>() && R.IsReady() && Target.IsValidTarget() && !Player.HasBuff("CamilleEOnWall") && !Player.HasBuff("CamilleEDash1") && !Player.HasBuff("camilleedashtoggle") && !Player.HasBuff("CamilleEDash2") && Target.HealthPercent < CamilleMenu.Item("RHP").GetValue <Slider>().Value&& CamilleMenu.Item("r" + Target.ChampionName.ToLower(), true).GetValue <bool>())
            {
                R.Cast(Target);
            }
        }
Exemple #32
0
        public static CustomPolygon CreateCircularSkillshot(SpellInfo info, Vector3 position, float radius)
        {
            Geometry.Polygon circle = new Geometry.Polygon.Circle(position, radius);

            return(new CustomPolygon(circle, info));
        }
Exemple #33
0
        public static bool IsInDanger(this Obj_AI_Base target, ActiveSpells spell)
        {
            var HitBox = new Geometry.Polygon.Circle(target.ServerPosition, target.BoundingRadius + 10);

            return(HitBox.Points.Any(p => spell.ToPolygon().IsInside(p)));
        }
        public Geometry.Polygon PredictedPolygon(float afterTime, float extraWidth = 0)
        {
            var extraAngle = Math.Max(1, Math.Max(1, extraWidth) / 4);

            extraWidth += this.Width;

            Geometry.Polygon polygon = null;
            switch (this.Data.type)
            {
            case Type.LineMissile:
                polygon = new Geometry.Polygon.Rectangle(this.CalculatedPosition(afterTime), this.CollideEndPosition, extraWidth);
                break;

            case Type.CircleMissile:
                polygon = new Geometry.Polygon.Circle(this.Data.IsMoving ? this.CalculatedPosition(afterTime) : this.CollideEndPosition, extraWidth);
                break;

            case Type.Cone:
                polygon = new Geometry.Polygon.Sector(this.CurrentPosition, this.CollideEndPosition, (float)((this.Angle + extraAngle) * Math.PI / 180), this.Range);
                break;

            case Type.Arc:
                polygon = new CustomGeometry.Arc(this.Start, this.CollideEndPosition, (int)extraWidth).ToSDKPolygon();
                break;

            case Type.Ring:
                polygon = new CustomGeometry.Ring(this.CollideEndPosition, extraWidth, this.RingRadius).ToSDKPolygon();
                break;
            }

            if (polygon != null && (this.ExplodeEnd || this.CollideExplode))
            {
                var newpolygon   = polygon;
                var pos          = this.CurrentPosition;
                var collidepoint = this.CollideExplode ? this.CorrectCollidePoint.GetValueOrDefault() : this.CollideEndPosition;
                switch (this.Data.Explodetype)
                {
                case Type.CircleMissile:
                    this.ExplodePolygon = new Geometry.Polygon.Circle(collidepoint, this.ExplodeWidth);
                    break;

                case Type.LineMissile:
                    var st = collidepoint - (collidepoint - pos).Normalized().Perpendicular() * (this.ExplodeWidth);
                    var en = collidepoint + (collidepoint - pos).Normalized().Perpendicular() * (this.ExplodeWidth);
                    this.ExplodePolygon = new Geometry.Polygon.Rectangle(st, en, this.ExplodeWidth / 2);
                    break;

                case Type.Cone:
                    var st2 = collidepoint - Direction * (this.ExplodeWidth * 0.25f);
                    var en2 = collidepoint + Direction * (this.ExplodeWidth * 3);
                    this.ExplodePolygon = new Geometry.Polygon.Sector(st2, en2, (float)(this.Angle * Math.PI / 180), this.ExplodeWidth);
                    break;
                }

                var poly    = Geometry.ClipPolygons(new[] { newpolygon, this.ExplodePolygon });
                var vectors = new List <IntPoint>();
                foreach (var p in poly)
                {
                    vectors.AddRange(p.ToPolygon().ToClipperPath());
                }

                polygon = vectors.ToPolygon();
            }

            return(polygon);
        }
Exemple #35
0
        /// <summary>
        ///     Ranged Champions Logic.
        /// </summary>
        public static Vector3 RangedLogic()
        {
            var NearestEnemy = ObjectsManager.NearestEnemy;

            // TeamFighting Logic.
            if (NearestEnemy != null && Brain.TeamFightActive && MyHero.Instance.PredictHealthPercent() > 15 &&
                !(ModesManager.CurrentMode == ModesManager.Modes.Flee || ModesManager.CurrentMode == ModesManager.Modes.None))
            {
                var pos = NearestEnemy.KitePos(Detector.LastAlliesTeamFightPos);
                if (MyHero.Instance.SafePath(pos))
                {
                    Program.Moveto = "KiteNearestEnemy";
                    Position       = pos;
                    return(Position);
                }
            }

            // Tower Defence
            if (ObjectsManager.FarthestAllyTurret != null && Player.Instance.PredictHealthPercent() >= 20)
            {
                if (ObjectsManager.FarthestAllyTurret.CountEnemyHeros((int)ObjectsManager.FarthestAllyTurret.GetAutoAttackRange(MyHero.Instance) + 50) > 0)
                {
                    var enemy = EntityManager.Heroes.Enemies.OrderBy(o => o.Distance(ObjectsManager.AllySpawn)).FirstOrDefault(e => e.IsKillable() && e.IsUnderEnemyturret() &&
                                                                                                                               (e.TeamTotal() >= e.TeamTotal(true) || e.CountAllyHeros(SafeValue) > 1 || e.CountEnemyHeros(SafeValue) < 2));
                    if (enemy != null)
                    {
                        Program.Moveto = "DefendingTower";
                        Position       = enemy.KitePos(ObjectsManager.AllySpawn);
                        return(Position);
                    }
                }
            }

            // Inhb defend
            var AllyInhb = ObjectsManager.AllyInhb;

            if (AllyInhb != null && AllyInhb.IsValidTarget() && AllyInhb.CountEnemyHeroesInRangeWithPrediction(SafeValue) > 0 && AllyInhb.Position.TeamTotal() > AllyInhb.Position.TeamTotal(true))
            {
                var enemy = EntityManager.Heroes.Enemies.OrderBy(o => o.Distance(ObjectsManager.AllySpawn)).FirstOrDefault(e => e.IsKillable() && e.IsInRange(AllyInhb, SafeValue) &&
                                                                                                                           (e.TeamTotal() >= e.TeamTotal(true) || e.CountAllyHeros(SafeValue) > 1 || e.CountEnemyHeros(SafeValue) < 2));

                if (enemy != null)
                {
                    Program.Moveto = "DefendingInhbitor";
                    Position       = enemy.KitePos(ObjectsManager.AllySpawn);
                    return(Position);
                }
            }

            var EnemyObject = ObjectsManager.NearestEnemyObject;

            // if Can AttackObject then start attacking THE DAMN OBJECT FFS.
            if (EnemyObject != null && Player.Instance.PredictHealthPercent() > 20 && ModesManager.AttackObject &&
                (EnemyObject.Position.TeamTotal() > EnemyObject.Position.TeamTotal(true) || EnemyObject.CountEnemyHeros(SafeValue + 100) < 1))
            {
                var extendto = new Vector3();
                if (ObjectsManager.AllySpawn != null)
                {
                    extendto = ObjectsManager.AllySpawn.Position;
                }
                if (ObjectsManager.NearestMinion != null)
                {
                    extendto = ObjectsManager.NearestMinion.Position;
                }
                if (ObjectsManager.NearestAlly != null)
                {
                    extendto = ObjectsManager.NearestAlly.Position;
                }
                var extendtopos = ObjectsManager.NearestEnemyObject.KitePos(extendto);
                var rect        = new Geometry.Polygon.Rectangle(Player.Instance.ServerPosition, ObjectsManager.NearestEnemyObject.Position, 400);
                var Enemy       = EntityManager.Heroes.Enemies.Any(a => a != null && a.IsValid && a.TeamTotal(true) > a.TeamTotal() && !a.IsDead && new Geometry.Polygon.Circle(a.PredictPosition(), a.GetAutoAttackRange(Player.Instance)).Points.Any(p => rect.IsInside(p)));
                if (!Enemy)
                {
                    if (ObjectsManager.EnemyTurret != null)
                    {
                        var TurretCircle = new Geometry.Polygon.Circle(ObjectsManager.EnemyTurret.ServerPosition, ObjectsManager.EnemyTurret.GetAutoAttackRange(Player.Instance));


                        if (ObjectsManager.NearestEnemyObject is Obj_AI_Turret)
                        {
                            if (SafeToDive)
                            {
                                Program.Moveto = "NearestEnemyObject";
                                Position       = extendtopos;
                                return(Position);
                            }
                        }
                        if (!TurretCircle.Points.Any(p => rect.IsInside(p)))
                        {
                            Program.Moveto = "NearestEnemyObject2";
                            Position       = extendtopos;
                            return(Position);
                        }
                    }
                    else
                    {
                        Program.Moveto = "NearestEnemyObject3";
                        Position       = extendtopos;
                        return(Position);
                    }
                }
            }

            // if NearestEnemyMinion exsists moves to NearestEnemyMinion.
            var NearestEnemyMinion = ObjectsManager.NearestEnemyMinion;

            if (NearestEnemyMinion != null && MyHero.Instance.SafePath(NearestEnemyMinion) && NearestEnemyMinion.CountEnemyMinionsInRangeWithPrediction(SafeValue) > 1 && ObjectsManager.AllySpawn != null && Player.Instance.PredictHealthPercent() > 20)
            {
                Program.Moveto = "NearestEnemyMinion";
                Position       = NearestEnemyMinion.PredictPosition().Extend(ObjectsManager.AllySpawn.Position.Random(), KiteDistance(NearestEnemyMinion)).To3D();
                return(Position);
            }

            // if SafestAllyToFollow2 exsists moves to SafestAllyToFollow2.
            if (ObjectsManager.SafestAllyToFollow2 != null)
            {
                Program.Moveto = "SafestAllyToFollow2";
                Position       = ObjectsManager.SafestAllyToFollow2.PredictPosition().Extend(ObjectsManager.AllySpawn, 100).Random();
                return(Position);
            }

            // if Minion not exsist picks other to follow.
            if (ObjectsManager.AllyMinion != null)
            {
                Program.Moveto = "AllyMinion";
                Position       = ObjectsManager.AllyMinion.PredictPosition().Extend(ObjectsManager.AllySpawn, 100).Random();
                return(Position);
            }

            // if SecondTurret exsists moves to SecondTurret.
            if (ObjectsManager.SecondTurret != null)
            {
                Program.Moveto = "SecondTurret";
                Position       = ObjectsManager.SecondTurret.ServerPosition.Extend(ObjectsManager.AllySpawn, 425).To3D().Random();
                return(Position);
            }

            // if SafeAllyTurret exsists moves to SafeAllyTurret.
            if (ObjectsManager.SafeAllyTurret != null)
            {
                Program.Moveto = "SafeAllyTurret";
                Position       = ObjectsManager.SafeAllyTurret.ServerPosition.Extend(ObjectsManager.AllySpawn, 425).To3D().Random();
                return(Position);
            }

            // if ClosesetAllyTurret exsists moves to ClosesetAllyTurret.
            if (ObjectsManager.ClosesetAllyTurret != null)
            {
                Program.Moveto = "ClosesetAllyTurret";
                Position       = ObjectsManager.ClosesetAllyTurret.ServerPosition.Extend(ObjectsManager.AllySpawn, 425).To3D().Random();
                return(Position);
            }

            // Well if it ends up like this then best thing is to let it end.
            if (ObjectsManager.AllySpawn != null)
            {
                Program.Moveto = "AllySpawn3";
                Position       = ObjectsManager.AllySpawn.Position.Random();
                return(Position);
            }
            return(Vector3.Zero);
        }
Exemple #36
0
        //complete
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (Yasuo.IsDead)
            {
                return;
            }

            Menu menu = MenuHandler.Drawing;

            System.Drawing.Color drawColor = System.Drawing.Color.Blue;

            //Drawing.DrawText(Yasuo.Position.WorldToScreen(), drawColor, Animation, 15);

            //Vector3 yasuoQStartPos = Yasuo.Position + new Vector3(0, 0, 150f),
            //    yasuoQEndPos = yasuoQStartPos.To2D().Extend(Game.CursorPos, Q.Range).To3D((int)yasuoQStartPos.Z - 75);

            //yasuoQStartPos.DrawArrow(yasuoQEndPos, drawColor);
            //Drawing.DrawLine(yasuoQStartPos.WorldToScreen(), yasuoQEndPos.WorldToScreen(), 5, drawColor);

            if (menu.GetCheckboxValue("Draw Q") && !Yasuo.HasBuff("YasuoQ3W") && Q.IsLearned)
            {
                //Drawing.DrawCircle(yasuoQStartPos, Q.Range, drawColor);
                Q.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw Q") && Yasuo.HasBuff("YasuoQ3W") && Q.IsLearned)
            {
                Q3.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw W") && W.IsLearned)
            {
                W.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw E") && E.IsLearned)
            {
                E.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw EQ") && E.IsLearned && Q.IsLearned)
            {
                EQ.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw R") && R.IsLearned)
            {
                R.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw Beyblade") && R.IsLearned && Flash != null && E.IsLearned && Q.IsLearned)
            {
                Drawing.DrawCircle(Yasuo.Position, E.Range + Flash.Range + (EQ.Range / 2), System.Drawing.Color.Red);
            }
            if (menu.GetCheckboxValue("Draw Turret Range"))
            {
                foreach (Obj_AI_Turret turret in EntityManager.Turrets.Enemies.Where(a => !a.IsDead && a.VisibleOnScreen))
                {
                    turret.DrawCircle((int)turret.GetAutoAttackRange() + 35, drawColor);
                }
            }

            Obj_AI_Base hoverObject = EntityManager.Enemies.Where(a => !a.IsDead && a.IsTargetable && a.IsInRange(Yasuo, E.Range) && a.Distance(Game.CursorPos) <= 75).OrderBy(a => a.Distance(Game.CursorPos)).FirstOrDefault();

            if (hoverObject != null)
            {
                if (menu.GetCheckboxValue("Draw EQ on Target"))
                {
                    Drawing.DrawCircle(YasuoCalcs.GetDashingEnd(hoverObject), EQ.Range, drawColor);
                }
                if (menu.GetCheckboxValue("Draw E End Position on Target"))
                {
                    Drawing.DrawLine(Yasuo.Position.WorldToScreen(), YasuoCalcs.GetDashingEnd(hoverObject).WorldToScreen(), 3, drawColor);
                }
                if (menu.GetCheckboxValue("Draw E End Position on Target - Detailed"))
                {
                    Vector3 startPos   = Yasuo.Position,
                            dashEndPos = YasuoCalcs.GetDashingEnd(hoverObject),
                            fakeEndPos = startPos.To2D().Extend(dashEndPos.To2D(), 1000).To3D() + new Vector3(0, 0, startPos.Z),
                            slope      = new Vector3(dashEndPos.X - startPos.X, dashEndPos.Y - startPos.Y, 0),
                            fakeSlope  = new Vector3(fakeEndPos.X - startPos.X, fakeEndPos.Y - startPos.Y, 0);

                    List <Vector3> pointsAlongPath  = new List <Vector3>();
                    List <Vector3> straightLinePath = new List <Vector3>();

                    int points = 100;

                    pointsAlongPath.Add(startPos);

                    //get all points in a line from start to fake end
                    for (int i = 0; i < points; i++)
                    {
                        straightLinePath.Add(startPos + (i * (fakeSlope / points)));
                    }

                    bool isWall = false;

                    //get all wall start and end positions
                    for (int i = 0; i < points; i++)
                    {
                        //wall start
                        if (!isWall && straightLinePath[i].IsWall())
                        {
                            pointsAlongPath.Add(straightLinePath[i]);
                            isWall = true;
                        }
                        //wall end
                        if (isWall && !straightLinePath[i].IsWall())
                        {
                            pointsAlongPath.Add(straightLinePath[i]);
                            isWall = false;
                        }
                    }

                    pointsAlongPath.Add(fakeEndPos);

                    for (int i = 0; i < pointsAlongPath.Count() - 1; i++)
                    {
                        System.Drawing.Color color = (pointsAlongPath[i].IsWall()) ? System.Drawing.Color.Red : System.Drawing.Color.Green;
                        Drawing.DrawLine(pointsAlongPath[i].WorldToScreen(), pointsAlongPath[i + 1].WorldToScreen(), 2, color);
                    }

                    Vector3 closestWall             = pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(dashEndPos)).FirstOrDefault(),
                            closestWallsEndPosition = (pointsAlongPath.IndexOf(closestWall) + 1 == pointsAlongPath.Count) ? Vector3.Zero : pointsAlongPath[pointsAlongPath.IndexOf(closestWall) + 1];

                    Drawing.DrawText(closestWall.WorldToScreen(), drawColor, "start", 15);
                    Drawing.DrawText(closestWallsEndPosition.WorldToScreen(), drawColor, "end", 15);
                    Drawing.DrawText(((closestWall + closestWallsEndPosition) / 2).WorldToScreen(), drawColor, closestWall.Distance(closestWallsEndPosition).ToString(), 15);
                    Drawing.DrawText(dashEndPos.WorldToScreen(), drawColor, startPos.Distance(closestWallsEndPosition).ToString(), 15);

                    //none of the points are a wall so the end point is the dash position
                    if (!pointsAlongPath.Any(a => a.IsWall()))
                    {
                        Drawing.DrawCircle(dashEndPos, 50, drawColor);
                    }
                    // OR none of the walls are in the E range
                    else if (pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(startPos)).FirstOrDefault() != null &&
                             pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(startPos)).FirstOrDefault().Distance(startPos) > E.Range)
                    {
                        Drawing.DrawCircle(dashEndPos, 50, drawColor);
                    }
                    //or the dashing end is not a wall
                    else if (!dashEndPos.IsWall())
                    {
                        Drawing.DrawCircle(dashEndPos, 50, drawColor);
                    }
                    //find the nearest wall to the dash position
                    else if (closestWall != Vector3.Zero && closestWallsEndPosition != Vector3.Zero &&
                             closestWall != null && closestWallsEndPosition != null &&
                             closestWallsEndPosition.Distance(dashEndPos) < closestWall.Distance(dashEndPos) &&
                             startPos.Distance(closestWallsEndPosition) <= 630)
                    {
                        Drawing.DrawCircle(closestWallsEndPosition, 50, drawColor);
                    }
                    //the end position is the first wall
                    else
                    {
                        Drawing.DrawCircle(pointsAlongPath.First(a => a.IsWall()), 50, drawColor);
                    }
                }
            }

            if (menu.GetCheckboxValue("Draw Wall Dashes") && E.IsLearned)
            {
                foreach (WallDash wd in YasuoWallDashDatabase.wallDashDatabase.Where(a => a.startPosition.Distance(Yasuo) <= 1300))
                {
                    if (EntityManager.MinionsAndMonsters.Combined.Where(a => a.MeetsCriteria() && a.VisibleOnScreen && a.Name == wd.unitName && a.ServerPosition.Distance(wd.dashUnitPosition) <= 2).FirstOrDefault() != null)
                    {
                        wd.startPosition.DrawArrow(wd.endPosition, System.Drawing.Color.Red, 1);
                        Geometry.Polygon.Circle dashCircle = new Geometry.Polygon.Circle(wd.endPosition, 120);
                        dashCircle.Draw(System.Drawing.Color.Red, 1);
                    }
                }
            }
        }
Exemple #37
0
        private static void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (sender.IsMe)
                return;

            var enemy = sender as AIHeroClient;

            if (enemy == null)
                return;

            if (Config.GapcloserMenu.Enabled && Config.GapcloserMenu.foundgapclosers != 0)
            {
                var menudata = Config.AntiGapcloserMenuValues.FirstOrDefault(x => x.Champion == enemy.ChampionName);

                if (menudata == null)
                    return;

                if (enemy.Hero == Champion.Nidalee || enemy.Hero == Champion.Tristana || enemy.Hero == Champion.JarvanIV)
                {
                    if (enemy.Hero == Champion.JarvanIV && menudata.Enabled &&
                        args.SData.Name.ToLower() == "jarvanivdemacianstandard" &&
                        args.End.Distance(Player.Instance.Position) < 1000)
                    {
                        FlagPos.X = args.End.X;
                        FlagPos.Y = args.End.Y;
                        FlagPos.Z = NavMesh.GetHeightForPosition(args.End.X, args.End.Y);
                        FlagCreateTick = (int) Game.Time*1000;
                    }

                    if (enemy.Hero == Champion.Nidalee && menudata.Enabled && args.SData.Name.ToLower() == "pounce" &&
                        args.End.Distance(Player.Instance.Position) < 350)
                    {
                        CachedAntiGapclosers.Add(new ProcessSpellCastCache
                        {
                            Sender = enemy,
                            NetworkId = enemy.NetworkId,
                            DangerLevel = menudata.DangerLevel,
                            Tick = (int) Game.Time*1000
                        });
                    }
                    /*if (enemy.Hero == Champion.Tristana && menudata.Enabled &&
                        args.SData.Name.ToLower() == "tristanaw" &&
                        args.End.Distance(Player.Instance.Position) < 500)
                    {
                        CachedAntiGapclosers.Add(new ProcessSpellCastCache
                        {
                            Sender = enemy,
                            NetworkId = enemy.NetworkId,
                            DangerLevel = menudata.DangerLevel,
                            Tick = (int) Game.Time*1000
                        });
                    }*/
                    if (enemy.Hero == Champion.JarvanIV && menudata.Enabled &&
                        args.SData.Name.ToLower() == "jarvanivdragonstrike" &&
                        args.End.Distance(Player.Instance.Position) < 1000)
                    {
                        var flagpolygon = new Geometry.Polygon.Circle(FlagPos, 150);
                        var playerpolygon = new Geometry.Polygon.Circle(Player.Instance.Position, 150);

                        for (var i = 900; i > 0; i -= 100)
                        {
                            if (flagpolygon.IsInside(enemy.Position.Extend(args.End, i)) && playerpolygon.IsInside(enemy.ServerPosition.Extend(args.End, i)))
                            {
                                CachedAntiGapclosers.Add(new ProcessSpellCastCache
                                {
                                    Sender = enemy,
                                    NetworkId = enemy.NetworkId,
                                    DangerLevel = menudata.DangerLevel,
                                    Tick = (int) Game.Time*1000
                                });
                                break;
                            }
                        }
                    }
                }
                else
                {
                    if (menudata.Enabled && args.Slot == menudata.SpellSlot &&
                        args.End.Distance(Player.Instance.Position) < 350)
                    {
                        CachedAntiGapclosers.Add(new ProcessSpellCastCache
                        {
                            Sender = enemy,
                            NetworkId = enemy.NetworkId,
                            DangerLevel = menudata.DangerLevel,
                            Tick = (int) Game.Time*1000
                        });
                    }
                }
            }
            if (Config.InterrupterMenu.Enabled && Config.InterrupterMenu.foundinterruptiblespells != 0)
            {
                var menudata = Config.InterrupterMenuValues.FirstOrDefault(info => info.Champion == enemy.Hero);

                if (menudata == null)
                    return;

                if (menudata.Enabled && args.Slot == menudata.SpellSlot)
                {
                    CachedInterruptibleSpells.Add(new ProcessSpellCastCache
                    {
                        Sender = enemy,
                        NetworkId = enemy.NetworkId,
                        DangerLevel = menudata.DangerLevel,
                        Tick = (int) Game.Time*1000
                    });
                }
            }
        }
Exemple #38
0
        private static void GameObject_OnCreate(GameObject sender, EventArgs args)
        {
            var missile = sender as MissileClient;

            if (missile == null)
            {
                return;
            }

            var missileInfo =
                SpellDatabase.GetSpellInfoList(missile.SpellCaster).FirstOrDefault(s => s.RealSlot == missile.Slot);

            if (missileInfo == null)
            {
                return;
            }

            switch (missileInfo.Type)
            {
            case SpellType.Self:
                break;

            case SpellType.Circle:
                var polCircle = new Geometry.Polygon.Circle(missile.Position, missileInfo.Radius);
                Missiles.Add(missile, polCircle);
                break;

            case SpellType.Line:
                var polLine = new Geometry.Polygon.Rectangle(missile.StartPosition,
                                                             missile.StartPosition.Extend(missile.EndPosition, missileInfo.Range).To3D(), 5);
                Missiles.Add(missile, polLine);
                break;

            case SpellType.Cone:
                var polCone = new Geometry.Polygon.Sector(missile.StartPosition, missile.EndPosition, missileInfo.Radius, missileInfo.Range, 80);
                Missiles.Add(missile, polCone);
                break;

            case SpellType.Ring:
                break;

            case SpellType.Arc:
                break;

            case SpellType.MissileLine:
                var polMissileLine = new Geometry.Polygon.Rectangle(missile.StartPosition,
                                                                    missile.StartPosition.Extend(missile.EndPosition, missileInfo.Range).To3D(), 5);
                Missiles.Add(missile, polMissileLine);
                break;

            case SpellType.MissileAoe:
                var polMissileAoe = new Geometry.Polygon.Rectangle(missile.StartPosition,
                                                                   missile.StartPosition.Extend(missile.EndPosition, missileInfo.Range).To3D(), 5);
                Missiles.Add(missile, polMissileAoe);
                break;
            }

            var polygons = new List <Geometry.Polygon>();

            polygons.AddRange(Missiles.Values);

            Joined = polygons.JoinPolygons();
        }
Exemple #39
0
 private static void CondemnLogic(Obj_AI_Base target)
 {
     for (var i = 1; i <= 25; i++)
     {
         var pos = Player.Instance.ServerPosition.Extend(Prediction.Position.PredictUnitPosition(target, (int)(target.ServerPosition.Distance(Player.Instance.ServerPosition) / 1200)),
             target.ServerPosition.Distance(Player.Instance.ServerPosition) + (((400 - target.BoundingRadius) / 25)) * i)
             .To3D();
         var circ = new Geometry.Polygon.Circle(pos, target.BoundingRadius * 0.4f);
         if (circ.Points.Any(point => point.ToNavMeshCell().CollFlags.HasFlag(CollisionFlags.Wall) || point.ToNavMeshCell().CollFlags.HasFlag(CollisionFlags.Building)))
         {
             _e.Cast(target);
         }
     }
 }
Exemple #40
0
        //working and tested
        public static Vector3 GetBestBarrelChainPosition(List <Obj_AI_Base> enemies, int enemiesToUseEOn)
        {
            List <Barrel> barrelsInQRange = Program.barrels.Where(a => a.barrel.IsInRange(Gangplank, Program.Q.Range) && a.TimeAt1HP - Game.Time <= Calculations.CalculateQTimeToTarget(a.barrel)).ToList();

            int enemiesHit = 0;
            List <Obj_AI_Base> enemiesHitList = new List <Obj_AI_Base>();
            Vector3            bestPosition   = new Vector3();

            int eWidthIterationsCap         = 4;
            int predictionAngleCap          = 15;
            int barrelConnectionExtendRange = 650;

            if (MenuHandler.Settings.GetComboBoxText("Barrel Mode:") == "Best Prediction")
            {
                eWidthIterationsCap = 10;
                predictionAngleCap  = 5;
            }
            else if (MenuHandler.Settings.GetComboBoxText("Barrel Mode:") == "Best FPS")
            {
                eWidthIterationsCap = 2;
                predictionAngleCap  = 50;
            }
            else if (MenuHandler.Settings.GetComboBoxText("Barrel Mode:") == "Middle Ground")
            {
                eWidthIterationsCap = 4;
                predictionAngleCap  = 15;
            }

            if (MenuHandler.Settings.GetComboBoxText("Barrel Range Mode:") == "Max Range")
            {
                barrelConnectionExtendRange = 650;
            }
            else if (MenuHandler.Settings.GetComboBoxText("Barrel Range Mode:") == "Any Position")
            {
                barrelConnectionExtendRange = 0;
            }
            else if (MenuHandler.Settings.GetComboBoxText("Barrel Range Mode:") == "Middle Ground")
            {
                barrelConnectionExtendRange = 350;
            }

            foreach (Barrel b in barrelsInQRange)
            {
                List <Geometry.Polygon.Circle> secondBarrelPosition = new List <Geometry.Polygon.Circle>();

                //does 3 iterations of E width
                for (int eWidthIteration = 1; eWidthIteration < eWidthIterationsCap; eWidthIteration++)
                {
                    Vector3 extendingPosition = b.barrel.Position + new Vector3(0, eWidthIteration * (Program.barrelDiameter - 20 / 3), 0);

                    //checks every 15 degrees
                    for (int i = 0; i < 360 / predictionAngleCap; i++)
                    {
                        Vector3 endPosition = extendingPosition.To2D().RotateAroundPoint(b.barrel.Position.To2D(), (float)((i * predictionAngleCap) * Math.PI / 180)).To3D((int)b.barrel.Position.Z);
                        Geometry.Polygon.Circle secondBarrel = new Geometry.Polygon.Circle(endPosition, Program.barrelRadius);

                        secondBarrelPosition.Add(secondBarrel);
                    }
                }

                secondBarrelPosition = secondBarrelPosition.Where(a => a.CenterOfPolygon().IsInRange(Gangplank, Program.E.Range)).ToList();
                secondBarrelPosition = secondBarrelPosition.Where(secondBarrel => secondBarrel.CenterOfPolygon().NearbyBarrelCount(barrelConnectionExtendRange) == 0).ToList();

                foreach (Geometry.Polygon.Circle secondBarrel in secondBarrelPosition)
                {
                    List <Obj_AI_Base> tempEnemiesHitList = enemies.Where(a => a.Position(250).Distance(secondBarrel.CenterOfPolygon()) <= Program.barrelRadius).ToList();
                    int tempEnemiesHit = tempEnemiesHitList.Count();
                    if (tempEnemiesHit > enemiesHit)
                    {
                        enemiesHit     = tempEnemiesHit;
                        enemiesHitList = tempEnemiesHitList;
                        bestPosition   = secondBarrel.CenterOfPolygon().To3D((int)b.barrel.Position.Z);
                    }
                }
            }

            if (enemiesHit >= enemiesToUseEOn)
            {
                return(bestPosition);
            }
            else
            {
                return(Vector3.Zero);
            }
        }
Exemple #41
0
        private void Orbwalker_OnPostAttack(AttackableUnit target, System.EventArgs args)
        {
            var hero = target as AIHeroClient;

            if (hero == null || hero.IsDead || hero.IsZombie ||
                !Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo) ||
                (Tumble.To2StacksOnly && hero.GetSilverStacks() != 1))
            {
                Orbwalker.OnPostAttack -= Orbwalker_OnPostAttack;
                return;
            }

            var unit =
                EntityManager.Heroes.Enemies.Where(
                    index => index.IsValidTarget(Player.Instance.GetAutoAttackRange() + 300))
                    .OrderBy(by => by.Distance(Player.Instance.Position.ExtendPlayerVector()))
                    .FirstOrDefault();

            if (unit == null)
            {
                Orbwalker.OnPostAttack -= Orbwalker_OnPostAttack;
                return;
            }

            if (Tumble.Mode == 1)
            {
                var polygons = Helpers.SegmentedAutoattackPolygons();
                var positions = new List<IEnumerable<Vector2>>();
                var enemies = Player.Instance.CountEnemiesInRange(1200);

                for (var i = 0; i < 4; i++)
                {
                    positions.Add(
                        polygons[i].Points.Where(
                            e =>
                                e.ToVector3().ExtendPlayerVector().IsPositionSafe() &&
                                e.ToVector3().ExtendPlayerVector().Distance(unit, true) > (enemies <= 2 ? 150*150 : 300*300)));
                }

                foreach (var points in positions)
                {
                    if (unit.Distance(Player.Instance.ServerPosition, true) < 425 * 425 && unit.Health > Player.Instance.GetAutoAttackDamage(unit) + (Player.Instance.GetAutoAttackDamage(unit) + Player.Instance.GetAutoAttackDamage(unit) * Helpers.QAdditionalDamage[Q.Level]))
                    {
                        foreach (var point in points.OrderByDescending(index => index.Distance(unit, true)))
                        {
                            if (Tumble.BlockQIfEnemyIsOutsideAaRange)
                            {
                                var polygon = new Geometry.Polygon.Circle(point.ToVector3().GetTumbleEndPos(),
                                    Player.Instance.GetAutoAttackRange());

                                if (polygon.IsInside(unit))
                                {
                                    Q.Cast(point.To3DWorld().ExtendPlayerVector(250));
                                }
                            }
                            else
                            {
                                Q.Cast(point.To3DWorld().ExtendPlayerVector(250));
                            }
                        }
                    }
                    else
                    {
                        foreach (var point in points.OrderBy(index => index.Distance(unit, true)))
                        {
                            if (Tumble.BlockQIfEnemyIsOutsideAaRange)
                            {
                                var polygon = new Geometry.Polygon.Circle(point.ToVector3().GetTumbleEndPos(),
                                    Player.Instance.GetAutoAttackRange());

                                if (polygon.IsInside(unit))
                                {
                                    Q.Cast(point.To3DWorld().ExtendPlayerVector(250));
                                }
                            }
                            else
                            {
                                Q.Cast(point.To3DWorld().ExtendPlayerVector(250));
                            }
                        }
                    }
                }
            }
            else
            {
                if (Game.CursorPos.GetTumbleEndPos().IsPositionSafe())
                {
                    Q.Cast(Game.CursorPos.ExtendPlayerVector(250));
                }
            }
            Orbwalker.OnPostAttack -= Orbwalker_OnPostAttack;
        }
        private Tuple <List <Obj_AI_Hero>, Vector3> GetMaxRHits(HitChance hitChance, Vector3 fromCheck = default(Vector3))
        {
            if (fromCheck.Equals(default(Vector3)))
            {
                fromCheck = ObjectManager.Player.Position;
            }

            var input = new PredictionInput
            {
                Collision        = true,
                CollisionObjects = new[] { CollisionableObjects.YasuoWall },
                From             = fromCheck,
                RangeCheckFrom   = fromCheck,
                Type             = R.Type,
                Radius           = R.Width,
                Delay            = R.Delay,
                Speed            = R.Speed,
                Range            = R.Range,
                Aoe = true
            };

            var castPosition = Vector3.Zero;
            var totalHits    = new List <Obj_AI_Hero>();

            try
            {
                var positions = new List <CPrediction.Position>();
                foreach (var t in GameObjects.EnemyHeroes)
                {
                    if (t.IsValidTarget(R.Range * 1.5f, true, fromCheck))
                    {
                        input.Unit = t;
                        var prediction = Prediction.GetPrediction(input);
                        if (prediction.Hitchance >= hitChance)
                        {
                            positions.Add(new CPrediction.Position(t, prediction.UnitPosition));
                        }
                    }
                }
                var circle = new Geometry.Polygon.Circle(fromCheck, R.Range).Points;
                foreach (var point in circle)
                {
                    var hits = new List <Obj_AI_Hero>();
                    foreach (var position in positions)
                    {
                        R.UpdateSourcePosition(fromCheck, fromCheck);
                        if (R.WillHit(position.UnitPosition, point.To3D()))
                        {
                            hits.Add(position.Hero);
                        }
                        R.UpdateSourcePosition();
                    }
                    if (hits.Count > totalHits.Count)
                    {
                        castPosition = point.To3D();
                        totalHits    = hits;
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(new Tuple <List <Obj_AI_Hero>, Vector3>(totalHits, castPosition));
        }
Exemple #43
0
        //complete
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (Yasuo.IsDead)
                return;

            System.Drawing.Color drawColor = System.Drawing.Color.Blue;

            if (MenuHandler.GetCheckboxValue(MenuHandler.Drawing, "Draw Q") && !Yasuo.HasBuff("YasuoQ3W") && Q.IsLearned)
                Q.DrawRange(drawColor);
            if (MenuHandler.GetCheckboxValue(MenuHandler.Drawing, "Draw Q") && Yasuo.HasBuff("YasuoQ3W") && Q.IsLearned)
                Q3.DrawRange(drawColor);
            if (MenuHandler.GetCheckboxValue(MenuHandler.Drawing, "Draw W") && W.IsLearned)
                W.DrawRange(drawColor);
            if (MenuHandler.GetCheckboxValue(MenuHandler.Drawing, "Draw E") && E.IsLearned)
                E.DrawRange(drawColor);
            if (MenuHandler.GetCheckboxValue(MenuHandler.Drawing, "Draw EQ") && E.IsLearned && Q.IsLearned)
                EQ.DrawRange(drawColor);
            if (MenuHandler.GetCheckboxValue(MenuHandler.Drawing, "Draw R") && R.IsLearned)
                R.DrawRange(drawColor);
            if (MenuHandler.GetCheckboxValue(MenuHandler.Drawing, "Draw Beyblade") && R.IsLearned && Flash != null && E.IsLearned && Q.IsLearned)
                Drawing.DrawCircle(Yasuo.Position, E.Range + Flash.Range + (EQ.Range / 2), System.Drawing.Color.Red);
            if (MenuHandler.GetCheckboxValue(MenuHandler.Drawing, "Draw Turret Range"))
                foreach (Obj_AI_Turret turret in EntityManager.Turrets.Enemies.Where(a => !a.IsDead))
                    turret.DrawCircle((int)turret.GetAutoAttackRange() + 35, drawColor);

            Obj_AI_Base hoverObject = EntityManager.Enemies.Where(a => !a.IsDead && a.IsTargetable && a.IsInRange(Yasuo, E.Range) && a.Distance(Game.CursorPos) <= 75).OrderBy(a => a.Distance(Game.CursorPos)).FirstOrDefault();
            if (hoverObject != null)
            {
                if (MenuHandler.GetCheckboxValue(MenuHandler.Drawing, "Draw EQ on Target"))
                    Drawing.DrawCircle(YasuoCalcs.GetDashingEnd(hoverObject), EQ.Range, drawColor);
                if (MenuHandler.GetCheckboxValue(MenuHandler.Drawing, "Draw E End Position on Target"))
                    Drawing.DrawLine(Yasuo.Position.WorldToScreen(), YasuoCalcs.GetDashingEnd(hoverObject).WorldToScreen(), 3, drawColor);
                if (MenuHandler.GetCheckboxValue(MenuHandler.Drawing, "Draw E End Position on Target - Detailed"))
                {
                    Vector3 startPos = Yasuo.Position,
                        dashEndPos = YasuoCalcs.GetDashingEnd(hoverObject),
                        fakeEndPos = startPos.To2D().Extend(dashEndPos.To2D(), 1000).To3D() + new Vector3(0, 0, startPos.Z),
                        slope = new Vector3(dashEndPos.X - startPos.X, dashEndPos.Y - startPos.Y, 0),
                        fakeSlope = new Vector3(fakeEndPos.X - startPos.X, fakeEndPos.Y - startPos.Y, 0);

                    List<Vector3> pointsAlongPath = new List<Vector3>();
                    List<Vector3> straightLinePath = new List<Vector3>();

                    int points = 100;

                    pointsAlongPath.Add(startPos);
                    
                    //get all points in a line from start to fake end
                    for(int i = 0; i < points; i++)
                        straightLinePath.Add(startPos + (i * (fakeSlope / points)));

                    bool isWall = false;

                    //get all wall start and end positions
                    for (int i = 0; i < points; i++)
                    {
                        //wall start
                        if (!isWall && straightLinePath[i].IsWall())
                        {
                            pointsAlongPath.Add(straightLinePath[i]);
                            isWall = true;
                        }
                        //wall end
                        if (isWall && !straightLinePath[i].IsWall())
                        {
                            pointsAlongPath.Add(straightLinePath[i]);
                            isWall = false;
                        }
                    }

                    pointsAlongPath.Add(fakeEndPos);

                    for(int i = 0; i < pointsAlongPath.Count() - 1; i++)
                    {
                        System.Drawing.Color color = (pointsAlongPath[i].IsWall()) ? System.Drawing.Color.Red : System.Drawing.Color.Green;
                        Drawing.DrawLine(pointsAlongPath[i].WorldToScreen(), pointsAlongPath[i + 1].WorldToScreen(), 2, color);
                    }

                    Vector3 closestWall = pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(dashEndPos)).FirstOrDefault(),
                        closestWallsEndPosition = (pointsAlongPath.IndexOf(closestWall) + 1 == pointsAlongPath.Count) ? Vector3.Zero : pointsAlongPath[pointsAlongPath.IndexOf(closestWall) + 1];

                    Drawing.DrawText(closestWall.WorldToScreen(), drawColor, "start", 15);
                    Drawing.DrawText(closestWallsEndPosition.WorldToScreen(), drawColor, "end", 15);
                    Drawing.DrawText(((closestWall + closestWallsEndPosition) / 2).WorldToScreen(), drawColor, closestWall.Distance(closestWallsEndPosition).ToString(), 15);
                    Drawing.DrawText(dashEndPos.WorldToScreen(), drawColor, startPos.Distance(closestWallsEndPosition).ToString(), 15);

                    //none of the points are a wall so the end point is the dash position
                    if (!pointsAlongPath.Any(a => a.IsWall()))
                        Drawing.DrawCircle(dashEndPos, 50, drawColor);
                    // OR none of the walls are in the E range
                    else if (pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(startPos)).FirstOrDefault() != null &&
                        pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(startPos)).FirstOrDefault().Distance(startPos) > E.Range)
                        Drawing.DrawCircle(dashEndPos, 50, drawColor);
                    //or the dashing end is not a wall
                    else if (!dashEndPos.IsWall())
                        Drawing.DrawCircle(dashEndPos, 50, drawColor);
                    //find the nearest wall to the dash position
                    else if (closestWall != Vector3.Zero && closestWallsEndPosition != Vector3.Zero &&
                        closestWall != null && closestWallsEndPosition != null &&
                        closestWallsEndPosition.Distance(dashEndPos) < closestWall.Distance(dashEndPos) &&
                        startPos.Distance(closestWallsEndPosition) <= 630)
                        Drawing.DrawCircle(closestWallsEndPosition, 50, drawColor);
                    //the end position is the first wall
                    else
                        Drawing.DrawCircle(pointsAlongPath.First(a => a.IsWall()), 50, drawColor);
                }
            }

            if (MenuHandler.GetCheckboxValue(MenuHandler.Drawing, "Draw Wall Dashes") && E.IsLearned)
                foreach (WallDash wd in YasuoWallDashDatabase.wallDashDatabase.Where(a=>a.startPosition.Distance(Yasuo) <= 1300))
                    if (EntityManager.MinionsAndMonsters.Combined.Where(a => a.MeetsCriteria() && a.Name == wd.unitName && a.ServerPosition.Distance(wd.dashUnitPosition) <= 2).FirstOrDefault() != null)
                    {
                        wd.startPosition.DrawArrow(wd.endPosition, System.Drawing.Color.Red, 1);
                        Geometry.Polygon.Circle dashCircle = new Geometry.Polygon.Circle(wd.endPosition, 120);
                        dashCircle.Draw(System.Drawing.Color.Red, 1);
                    }
        }
        //complete
        public static void Flee()
        {
            WallDash activeDash = null;

            Menu menu = MenuHandler.Flee;

            if (menu.GetCheckboxValue("Wall Dash") && Program.E.IsReady() && !YasuoCalcs.IsDashing())
            {
                //walldash
                foreach (WallDash wd in YasuoWallDashDatabase.wallDashDatabase.Where(a => a.startPosition.Distance(Yasuo) <= 1300))
                {
                    if (EntityManager.MinionsAndMonsters.Combined.Where(a => a.MeetsCriteria() && a.Name == wd.unitName && a.ServerPosition.Distance(wd.dashUnitPosition) <= 2).FirstOrDefault() != null)
                    {
                        Geometry.Polygon.Circle dashCircle = new Geometry.Polygon.Circle(wd.endPosition, 120);
                        if (dashCircle.IsInside(Game.CursorPos))
                        {
                            activeDash = wd;
                            break;
                        }
                    }
                }
            }

            if (menu.GetCheckboxValue("Use E") || activeDash != null)
            {
                if (activeDash == null)
                {
                    Orbwalker.MoveTo(Game.CursorPos);
                    EToMouse(menu.GetCheckboxValue("Use E Under Tower"), menu.GetCheckboxValue("Stack Q"), false);
                }
                else
                {
                    //first check if the positions are exact
                    if (Yasuo.Position.To2D() == activeDash.startPosition.To2D())
                    {
                        CastE(EntityManager.MinionsAndMonsters.Combined.Where(a => a.Name == activeDash.unitName).ToList().ToObj_AI_BaseList(), false, menu.GetCheckboxValue("Use E Under Tower"));
                    }
                    else
                    {
                        Orbwalker.MoveTo(activeDash.startPosition);
                    }

                    //if the positions aren't exact
                    //if (Yasuo.Position.Distance(activeDash.startPosition) > 50)
                    //    return;

                    Vector3 startPos           = Yasuo.Position,
                            dashEndPos         = YasuoCalcs.GetDashingEnd(EntityManager.MinionsAndMonsters.Combined.Where(a => a.MeetsCriteria() && YasuoCalcs.ERequirements(a, MenuHandler.GetCheckboxValue(MenuHandler.Flee, "Use E Under Tower")) && a.Name == activeDash.unitName).FirstOrDefault()),
                            fakeEndPos         = startPos.To2D().Extend(dashEndPos.To2D(), 1000).To3D() + new Vector3(0, 0, startPos.Z),
                            slope              = new Vector3(dashEndPos.X - startPos.X, dashEndPos.Y - startPos.Y, 0),
                            fakeSlope          = new Vector3(fakeEndPos.X - startPos.X, fakeEndPos.Y - startPos.Y, 0),
                            actualDashPosition = Vector3.Zero;

                    List <Vector3> pointsAlongPath  = new List <Vector3>();
                    List <Vector3> straightLinePath = new List <Vector3>();

                    int points = 100;

                    pointsAlongPath.Add(startPos);

                    //get all points in a line from start to fake end
                    for (int i = 0; i < points; i++)
                    {
                        straightLinePath.Add(startPos + (i * (fakeSlope / points)));
                    }

                    bool isWall = false;

                    //get all wall start and end positions
                    for (int i = 0; i < points; i++)
                    {
                        //wall start
                        if (!isWall && straightLinePath[i].IsWall())
                        {
                            pointsAlongPath.Add(straightLinePath[i]);
                            isWall = true;
                        }
                        //wall end
                        if (isWall && !straightLinePath[i].IsWall())
                        {
                            pointsAlongPath.Add(straightLinePath[i]);
                            isWall = false;
                        }
                    }

                    pointsAlongPath.Add(fakeEndPos);

                    Vector3 closestWall             = pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(dashEndPos)).FirstOrDefault(),
                            closestWallsEndPosition = (pointsAlongPath.IndexOf(closestWall) + 1 == pointsAlongPath.Count) ? Vector3.Zero : pointsAlongPath[pointsAlongPath.IndexOf(closestWall) + 1];

                    //none of the points are a wall so the end point is the dash position
                    if (!pointsAlongPath.Any(a => a.IsWall()))
                    {
                        actualDashPosition = dashEndPos;
                    }
                    // OR none of the walls are in the E range
                    else if (pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(startPos)).FirstOrDefault() != null &&
                             pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(startPos)).FirstOrDefault().Distance(startPos) > Program.E.Range)
                    {
                        actualDashPosition = dashEndPos;
                    }
                    //or the dashing end is not a wall
                    else if (!dashEndPos.IsWall())
                    {
                        actualDashPosition = dashEndPos;
                    }
                    //find the nearest wall to the dash position
                    else if (closestWall != Vector3.Zero && closestWallsEndPosition != Vector3.Zero &&
                             closestWall != null && closestWallsEndPosition != null &&
                             closestWallsEndPosition.Distance(dashEndPos) < closestWall.Distance(dashEndPos) &&
                             startPos.Distance(closestWallsEndPosition) <= 630)
                    {
                        actualDashPosition = closestWallsEndPosition;
                    }
                    //the end position is the first wall
                    else
                    {
                        actualDashPosition = pointsAlongPath.First(a => a.IsWall());
                    }

                    //if the end position is close enough to the walldash position, dash
                    if (actualDashPosition.Distance(activeDash.endPosition) <= menu.GetSliderValue("Wall Dash Extra Space"))
                    {
                        CastE(EntityManager.MinionsAndMonsters.Combined.Where(a => a.MeetsCriteria() && YasuoCalcs.ERequirements(a, menu.GetCheckboxValue("Use E Under Tower")) && a.Name == activeDash.unitName).FirstOrDefault());
                    }
                }
            }
        }
Exemple #45
0
        //------------------------------------AIHeroClient_OnProcessSpellCast-------------------------------------

        static void AIHeroClient_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (sender.IsEnemy)
            {
                if (Q.IsReady() && args.SData.Name.ToLower() == "summonerflash" && args.End.Distance(Player) <= Q.Range && Menu["AutoQFlash"].Cast<CheckBox>().CurrentValue)
                {
                    //Chat.Print("{0} detected, Q on args.End", args.SData.Name);
                    var rectangle = new Geometry.Polygon.Rectangle(Player.Position, args.End, Q.Width+20);

                    if ( !EntityManager.MinionsAndMonsters.EnemyMinions.Any( it => rectangle.IsInside(it) ) ) Q.Cast(args.End);
                    return;
                }

                if (E.IsReady() && EMenu["UseShield?"].Cast<CheckBox>().CurrentValue && MenuSpells.Any(it => it == args.SData.Name))
                {
                    if (EMenu[args.SData.Name].Cast<CheckBox>().CurrentValue)
                    {
                        List<AIHeroClient> Allies = new List<AIHeroClient>();

                        //Division
                        if (args.Target != null)
                        {
                            if (args.Target.IsAlly || args.Target.IsMe)
                            {
                                var target = EntityManager.Heroes.Allies.FirstOrDefault(it => it.NetworkId == args.Target.NetworkId);

                                //Chat.Print(args.Target.Name);

                                if (target != null)
                                {
                                    int delay = (int)((sender.Distance(target) / ((args.SData.MissileMaxSpeed + args.SData.MissileMinSpeed) / 2)) * 1000 + args.SData.SpellCastTime - 300 - Game.Ping);

                                    Core.DelayAction(() => E.Cast(target), delay);
                                    //Chat.Print("Targetted detection");
                                }
                                return;
                            }
                        }

                        //Division

                        var rectangle = new Geometry.Polygon.Rectangle(args.Start, args.End, args.SData.LineWidth);

                        foreach (var ally in EntityManager.Heroes.Allies)
                        {
                            if (rectangle.IsInside(ally)) { Allies.Add(ally); continue; }

                            foreach (var point in rectangle.Points)
                            {
                                if (ally.Distance(point) <= 90)
                                {
                                    Allies.Add(ally);
                                }
                            }
                        }

                        if (Allies.Any())
                        {
                            //Chat.Print("Rectangle Detection");

                            PriorityCast(sender, args, Allies, rectangle);
                            return;
                        }

                        //Division

                        var circle = new Geometry.Polygon.Circle(args.End, args.SData.CastRadius);

                        foreach (var ally in EntityManager.Heroes.Allies)
                        {
                            if (circle.IsInside(ally)) { Allies.Add(ally); continue; }

                            foreach (var point in circle.Points)
                            {
                                if (ally.Distance(point) <= 90)
                                {
                                    Allies.Add(ally);
                                }
                            }
                        }

                        if (Allies.Any())
                        {
                            //Chat.Print("Circle Detection");

                            PriorityCast(sender, args, Allies, circle);
                            return;
                        }
                    }
                }
            }

            return;
        }
Exemple #46
0
 private static Vector3 GetPointNearMe(int range)
 {
     var circle = new Geometry.Polygon.Circle(Player.Instance.ServerPosition.To2D(), range).ToClipperPath();
     var point = circle.OrderBy(p => Rnd.Next()).FirstOrDefault();
     return new Vector2(point.X, point.Y).To3D();
 }
Exemple #47
0
        private static void AIHeroClient_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if ((args.Slot == SpellSlot.Q || args.Slot == SpellSlot.W || args.Slot == SpellSlot.E ||
                 args.Slot == SpellSlot.R) && sender.IsEnemy && _e.IsReady())
            {
                if (args.SData.TargettingType == SpellDataTargetType.Unit ||
                    args.SData.TargettingType == SpellDataTargetType.SelfAndUnit ||
                    args.SData.TargettingType == SpellDataTargetType.Self)
                {
                    if ((args.Target.NetworkId == Player.Instance.NetworkId && args.Time < 1.5 ||
                         args.End.Distance(Player.Instance.ServerPosition) <= Player.Instance.BoundingRadius*3) &&
                        MainMenu.Misc[args.SData.Name].Cast<CheckBox>().CurrentValue)
                    {
                        _e.Cast();
                    }
                }
                else if (args.SData.TargettingType == SpellDataTargetType.LocationAoe)
                {
                    var castvector =
                        new Geometry.Polygon.Circle(args.End, args.SData.CastRadius).IsInside(
                            Player.Instance.ServerPosition);

                    if (castvector && MainMenu.Misc[args.SData.Name].Cast<CheckBox>().CurrentValue)
                    {
                        _e.Cast();
                    }
                }

                else if (args.SData.TargettingType == SpellDataTargetType.Cone)
                {
                    var castvector =
                        new Geometry.Polygon.Arc(args.Start, args.End, args.SData.CastConeAngle, args.SData.CastRange)
                            .IsInside(Player.Instance.ServerPosition);

                    if (castvector && MainMenu.Misc[args.SData.Name].Cast<CheckBox>().CurrentValue)
                    {
                        _e.Cast();
                    }
                }

                else if (args.SData.TargettingType == SpellDataTargetType.SelfAoe)
                {
                    var castvector =
                        new Geometry.Polygon.Circle(sender.ServerPosition, args.SData.CastRadius).IsInside(
                            Player.Instance.ServerPosition);

                    if (castvector && MainMenu.Misc[args.SData.Name].Cast<CheckBox>().CurrentValue)
                    {
                        _e.Cast();
                    }
                }
                else
                {
                    var castvector =
                        new Geometry.Polygon.Rectangle(args.Start, args.End, args.SData.LineWidth).IsInside(
                            Player.Instance.ServerPosition);

                    if (castvector && MainMenu.Misc[args.SData.Name].Cast<CheckBox>().CurrentValue)
                    {
                        _e.Cast();
                    }
                }
            }
        }
Exemple #48
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="vector"></param>
 /// <param name="unit"></param>
 /// <param name="range"></param>
 /// <returns></returns>
 public static bool IsInsideUnitsRange(this Vector3 vector, AIHeroClient unit, float range)
 {
     var polygon = new Geometry.Polygon.Circle(unit.ServerPosition, range);
     return polygon.IsInside(vector);
 }