Exemplo n.º 1
0
        // This is for sona only atm.
        public static Obj_AI_Hero GetEnemyHitByR(Spell R, int numHit)
        {
            int         totalHit = 0;
            Obj_AI_Hero target   = null;

            foreach (Obj_AI_Hero current in ObjectManager.Get <Obj_AI_Hero>())
            {
                var prediction = R.GetPrediction(current, true);

                if (Vector3.Distance(ObjectManager.Player.Position, prediction.CastPosition) <= R.Range)
                {
                    Vector2 extended = current.Position.To2D().Extend(ObjectManager.Player.Position.To2D(), -R.Range + Vector2.Distance(ObjectManager.Player.Position.To2D(), current.Position.To2D()));
                    rect = new Geometry.Rectangle(ObjectManager.Player.Position.To2D(), extended, R.Width);

                    if (!current.IsMe && current.IsEnemy)
                    {
                        // SEt to 1 as the current target is hittable.
                        totalHit = 1;
                        foreach (var enemy in ObjectManager.Get <Obj_AI_Hero>())
                        {
                            if (enemy.IsEnemy && current.ChampionName != enemy.ChampionName && !enemy.IsDead && !rect.ToPolygon().IsOutside(enemy.Position.To2D()))
                            {
                                totalHit += 1;
                            }
                        }
                    }

                    if (totalHit >= numHit)
                    {
                        target = current;
                        break;
                    }
                }
            }

            Console.WriteLine(Game.Time + " | Targets hit is: " + totalHit + " Out of " + numHit);
            return(target);
        }
Exemplo n.º 2
0
        // This is for sona only atm.
        public static Obj_AI_Hero GetEnemyHitByR(Spell R, int numHit) {
            int totalHit = 0;
            Obj_AI_Hero target = null;

            foreach (Obj_AI_Hero current in ObjectManager.Get<Obj_AI_Hero>()) {

                var prediction = R.GetPrediction(current, true);

                if (Vector3.Distance(ObjectManager.Player.Position, prediction.CastPosition) <= R.Range) {
                    
                    Vector2 extended = current.Position.To2D().Extend(ObjectManager.Player.Position.To2D(), -R.Range + Vector2.Distance(ObjectManager.Player.Position.To2D(), current.Position.To2D()));
                    rect = new Geometry.Rectangle(ObjectManager.Player.Position.To2D(), extended, R.Width);

                    if (!current.IsMe && current.IsEnemy) {
                        // SEt to 1 as the current target is hittable.
                        totalHit = 1;
                        foreach (var enemy in ObjectManager.Get<Obj_AI_Hero>()) {
                            if (enemy.IsEnemy && current.ChampionName != enemy.ChampionName && !enemy.IsDead && !rect.ToPolygon().IsOutside(enemy.Position.To2D())) {
                                totalHit += 1;
                            }
                        }
                    }

                    if (totalHit >= numHit) {
                        target = current;
                        break;
                    }
                }

            }

            Console.WriteLine(Game.Time + " | Targets hit is: " + totalHit + " Out of " + numHit);
            return target;
        }