Ejemplo n.º 1
0
        public static bool InCatchRadius(Axe a)
        {
            var mode = DravenMenu.Config.Item("catchRadiusMode").GetValue<StringList>().SelectedIndex;
            switch (mode)
            {
                case 1:
                    var b = new Geometry.Polygon.Sector(Draven.Position.To2D(), Game.CursorPos.To2D() - Draven.Position.To2D(), DravenMenu.Config.Item("sectorAngle").GetValue<Slider>().Value
                        * (float)Math.PI / 180, DravenMenu.Config.Item("catchRadius").GetValue<Slider>().Value).IsOutside(a.AxeObj.Position.Extend(Game.CursorPos, 30).To2D());

                    return !b;
                default:
                    return a.AxeObj.Position.Distance(Game.CursorPos) <
                           DravenMenu.Config.Item("catchRadius").GetValue<Slider>().Value;
            }
        }
Ejemplo n.º 2
0
 private Geometry.Polygon.Sector GetSimplePolygon(bool predictPosition = false)
 {
     var basePos = predictPosition ? SpellManager.Q.GetPrediction(Target).UnitPosition : Target.ServerPosition;
     var pos = basePos + GetPassiveOffset();
     var r = Passive == PassiveType.UltPassive ? 400 : PolygonRadius;
     var sector = new Geometry.Polygon.Sector(basePos, pos, Geometry.DegreeToRadian(PolygonAngle), r);
     sector.UpdatePolygon();
     return sector;
 }
Ejemplo n.º 3
0
        private Geometry.Polygon GetFilledPolygon(bool predictPosition = false)
        {
            var basePos = predictPosition ? SpellManager.Q.GetPrediction(Target).UnitPosition : Target.ServerPosition;
            var pos = basePos + GetPassiveOffset();
            //var polygons = new List<Geometry.Polygon>();
            var list = new List<Vector2>();
            var r = Passive == PassiveType.UltPassive ? 400 : PolygonRadius;
            var angle = Geometry.DegreeToRadian(PolygonAngle);

            for (var i = 100; i < r; i += 10)
            {
                if (i > r)
                {
                    break;
                }

                var sector = new Geometry.Polygon.Sector(basePos, pos, angle, i);
                sector.UpdatePolygon();
                list.AddRange(sector.Points);
                //polygons.Add(sector);
            }

            return new Geometry.Polygon { Points = list.Distinct().ToList() };
            //return polygons.JoinPolygons().FirstOrDefault();
        }
        private void QLogic()
        {
            try
            {
                var target = TargetSelector.GetTarget(Q.Range);
                if (target != null)
                {
                    Q.CastOnUnit(target);
                }
                else if (Menu.Item(Menu.Name + ".miscellaneous.extended-q").GetValue<bool>())
                {
                    target = TargetSelector.GetTarget(Q1);
                    if (target != null)
                    {
                        var heroPositions = (from t in GameObjects.EnemyHeroes
                            where t.IsValidTarget(Q1.Range)
                            let prediction = Q.GetPrediction(t)
                            select new CPrediction.Position(t, prediction.UnitPosition)).Where(
                                t => t.UnitPosition.Distance(Player.Position) < Q1.Range).ToList();
                        if (heroPositions.Any())
                        {
                            var minions = MinionManager.GetMinions(
                                Q1.Range, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.None);

                            if (minions.Any(m => m.IsMoving) && !heroPositions.Any(h => HasPassiveDebuff(h.Hero)))
                            {
                                return;
                            }

                            var outerMinions = minions.Where(m => m.Distance(Player) > Q.Range).ToList();
                            var innerPositions = minions.Where(m => m.Distance(Player) < Q.Range).ToList();
                            foreach (var minion in innerPositions)
                            {
                                var lMinion = minion;
                                var coneBuff = new Geometry.Polygon.Sector(
                                    minion.Position,
                                    Player.Position.Extend(minion.Position, Player.Distance(minion) + Q.Range * 0.5f),
                                    (float) (40 * Math.PI / 180), Q1.Range - Q.Range);
                                var coneNormal = new Geometry.Polygon.Sector(
                                    minion.Position,
                                    Player.Position.Extend(minion.Position, Player.Distance(minion) + Q.Range * 0.5f),
                                    (float) (60 * Math.PI / 180), Q1.Range - Q.Range);
                                foreach (var enemy in
                                    heroPositions.Where(
                                        m => m.UnitPosition.Distance(lMinion.Position) < Q1.Range - Q.Range))
                                {
                                    if (coneBuff.IsInside(enemy.Hero) && HasPassiveDebuff(enemy.Hero))
                                    {
                                        Q.CastOnUnit(minion);
                                        return;
                                    }
                                    if (coneNormal.IsInside(enemy.UnitPosition))
                                    {
                                        var insideCone =
                                            outerMinions.Where(m => coneNormal.IsInside(m.Position)).ToList();
                                        if (!insideCone.Any() ||
                                            enemy.UnitPosition.Distance(minion.Position) <
                                            insideCone.Select(
                                                m => m.Position.Distance(minion.Position) - m.BoundingRadius)
                                                .DefaultIfEmpty(float.MaxValue)
                                                .Min())
                                        {
                                            Q.CastOnUnit(minion);
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     Called when the game draws itself.
        /// </summary>
        /// <param name="args">The <see cref="EventArgs" /> instance containing the event data.</param>
        private static void OnDraw(EventArgs args)
        {
            try
            {
                if (Player.IsDead)
                {
                    return;
                }

                if (IsActive("GFUELTalon.Draw.W") && W.IsReady())
                {
                    var target = TargetSelector.GetTarget(W.Range, TargetSelector.DamageType.Physical);

                    if (target.IsValidTarget() == false)
                    {
                        return;
                    }

                    var polygon = new Geometry.Polygon.Sector(
                        ObjectManager.Player.Position,
                        target.Position,
                        54 * (float)Math.PI / 180,
                        700);
                    polygon.UpdatePolygon();
                    polygon.Draw(Color.Aqua);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Ejemplo n.º 6
0
        private Geometry.Polygon GetFilledPolygon(bool predictPosition = false)
        {
            var basePos = predictPosition ? SpellManager.Q.GetPrediction(Target).UnitPosition : Target.ServerPosition;
            var pos = basePos + GetPassiveOffset();
            var points = new List<Vector2>();
            for (var i = 100; i < PolygonRadius; i += 10)
            {
                if (i > PolygonRadius)
                {
                    break;
                }

                var calcRads = PolygonAngle; //PolygonRadius - i < 50 ? PolygonAngle - 20 : PolygonAngle;
                var sector = new Geometry.Polygon.Sector(basePos, pos, Geometry.DegreeToRadian(calcRads), i, 30);
                sector.UpdatePolygon();
                points.AddRange(sector.Points);
            }

            points.RemoveAll(p => p.Distance(basePos) < 100);
            return new Geometry.Polygon { Points = points.Distinct().ToList() };
        }
Ejemplo n.º 7
0
 public Skillshot(DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit)
 {
     DetectionType = detectionType;
     SpellData = spellData;
     StartTick = startT;
     Start = start;
     End = end;
     Direction = (end - start).Normalized();
     Unit = unit;
     switch (spellData.Type)
     {
         case SkillShotType.SkillshotCircle:
             Circle = new Geometry.Polygon.Circle(CollisionEnd, spellData.Radius, 22);
             break;
         case SkillShotType.SkillshotLine:
         case SkillShotType.SkillshotMissileLine:
             Rectangle = new Geometry.Polygon.Rectangle(Start, CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotCone:
             Sector = new Geometry.Polygon.Sector(
                 start, CollisionEnd - start, spellData.Radius * (float) Math.PI / 180, spellData.Range, 22);
             break;
         case SkillShotType.SkillshotRing:
             Ring = new Geometry.Polygon.Ring(CollisionEnd, spellData.Radius, spellData.RingRadius, 22);
             break;
     }
     UpdatePolygon();
 }
Ejemplo n.º 8
0
 public Skillshot(
     DetectionType detectionType,
     SpellData spellData,
     int startT,
     Vector2 start,
     Vector2 end,
     Obj_AI_Base unit)
 {
     this.DetectionType = detectionType;
     this.SpellData = spellData;
     this.StartTick = startT;
     this.Start = start;
     this.End = end;
     this.Direction = (end - start).Normalized();
     this.Unit = unit;
     switch (spellData.Type)
     {
         case SkillShotType.SkillshotCircle:
             this.Circle = new Geometry.Polygon.Circle(this.CollisionEnd, spellData.Radius, 22);
             break;
         case SkillShotType.SkillshotLine:
         case SkillShotType.SkillshotMissileLine:
             this.Rectangle = new Geometry.Polygon.Rectangle(this.Start, this.CollisionEnd, spellData.Radius);
             break;
         case SkillShotType.SkillshotCone:
             this.Sector = new Geometry.Polygon.Sector(
                 start,
                 this.CollisionEnd - start,
                 spellData.Radius * (float)Math.PI / 180,
                 spellData.Range,
                 22);
             break;
         case SkillShotType.SkillshotRing:
             this.Ring = new Geometry.Polygon.Ring(this.CollisionEnd, spellData.Radius, spellData.RingRadius, 22);
             break;
         case SkillShotType.SkillshotArc:
             this.Arc = new Geometry.Polygon.Arc(
                 start,
                 end,
                 Configs.SkillShotsExtraRadius + (int)ObjectManager.Player.BoundingRadius,
                 22);
             break;
     }
     this.UpdatePolygon();
 }
Ejemplo n.º 9
0
        private bool Q2Logic()
        {
            /*
            --Not Trusted-- http://leagueoflegends.wikia.com/wiki/Miss_Fortune
            The second shot follows a priority order on targets within 500 units of the primary target:
            Enemy champions in a 40° cone marked by Love Tap.
            Minions and neutral monsters within a 40° cone.
            Enemy champions within a 40° cone.
            Enemy or neutral units within a 110° cone.
            Enemy or neutral units within a 150-range 160° cone.
            Double Up's range is not listed as spell range, but instead matches her basic attack range.
            Double Up can bounce to units in brush or fog of war if they are in range of the target the spell is initially cast on.
            Double Up must kill the first target for the second hit to deal enhanced damage. If the first target dies before the first hit lands, the second target receives the normal second target bonus damage.
            */
            if (Q.isReadyPerfectly())
            {
                float Q2Range = Q.Range + 450;
                var LongRangeTarget = TargetSelector.GetTarget(Q2Range, Q.DamageType);

                if (LongRangeTarget != null)
                {
                    Obj_AI_Base BestTarget = null;

                    List<Obj_AI_Base> Targets = new List<Obj_AI_Base>();
                    Targets.AddRange(MinionManager.GetMinions(Q.Range, MinionTypes.All, MinionTeam.NotAlly).Where(x => x.IsValidTarget()));
                    Targets.AddRange(HeroManager.Enemies.Where(x => x.IsValidTarget(Q.Range)));
                    Targets.OrderBy(x => x.Health);

                    foreach (var Target in MenuProvider.Champion.Misc.getBoolValue("Harass Q2 Only if Kills Unit") ? Targets.Where(x => x.isKillableAndValidTarget(Q.GetDamage(x), Q.DamageType, Q.Range)) : Targets)
                    {
                        var Direction = Target.ServerPosition.Extend(ObjectManager.Player.ServerPosition, -500);
                        var Radian = (float)Math.PI / 180f;
                        var TargetServerPosition = Target.ServerPosition;
                        var Time = (ObjectManager.Player.ServerPosition.Distance(Target.ServerPosition) / Q.Speed) + Q.Delay;
                        var Predic = Prediction.GetPrediction(LongRangeTarget, Time);

                        var Cone40 = new Geometry.Polygon.Sector(TargetServerPosition, Direction, 40f * Radian, 450f);

                        if (Cone40.IsInside(LongRangeTarget.ServerPosition))
                        {
                            if (Cone40.IsInside(Predic.UnitPosition))
                            {
                                if (LongRangeTarget.NetworkId == LoveTapTargetNetworkId)
                                {
                                    BestTarget = Target;
                                    break;
                                }
                                else
                                if (!MinionManager.GetMinions(Q2Range).Where(x => x.IsValidTarget() && x.NetworkId != Target.NetworkId && Cone40.IsInside(x)).Any(x => Target.ServerPosition.Distance(LongRangeTarget.ServerPosition) >= Target.ServerPosition.Distance(x.ServerPosition)))
                                {
                                    BestTarget = Target;
                                    break;
                                }
                            }
                        }
                    }

                    if (BestTarget != null)
                    {
                        return Q.CastOnUnit(BestTarget);
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }