示例#1
0
        private static void Laneclearrange()
        {
            if (GetValue("minmana") > Player.ManaPercent)
            {
                return;
            }
            var min =
                ObjectManager.Get <Obj_AI_Minion>()
                .Where(x => x.Distance(Player) < Q.Range - 200 && !x.IsDead && x.IsEnemy && x.IsTargetable);


            var objAiMinions = min as IList <Obj_AI_Minion> ?? min.ToList();

            foreach (var minions in objAiMinions)
            {
                minionscircle = new Geometry.Polygon.Circle(minions.Position, 250);
            }

            var count = objAiMinions.Where(x => minionscircle.IsInside(x));

            if (count.Count() < GetValue("minhitwq"))
            {
                return;
            }
            if (!Ismelee() && Q.IsReady() && GetBool("useqlr", typeof(bool)))
            {
                Q.Cast(minionscircle.Center);
            }
        }
示例#2
0
 private int GetWHits(Obj_AI_Base target, List <Obj_AI_Base> targets = null, CardColor color = CardColor.Gold)
 {
     try
     {
         if (targets != null && color == CardColor.Red)
         {
             targets = targets.Where(t => t.IsValidTarget((W.Range + W.Width) * 1.5f)).ToList();
             var pred = W.GetPrediction(target);
             if (pred.Hitchance >= HitChance.Medium)
             {
                 var circle = new Geometry.Polygon.Circle(pred.UnitPosition, target.BoundingRadius + WRedRadius);
                 return(1 + (from t in targets.Where(x => x.NetworkId != target.NetworkId)
                             let pred2 = W.GetPrediction(t)
                                         where pred2.Hitchance >= HitChance.Medium
                                         select new Geometry.Polygon.Circle(pred2.UnitPosition, t.BoundingRadius * 0.9f)).Count(
                            circle2 => circle2.Points.Any(p => circle.IsInside(p))));
             }
         }
         if (W.IsInRange(target))
         {
             return(1);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return(0);
 }
示例#3
0
        private static void CastMec(Spell spell, int minHit)
        {
            if (!spell.IsReady() || ObjectManager.Player.HealthPercent <= 10)
            {
                return;
            }

            foreach (var target in HeroManager.Enemies.Where(x => x.IsValidTarget(spell.Range)))
            {
                var pred = spell.GetPrediction(target, true);

                var nearByEnemies = 1;

                if (spell.Type == SkillshotType.SkillshotLine && spell.Collision)
                {
                    var poly = new Geometry.Polygon.Circle(pred.UnitPosition, spell.Width);

                    nearByEnemies +=
                        HeroManager.Enemies.Where(x => x.NetworkId != target.NetworkId)
                        .Count(enemy => poly.IsInside(enemy.ServerPosition));
                }
                else
                {
                    nearByEnemies = pred.AoeTargetsHitCount;
                }

                if (nearByEnemies >= minHit)
                {
                    spell.Cast(target);
                    return;
                }
            }
        }
示例#4
0
        private static int GetWHits(Obj_AI_Base target, List <Obj_AI_Base> targets = null)
        {
            if (targets != null && ComboMode == ComboMode.Mode2xW)
            {
                targets = targets.Where(t => t.IsValidTarget((W.Range + W.Width))).ToList();
                var pred = W.GetPrediction(target);
                if (pred.Hitchance >= HitChance.Medium)
                {
                    var circle = new Geometry.Polygon.Circle(pred.UnitPosition, target.BoundingRadius + W.Width);
                    circle.Draw(System.Drawing.Color.Aqua, 5);

                    return(1 + (from t in targets.Where(x => x.NetworkId != target.NetworkId)
                                let pred2 = W.GetPrediction(t)
                                            where pred2.Hitchance >= HitChance.Medium
                                            select new Geometry.Polygon.Circle(pred2.UnitPosition, t.BoundingRadius * 0.9f)).Count(
                               circle2 => circle2.Points.Any(p => circle.IsInside(p))));
                }
            }

            if (W.IsInRange(target))
            {
                return(1);
            }
            return(0);
        }
示例#5
0
 private Vector3 BestRFollowLocation(Vector3 position)
 {
     try
     {
         var   center        = Vector2.Zero;
         float radius        = -1;
         var   count         = 0;
         var   moveDistance  = -1f;
         var   maxRelocation = IsSpellUpgraded(R) ? R.Width * 1.2f : R.Width * 0.8f;
         var   targets       = GameObjects.EnemyHeroes.Where(t => t.IsValidTarget(1500f)).ToList();
         var   circle        = new Geometry.Polygon.Circle(position, R.Width);
         if (targets.Any())
         {
             var minDistance   = targets.Any(t => circle.IsInside(t)) ? targets.Min(t => t.BoundingRadius) * 2 : 0;
             var possibilities =
                 ListExtensions.ProduceEnumeration(targets.Select(t => t.Position.To2D()).ToList())
                 .Where(p => p.Count > 1)
                 .ToList();
             if (possibilities.Any())
             {
                 foreach (var possibility in possibilities)
                 {
                     var mec      = MEC.GetMec(possibility);
                     var distance = position.Distance(mec.Center.To3D());
                     if (mec.Radius < R.Width && distance < maxRelocation && distance > minDistance)
                     {
                         if (possibility.Count > count ||
                             possibility.Count == count && (mec.Radius < radius || distance < moveDistance))
                         {
                             moveDistance = position.Distance(mec.Center.To3D());
                             center       = mec.Center;
                             radius       = mec.Radius;
                             count        = possibility.Count;
                         }
                     }
                 }
                 if (!center.Equals(Vector2.Zero))
                 {
                     return(center.To3D());
                 }
             }
             var dTarget = targets.OrderBy(t => t.Distance(position)).FirstOrDefault();
             if (dTarget != null && position.Distance(dTarget.Position) > minDistance)
             {
                 return(dTarget.Position);
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return(Vector3.Zero);
 }
示例#6
0
        private static void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (Player.Instance.IsDead)
            {
                return;
            }

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

            if ((heroSender != null) && (target != null) && Champions.Exists(x => target.NetworkId == x) &&
                !Equals(target.Team, heroSender.Team))
            {
                IncomingDamages.Add(new IncomingDamageArgs
                {
                    Sender      = heroSender,
                    Target      = target,
                    Tick        = Core.GameTickCount,
                    Damage      = heroSender.GetSpellDamageCached(target, args.Slot),
                    IsTargetted = true
                });
            }
            if ((heroSender == null) || (target != null))
            {
                return;
            }

            if (args.SData.TargettingType != SpellDataTargetType.LocationAoe)
            {
                return;
            }

            var polygon  = new Geometry.Polygon.Circle(args.End, args.SData.CastRadius);
            var polygon2 = new Geometry.Polygon.Circle(args.End, args.SData.CastRadiusSecondary);

            foreach (
                var hero in
                EntityManager.Heroes.AllHeroes.Where(
                    ally =>
                    (Champions.Exists(x => ally.NetworkId == x) && polygon.IsInside(ally)) ||
                    (polygon2.IsInside(ally) && (ally.Team != heroSender.Team))))
            {
                IncomingDamages.Add(new IncomingDamageArgs
                {
                    Sender       = heroSender,
                    Target       = hero,
                    IsSkillShot  = true,
                    Damage       = heroSender.GetSpellDamageCached(hero, heroSender.GetSpellSlotFromName(args.SData.Name)),
                    Tick         = Core.GameTickCount,
                    IsTargetted  = false,
                    IsTurretShot = false
                });
            }
        }
示例#7
0
        private static void Laneclearmelee()
        {
            if (GetValue("minmana") > Player.ManaPercent)
            {
                return;
            }
            if (!Ismelee())
            {
                return;
            }
            var min =
                ObjectManager.Get <Obj_AI_Minion>()
                .Where(x => x.Distance(Player) < 300 && !x.IsDead && x.IsEnemy).ToList();

            if (min.FirstOrDefault() == null)
            {
                minionscirclemelee = null;
                return;
            }



            foreach (var minions in min)
            {
                minionscirclemelee = new Geometry.Polygon.Circle(minions.Position, 300);
                if (E.IsReady() && GetBool("useelm", typeof(bool)))
                {
                    if (minions.Health < EMeleeDamage(minions))
                    {
                        Em.Cast(minions);
                    }
                }
            }

            var count        = min.Where(x => minionscirclemelee.IsInside(x));
            var objAiMinions = count as IList <Obj_AI_Minion> ?? count.ToList();

            if (objAiMinions.Count() >= GetValue("minhitwq"))
            {
                if (W.IsReady() && GetBool("usewlm", typeof(bool)))
                {
                    W.Cast();
                }

                if (Q.IsReady() && GetBool("useqlm", typeof(bool)))
                {
                    Qm.Cast(objAiMinions.FirstOrDefault());
                }
            }
        }
示例#8
0
        /// <summary>
        /// Get the ultimate explosion hit count with best location
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        private Tuple <int, List <Obj_AI_Hero>, Vector3> GetUltimateExplosionHits(Obj_AI_Hero target)
        {
            var hits         = new List <Obj_AI_Hero>();
            var castPosition = Vector3.Zero;

            try
            {
                var prediction = R.GetPrediction(target);
                if (prediction.Hitchance >= R.GetHitChance("combo"))
                {
                    castPosition = prediction.CastPosition;
                    hits.Add(target);

                    var explosion = new PredictionInput
                    {
                        Range          = UltimateExplosion.Range,
                        Delay          = Player.Position.Distance(castPosition) / R.Speed + 0.1f,
                        From           = castPosition,
                        RangeCheckFrom = castPosition,
                        Radius         = UltimateExplosion.Width,
                        Type           = SkillshotType.SkillshotCircle,
                        Speed          = UltimateExplosion.Speed
                    };

                    var explosionCircle = new Geometry.Polygon.Circle(castPosition, UltimateExplosion.Width);

                    foreach (var enemy in GameObjects.EnemyHeroes.Where(e => e.IsValidTarget() && e.NetworkId != target.NetworkId))
                    {
                        explosion.Unit = enemy;
                        var explosionPrediction = Prediction.GetPrediction(explosion);
                        if (!explosionPrediction.UnitPosition.Equals(Vector3.Zero))
                        {
                            var enemyPosition = new Geometry.Polygon.Circle(enemy.Position, enemy.BoundingRadius);
                            if (enemyPosition.Points.Any(p => explosionCircle.IsInside(p)))
                            {
                                hits.Add(enemy);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }

            return(new Tuple <int, List <Obj_AI_Hero>, Vector3>(hits.Count, hits, castPosition));
        }
示例#9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="minimalObjectHitCount"></param>
        /// <param name="ownPosArray">if null minion positions will be checked</param>
        /// <param name="mainIndex">Index in the array which has to get hit</param>
        private void DoArcCalculations(int minimalObjectHitCount, List <Vector2> ownPosArray = null, int mainIndex = -1)
        {
            // ReSharper disable once UnusedVariable
            Task t = Task.Factory.StartNew(() =>
            {
                Vector2 mostHitsPos = new Vector2();
                int hitCount        = 0;

                float quality = config.predictionMenu.Get <Slider>("betterQLogicQuality").CurrentValue / 100.0f;
                float step    = 50 - (quality * 49);
                float step2   = Q.Range / 2 - (quality * 365);

                for (float i = 0; i < 361; i += step)
                {
                    for (float range = Q.Range; range > (int)me.BoundingRadius; range -= step2)
                    {
                        Vector2 pointOnCirc = ArcMyWay.PointOnCircle(range, i, me.Position.To2D());

                        var polyTuple  = new ArcMyWay(me.Position.To2D(), pointOnCirc, (int)me.BoundingRadius).ToPolygonA();
                        var arcPolygon = polyTuple.Item1;
                        var center     = polyTuple.Item2;

                        Geometry.Polygon.Circle qCircle = new Geometry.Polygon.Circle(center, qRadius, (int)quality);

                        int objectHitCount = ownPosArray != null ? ownPosArray.Count(x => arcPolygon.IsInside(x) || qCircle.IsInside(x))
                            : EntityManager.MinionsAndMonsters.EnemyMinions.Count(x => arcPolygon.IsInside(x.Position) ||
                                                                                  qCircle.IsInside(x.Position));

                        if ((hitCount == 0 || objectHitCount > hitCount) && objectHitCount >= minimalObjectHitCount)
                        {
                            // ReSharper disable once PossibleNullReferenceException
                            bool mainTargetHit = mainIndex > -1 &&
                                                 isMainVectorInPolygon(ownPosArray[mainIndex], arcPolygon, qCircle);
                            if (mainTargetHit || mainIndex == -1)
                            {
                                hitCount    = objectHitCount;
                                mostHitsPos = pointOnCirc;
                            }
                        }
                    }
                }

                if (mostHitsPos != new Vector2())
                {
                    Q.Cast(mostHitsPos.To3D());
                }
            });
        }
示例#10
0
        private static void RCasting()
        {
            var target = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Magical);

            if (target == null)
            {
                return;
            }
            var barr = Barrel;
            var pos  = RCastPosition(target, barr);

            if (pos.IsValid() && R.IsReady())
            {
                R.Cast(pos);
            }
            if (CirclePoly == null)
            {
                return;
            }
            if (Q2.IsReady() && CirclePoly.IsInside(target))
            {
                Q2.Cast();
            }
        }
示例#11
0
        private static void Combo()
        {
            var dist           = Config.Item("MinERangeCombo").GetValue <Slider>().Value;
            var target         = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);
            var eCombo         = Config.Item("UseECombo").GetValue <bool>();
            var rCombo         = Config.Item("UseRCombo").GetValue <bool>();
            var rComboKillable = Config.Item("UseRComboKillable").GetValue <bool>();
            var rComboAoE      = Config.Item("UseRAoE").GetValue <bool>();
            var useIgnite      = Config.Item("UseIgnite").GetValue <bool>();
            var useItems       = Config.Item("UseItems").GetValue <bool>();

            if (target == null)
            {
                return;
            }

            if (E.IsReady() && Player.Distance(target.ServerPosition) >= dist && eCombo && target.IsValidTarget(E.Range))
            {
                E.Cast(target);
            }

            if (R.IsReady() && rCombo && target.IsValidTarget(R.Range))
            {
                if (target.HasBuff("xenzhaointimidate"))
                {
                    R.Cast();
                }
            }

            if (ComboDamage(target) > target.Health && R.IsReady() && rComboKillable && target.IsValidTarget(R.Range))
            {
                if (target.HasBuff("xenzhaointimidate"))
                {
                    R.Cast();
                }
            }

            if (R.IsReady() && rComboAoE)
            {
                // xsalice :v)
                foreach (var target1 in HeroManager.Enemies.Where(x => x.IsValidTarget(R.Range)))
                {
                    var poly          = new Geometry.Polygon.Circle(Player.Position, R.Range);
                    var nearByEnemies = 1;
                    nearByEnemies +=
                        HeroManager.Enemies.Where(x => x.NetworkId != target1.NetworkId)
                        .Count(enemy => poly.IsInside(enemy));
                    if (nearByEnemies >= Config.Item("MinRTargets").GetValue <Slider>().Value)
                    {
                        R.Cast();
                    }
                }
            }

            if (Player.Distance(target.ServerPosition) <= 600 && ComboDamage(target) >= target.Health && useIgnite)
            {
                Player.Spellbook.CastSpell(ignite, target);
            }

            if (useItems && youmuu.IsReady() && target.IsValidTarget(E.Range))
            {
                youmuu.Cast();
            }

            if (useItems && Player.Distance(target.ServerPosition) <= 450 && cutlass.IsReady())
            {
                cutlass.Cast(target);
            }

            if (useItems && Player.Distance(target.ServerPosition) <= 450 && blade.IsReady())
            {
                blade.Cast(target);
            }
        }
示例#12
0
        //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());
                    }
                }
            }
        }
示例#13
0
        private static void CastComboMec(Spell spell, int minHit)
        {
            if (!spell.IsReady() || !E.IsReady() || ObjectManager.Player.HealthPercent <= 10)
            {
                return;
            }

            const int gateDis = 200;

            foreach (var target in ObjectManager.Get <Obj_AI_Hero>().Where(x => x.IsValidTarget(spell.Range)))
            {
                var tarPred = spell.GetPrediction(target, true);

                Vector3 gateVector = ObjectManager.Player.Position + Vector3.Normalize(target.ServerPosition - ObjectManager.Player.Position) * gateDis;

                var nearByEnemies = 1;

                var poly = new Geometry.Polygon.Circle(tarPred.UnitPosition, spell.Width);

                nearByEnemies += HeroManager.Enemies.Where(x => x.NetworkId != target.NetworkId).Count(enemy => poly.IsInside(enemy.ServerPosition));

                if (ObjectManager.Player.Distance(tarPred.CastPosition) < spell.Range + 100 && nearByEnemies >= minHit)
                {
                    if (Jayce.HammerTime && R.IsReady() && Jayce.CanQcd == 0 && Jayce.CanEcd == 0)
                    {
                        R.Cast();
                    }
                    else if (Jayce.HammerTime)
                    {
                        return;
                    }

                    Console.WriteLine("Hit Combo: " + nearByEnemies);
                    E.Cast(gateVector);
                    spell.Cast(tarPred.CastPosition);
                    return;
                }
            }
        }
示例#14
0
        private static void GameObject_OnCreate(GameObject sender, EventArgs args)
        {
            if (!MenuManager.MenuValues["MenuManager.GapcloserMenu.Enabled"] ||
                (MenuManager.MenuValues["MenuManager.GapcloserMenu.OnlyInCombo"] &&
                 !Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo)))
            {
                return;
            }

            int hp;
            int enemies;

            if (sender.Name.Equals("Rengar_LeapSound.troy", StringComparison.InvariantCultureIgnoreCase) && (sender.Position.DistanceCached(Player.Instance) <= 1000))
            {
                var rengar = StaticCacheProvider.GetChampions(CachedEntityType.EnemyHero, x => x.Hero == Champion.Rengar && x.IsValidTarget()).FirstOrDefault();

                if (rengar == null)
                {
                    return;
                }

                hp      = MenuManager.MenuValues[$"MenuManager.GapcloserMenu.{rengar.ChampionName}.Passive.Hp", true];
                enemies = MenuManager.MenuValues[$"MenuManager.GapcloserMenu.{rengar.ChampionName}.Passive.Enemies", true];

                if (MenuManager.MenuValues[$"MenuManager.GapcloserMenu.{rengar.ChampionName}.Passive.Enabled"] &&
                    (Player.Instance.HealthPercent <= hp) &&
                    (Player.Instance.CountEnemiesInRange(MenuManager.GapcloserScanRange) <= enemies))
                {
                    PluginInstance.OnGapcloser(rengar,
                                               new GapCloserEventArgs(Player.Instance, SpellSlot.Unknown, GapcloserTypes.Targeted,
                                                                      rengar.Position, Player.Instance.Position,
                                                                      MenuManager.MenuValues[$"MenuManager.GapcloserMenu.{rengar.ChampionName}.Passive.Delay",
                                                                                             true], enemies, hp, Core.GameTickCount));
                }
            }

            if (!sender.Name.Equals("Ziggs_Base_W_tar.troy", StringComparison.InvariantCultureIgnoreCase))
            {
                return;
            }

            var ziggs = StaticCacheProvider.GetChampions(CachedEntityType.EnemyHero).FirstOrDefault(x => x.Hero == Champion.Ziggs);

            if (ziggs == null)
            {
                return;
            }

            var polygon = new Geometry.Polygon.Circle(sender.Position, 325, 50);

            if (!polygon.IsInside(ziggs))
            {
                return;
            }

            var closestPoint = polygon.Points.OrderBy(x => x.Distance(ziggs.ServerPosition.To2D())).ToList()[0];
            var endPosition  = ziggs.ServerPosition.Extend(closestPoint, 465).To3D();

            hp      = MenuManager.MenuValues[$"MenuManager.GapcloserMenu.{ziggs.ChampionName}.W.Hp", true];
            enemies = MenuManager.MenuValues[$"MenuManager.GapcloserMenu.{ziggs.ChampionName}.W.Enemies", true];

            if (MenuManager.MenuValues[$"MenuManager.GapcloserMenu.{ziggs.ChampionName}.W.Enabled"] &&
                (Player.Instance.HealthPercent <= hp) &&
                (Player.Instance.CountEnemiesInRange(MenuManager.GapcloserScanRange) <= enemies))
            {
                PluginInstance.OnGapcloser(ziggs,
                                           new GapCloserEventArgs(null, SpellSlot.W, GapcloserTypes.Skillshot,
                                                                  ziggs.Position, endPosition,
                                                                  MenuManager.MenuValues[$"MenuManager.GapcloserMenu.{ziggs.ChampionName}.W.Delay",
                                                                                         true], enemies, hp, Core.GameTickCount));
            }
        }
示例#15
0
        private static void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (sender.IsMe || Player.Instance.IsDead)
            {
                return;
            }

            var enemy = sender as AIHeroClient;

            if (enemy == null || !enemy.IsEnemy)
            {
                return;
            }

            var menu = MenuManager.MenuValues;

            if (MenuManager.InterruptibleSpellsFound > 0 && menu["MenuManager.InterrupterMenu.Enabled"])
            {
                if (Utils.Interrupter.InterruptibleList.Exists(e => e.ChampionName == enemy.ChampionName) &&
                    ((menu["MenuManager.InterrupterMenu.OnlyInCombo"] &&
                      Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo)) ||
                     !menu["MenuManager.InterrupterMenu.OnlyInCombo"]))
                {
                    foreach (var interruptibleSpell in
                             Utils.Interrupter.InterruptibleList.Where(
                                 x => x.ChampionName == enemy.ChampionName && x.SpellSlot == args.Slot))
                    {
                        var hp      = menu[$"MenuManager.InterrupterMenu.{enemy.ChampionName}.{interruptibleSpell.SpellSlot}.Hp", true];
                        var enemies = menu[$"MenuManager.InterrupterMenu.{enemy.ChampionName}.{interruptibleSpell.SpellSlot}.Enemies", true];

                        if (menu[$"MenuManager.InterrupterMenu.{enemy.ChampionName}.{interruptibleSpell.SpellSlot}.Enabled"] &&
                            Player.Instance.HealthPercent <= hp &&
                            Player.Instance.CountEnemiesInRange(MenuManager.GapcloserScanRange) <= enemies)
                        {
                            InterruptibleSpellsFound.Add(
                                new InterrupterEventArgs(args.Target, args.Slot, interruptibleSpell.DangerLevel,
                                                         interruptibleSpell.SpellName, args.Start, args.End,
                                                         menu[$"MenuManager.InterrupterMenu.{enemy.ChampionName}.{interruptibleSpell.SpellSlot}.Delay", true],
                                                         enemies, hp, Core.GameTickCount), enemy);
                        }
                    }
                }
            }

            if (MenuManager.GapclosersFound == 0)
            {
                return;
            }

            if (!menu["MenuManager.GapcloserMenu.Enabled"] ||
                (menu["MenuManager.GapcloserMenu.OnlyInCombo"] &&
                 !Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo)) ||
                !Gapcloser.GapCloserList.Exists(e => e.ChampName == enemy.ChampionName))
            {
                return;
            }

            if (args.SData.Name.Equals("shene", StringComparison.InvariantCultureIgnoreCase))
            {
                if (CanInvoke(enemy.ChampionName, SpellSlot.E))
                {
                    var hp      = menu[$"MenuManager.GapcloserMenu.{enemy.ChampionName}.E.Hp", true];
                    var enemies = menu[$"MenuManager.GapcloserMenu.{enemy.ChampionName}.E.Enemies", true];

                    PluginInstance.OnGapcloser(enemy,
                                               new GapCloserEventArgs(args.Target, args.Slot,
                                                                      args.Target == null ? GapcloserTypes.Skillshot : GapcloserTypes.Targeted,
                                                                      args.Start, GetGapcloserEndPosition(args.Start, args.End, "shene", Gapcloser.GapcloserType.Skillshot),
                                                                      menu[$"MenuManager.GapcloserMenu.{enemy.ChampionName}.E.Delay", true], enemies, hp, Core.GameTickCount));

                    return;
                }
            }

            foreach (
                var gapcloser in
                Gapcloser.GapCloserList.Where(
                    x =>
                    x.ChampName == enemy.ChampionName &&
                    string.Equals(x.SpellName, args.SData.Name, StringComparison.InvariantCultureIgnoreCase)))
            {
                if (!CanInvoke(enemy.ChampionName, args.Slot))
                {
                    continue;
                }

                var hp      = menu[$"MenuManager.GapcloserMenu.{enemy.ChampionName}.{gapcloser.SpellSlot}.Hp", true];
                var enemies = menu[$"MenuManager.GapcloserMenu.{enemy.ChampionName}.{gapcloser.SpellSlot}.Enemies", true];

                if (enemy.Hero == Champion.Nidalee && args.SData.Name.ToLowerInvariant() == "pounce")
                {
                    PluginInstance.OnGapcloser(enemy,
                                               new GapCloserEventArgs(args.Target, args.Slot,
                                                                      args.Target == null ? GapcloserTypes.Skillshot : GapcloserTypes.Targeted,
                                                                      args.Start, GetGapcloserEndPosition(args.Start, args.End, gapcloser.SpellName, gapcloser.SkillType),
                                                                      menu[$"MenuManager.GapcloserMenu.{enemy.ChampionName}.{gapcloser.SpellSlot}.Delay", true], enemies, hp, Core.GameTickCount));
                }
                else if (enemy.Hero == Champion.JarvanIV &&
                         args.SData.Name.ToLower() == "jarvanivdragonstrike" && (GetGapcloserEndPosition(args.Start, args.End, "jarvanivdragonstrike", Gapcloser.GapcloserType.Skillshot).Distance(Player.Instance.Position) <= 1000))
                {
                    var flag = ObjectManager.Get <Obj_AI_Minion>().FirstOrDefault(x => x.Name.Equals("beacon", StringComparison.CurrentCultureIgnoreCase));

                    if (flag == null)
                    {
                        continue;
                    }

                    var endPos        = enemy.Position.Extend(args.End, 790).To3D();
                    var flagpolygon   = new Geometry.Polygon.Circle(flag.Position, 150);
                    var qPolygon      = new Geometry.Polygon.Rectangle(enemy.Position, endPos, 180);
                    var playerpolygon = new Geometry.Polygon.Circle(Player.Instance.Position, Player.Instance.BoundingRadius);

                    for (var i = 0; i <= 800; i += 100)
                    {
                        if (!flagpolygon.IsInside(enemy.Position.Extend(args.End, i)) ||
                            !playerpolygon.Points.Any(x => qPolygon.IsInside(x)))
                        {
                            continue;
                        }

                        PluginInstance.OnGapcloser(enemy,
                                                   new GapCloserEventArgs(args.Target, args.Slot,
                                                                          args.Target == null ? GapcloserTypes.Skillshot : GapcloserTypes.Targeted,
                                                                          args.Start, GetGapcloserEndPosition(args.Start, args.End, gapcloser.SpellName, gapcloser.SkillType),
                                                                          menu[$"MenuManager.GapcloserMenu.{enemy.ChampionName}.{gapcloser.SpellSlot}.Delay", true], enemies, hp, Core.GameTickCount));
                        break;
                    }
                }

                else if (enemy.Hero != Champion.Nidalee && enemy.Hero != Champion.JarvanIV && enemy.Hero != Champion.Shen)
                {
                    PluginInstance.OnGapcloser(enemy,
                                               new GapCloserEventArgs(args.Target, args.Slot,
                                                                      args.Target == null ? GapcloserTypes.Skillshot : GapcloserTypes.Targeted,
                                                                      args.Start, GetGapcloserEndPosition(args.Start, args.End, gapcloser.SpellName, gapcloser.SkillType),
                                                                      menu[$"MenuManager.GapcloserMenu.{enemy.ChampionName}.{gapcloser.SpellSlot}.Delay",
                                                                           true], enemies, hp, Core.GameTickCount));
                }
            }
        }
示例#16
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;
        }
示例#17
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.GapclosersFound != 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.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
                        });
                    }
                }
            }
        }
        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
                        });
                    }
                }
            }
        }
示例#19
0
        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
                        });
                    }
                }
            }
        }
示例#20
0
        private static void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (Player.Instance.IsDead || sender.IsMe)
            {
                return;
            }

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

            if (heroSender != null && target != null && Champions.Exists(x => target.NetworkId == x) && target.Team != heroSender.Team)
            {
                if (IncomingDamages.ContainsKey(target.NetworkId))
                {
                    IncomingDamages[target.NetworkId].Damage += heroSender.GetSpellDamage(target, args.Slot);
                }
                else
                {
                    IncomingDamages.Add(target.NetworkId, new IncomingDamageArgs
                    {
                        Sender = heroSender,
                        Target = target,
                        Tick   = (int)Game.Time * 1000,
                        Damage = heroSender.CalculateDamageOnUnit(target, DamageType.Mixed,
                                                                  heroSender.GetSpellDamage(target, args.Slot)),
                        IsTargetted = true
                    });
                }
                Console.WriteLine("[DEBUG] Targetted [" + target.Hero + "] " + heroSender.GetSpellDamage(target, args.Slot));
            }
            if (heroSender == null || target != null)
            {
                return;
            }

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

                    foreach (var hero in EntityManager.Heroes.AllHeroes.Where(ally => Champions.Exists(x => ally.NetworkId == x) && polygon.IsInside(ally) || polygon2.IsInside(ally) && ally.Team != heroSender.Team))
                    {
                        if (IncomingDamages.ContainsKey(hero.NetworkId))
                        {
                            IncomingDamages[hero.NetworkId].Damage += heroSender.GetSpellDamage(hero, heroSender.GetSpellSlotFromName(args.SData.Name));
                        }
                        else
                        {
                            IncomingDamages.Add(hero.NetworkId, new IncomingDamageArgs
                            {
                                Sender      = heroSender,
                                Target      = hero,
                                IsSkillShot = true,
                                Damage      = heroSender.CalculateDamageOnUnit(hero, DamageType.Mixed,
                                                                               heroSender.GetSpellDamage(hero, heroSender.GetSpellSlotFromName(args.SData.Name))),
                                Tick         = (int)Game.Time * 1000,
                                IsTargetted  = false,
                                IsTurretShot = false
                            });
                            Console.WriteLine("[DEBUG] Skillshot [" + hero.Hero + "] " + heroSender.GetSpellDamage(hero, heroSender.GetSpellSlotFromName(args.SData.Name)));
                        }
                    }
                }
            }
            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);

                foreach (
                    var hero in
                    EntityManager.Heroes.AllHeroes.Where(ally => Champions.Exists(x => ally.NetworkId == x) && polygon.IsInside(ally) && ally.Team != heroSender.Team))
                {
                    if (IncomingDamages.ContainsKey(hero.NetworkId))
                    {
                        IncomingDamages[hero.NetworkId].Damage += heroSender.GetSpellDamage(hero, heroSender.GetSpellSlotFromName(args.SData.Name));
                    }
                    else
                    {
                        IncomingDamages.Add(hero.NetworkId, new IncomingDamageArgs
                        {
                            Sender       = heroSender,
                            Target       = hero,
                            IsSkillShot  = true,
                            Tick         = (int)Game.Time * 1000,
                            Damage       = heroSender.GetSpellDamage(hero, heroSender.GetSpellSlotFromName(args.SData.Name)),
                            IsTargetted  = false,
                            IsTurretShot = false
                        });
                    }

                    Console.WriteLine("[DEBUG] Skillshot [" + hero.Hero + "] " + heroSender.GetSpellDamage(hero, heroSender.GetSpellSlotFromName(args.SData.Name)));
                }
            }
        }
示例#21
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
                    });
                }
            }
        }
示例#22
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));
        }
示例#23
0
文件: Program.cs 项目: lolscripts/wu
        //------------------------------------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;
        }
示例#24
0
        public static Result Circle(Spell spell,
                                    Obj_AI_Hero target,
                                    HitChance hitChance,
                                    bool boundingRadius = true,
                                    bool extended       = 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 + (extended ? spell.Width * 0.85f : 0) +
                             (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;
                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>()));
        }
示例#25
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;
        }
示例#26
0
        //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");
                }
            }
        }
示例#27
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;
        }
示例#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);
 }