Ejemplo n.º 1
0
        protected override void SetupSpells()
        {
            Q = new Spell(SpellSlot.Q, 1150f);
            Q.SetSkillshot(0.25f, 60f, 2000f, true, SkillshotType.SkillshotLine);

            W = new Spell(SpellSlot.W, 900f);
            W.SetSkillshot(0.25f, 80f, 1600f, false, SkillshotType.SkillshotLine);

            E = new Spell(SpellSlot.E, 475f);

            R = new Spell(SpellSlot.R, 1750f);
            R.SetSkillshot(1.2f, 160f, 2000f, false, SkillshotType.SkillshotLine);

            Ultimate = new UltimateManager
            {
                Combo             = true,
                Assisted          = true,
                Auto              = true,
                Flash             = false,
                Required          = true,
                Force             = true,
                Gapcloser         = false,
                GapcloserDelay    = false,
                Interrupt         = false,
                InterruptDelay    = false,
                Spells            = Spells,
                DamageCalculation =
                    (hero, resMulti, rangeCheck) =>
                    CalcComboDamage(
                        hero, resMulti, rangeCheck, Menu.Item(Menu.Name + ".combo.q").GetValue <bool>(),
                        Menu.Item(Menu.Name + ".combo.w").GetValue <bool>(), true)
            };
        }
Ejemplo n.º 2
0
        protected override void SetupSpells()
        {
            Q = new Spell(SpellSlot.Q, 1150f);
            Q.SetSkillshot(0.25f, 60f, 2000f, true, SkillshotType.SkillshotLine);

            W = new Spell(SpellSlot.W, 900f);
            W.SetSkillshot(0.25f, 80f, 1600f, false, SkillshotType.SkillshotLine);

            E = new Spell(SpellSlot.E, 475f);

            R = new Spell(SpellSlot.R, 1750f);
            R.SetSkillshot(1.2f, 160f, 2000f, false, SkillshotType.SkillshotLine);

            Ultimate = new UltimateManager
            {
                Combo = true,
                Assisted = true,
                Auto = true,
                Flash = false,
                Required = true,
                Force = true,
                Gapcloser = false,
                GapcloserDelay = false,
                Interrupt = false,
                InterruptDelay = false,
                Spells = Spells,
                DamageCalculation =
                    (hero, resMulti, rangeCheck) =>
                        CalcComboDamage(
                            hero, resMulti, rangeCheck, Menu.Item(Menu.Name + ".combo.q").GetValue<bool>(),
                            Menu.Item(Menu.Name + ".combo.w").GetValue<bool>(), true)
            };
        }
Ejemplo n.º 3
0
 private bool SpellCollision(Spell spell, Obj_AI_Base target)
 {
     return
         (spell.GetCollision(Player.ServerPosition.To2D(), new List <Vector2> {
         target.ServerPosition.To2D()
     })
          .Any(c => c.NetworkId != target.NetworkId));
 }
Ejemplo n.º 4
0
        public static void TargetSkill(Obj_AI_Base target, Spell spell)
        {
            if (!spell.IsReady() || target == null)
            {
                return;
            }

            spell.CastOnUnit(target);
        }
 public static Result Line(Spell spell,
                           Obj_AI_Hero target,
                           HitChance hitChance,
                           bool boundingRadius = true,
                           bool maxRange       = true)
 {
     try
     {
         if (spell == null || target == null)
         {
             return(new Result(Vector3.Zero, new List <Obj_AI_Hero>()));
         }
         var range = (spell.IsChargedSpell && maxRange ? spell.ChargedMaxRange : spell.Range) +
                     spell.Width * 0.9f +
                     (boundingRadius ? target.BoundingRadius * BoundingRadiusMultiplicator : 0);
         var positions = (from t in GameObjects.EnemyHeroes
                          where t.IsValidTarget(range, true, spell.RangeCheckFrom)
                          let prediction = spell.GetPrediction(t)
                                           where prediction.Hitchance >= hitChance
                                           select new Position(t, prediction.UnitPosition)).ToList();
         if (positions.Any())
         {
             var hits = new List <Obj_AI_Hero>();
             var pred = spell.GetPrediction(target);
             if (pred.Hitchance >= hitChance)
             {
                 hits.Add(target);
                 var rect = new Geometry.Polygon.Rectangle(
                     spell.From, spell.From.Extend(pred.CastPosition, range), spell.Width);
                 if (boundingRadius)
                 {
                     hits.AddRange(
                         from point in positions.Where(p => p.Hero.NetworkId != target.NetworkId)
                         let circle =
                             new Geometry.Polygon.Circle(
                                 point.UnitPosition, point.Hero.BoundingRadius * BoundingRadiusMultiplicator)
                             where circle.Points.Any(p => rect.IsInside(p))
                             select point.Hero);
                 }
                 else
                 {
                     hits.AddRange(
                         from position in positions
                         where rect.IsInside(position.UnitPosition)
                         select position.Hero);
                 }
                 return(new Result(pred.CastPosition, hits));
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return(new Result(Vector3.Zero, new List <Obj_AI_Hero>()));
 }
Ejemplo n.º 6
0
 public static void FarmSelfAoe(Spell spell, List <Obj_AI_Base> minions, int minHit = 3, float overrideWidth = -1f)
 {
     if (!spell.IsReady() || minions.Count == 0)
     {
         return;
     }
     if (minions.Count >= minHit)
     {
         spell.Cast();
     }
 }
Ejemplo n.º 7
0
        private static void ConeFarm(Spell spell, List <Obj_AI_Base> minions, int min, float overrideWidth = -1f)
        {
            if (!spell.IsReady() || minions.Count == 0)
            {
                return;
            }
            var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;
            var pred       = spell.GetCircularFarmLocation(minions, spellWidth);

            if (pred.MinionsHit >= min)
            {
                spell.Cast(pred.Position);
            }
        }
 public static HitChance GetHitChance(this Spell spell, string uniqueId)
 {
     try
     {
         if (spell != null && spell.Slot != SpellSlot.Unknown)
         {
             return(Get(uniqueId, spell.Slot.ToString()));
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return(HitChance.High);
 }
Ejemplo n.º 9
0
 public static void Farm(Spell spell,
                         List <Obj_AI_Base> minions,
                         int minHit          = 3,
                         float overrideWidth = -1f,
                         bool chargeMax      = true)
 {
     if (!spell.IsReady() || minions.Count == 0)
     {
         return;
     }
     if (spell.IsSkillshot)
     {
         if (spell.Collision)
         {
             minHit = 1;
         }
         if (spell.Type == SkillshotType.SkillshotCircle)
         {
             CircleFarm(spell, minions, minHit, overrideWidth);
         }
         else if (spell.Type == SkillshotType.SkillshotLine)
         {
             LineFarm(spell, minions, minHit, overrideWidth);
         }
         else if (spell.Type == SkillshotType.SkillshotCone)
         {
             ConeFarm(spell, minions, minHit, overrideWidth);
         }
     }
     else
     {
         var minion =
             minions.OrderBy(m => spell.IsKillable(m))
             .FirstOrDefault(
                 m =>
                 spell.IsInRange(m) && spell.GetDamage(m) > m.Health ||
                 m.Health - spell.GetDamage(m) > m.MaxHealth * 0.25f);
         if (minion != null)
         {
             spell.CastOnUnit(minion);
         }
     }
 }
Ejemplo n.º 10
0
        private static void LineFarm(Spell spell, List <Obj_AI_Base> minions, int min, float overrideWidth = -1f)
        {
            if (!spell.IsReady() || minions.Count == 0)
            {
                return;
            }
            var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;
            var totalHits  = 0;
            var castPos    = Vector3.Zero;

            var positions = (from minion in minions
                             let pred = spell.GetPrediction(minion)
                                        where pred.Hitchance >= HitChance.Medium
                                        select new Tuple <Obj_AI_Base, Vector3>(minion, pred.UnitPosition)).ToList();

            if (positions.Any())
            {
                foreach (var position in positions)
                {
                    var rect = new Geometry.Polygon.Rectangle(
                        ObjectManager.Player.Position, ObjectManager.Player.Position.Extend(position.Item2, spell.Range),
                        spellWidth);
                    var count =
                        positions.Select(
                            position2 =>
                            new Geometry.Polygon.Circle(position2.Item2, position2.Item1.BoundingRadius * 0.9f))
                        .Count(circle => circle.Points.Any(p => rect.IsInside(p)));
                    if (count > totalHits)
                    {
                        totalHits = count;
                        castPos   = position.Item2;
                    }
                    if (totalHits == minions.Count)
                    {
                        break;
                    }
                }
                if (!castPos.Equals(Vector3.Zero) && totalHits >= min)
                {
                    spell.Cast(castPos);
                }
            }
        }
 public static bool Check(string uniqueId, Spell spell, Obj_AI_Hero hero)
 {
     try
     {
         if (hero == null || !Enabled(uniqueId))
         {
             return(true);
         }
         var bestTarget = TargetSelector.GetTarget(spell);
         if (bestTarget == null || hero.NetworkId.Equals(bestTarget.NetworkId))
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return(false);
 }
 public static bool Check(string uniqueId, Spell spell, Obj_AI_Hero hero)
 {
     try
     {
         if (hero == null || !Enabled(uniqueId))
         {
             return true;
         }
         var bestTarget = TargetSelector.GetTarget(spell);
         if (bestTarget == null || hero.NetworkId.Equals(bestTarget.NetworkId))
         {
             return true;
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return false;
 }
Ejemplo n.º 13
0
        private static void CircleFarm(Spell spell, List <Obj_AI_Base> minions, int min, float overrideWidth = -1f)
        {
            if (!spell.IsReady() || minions.Count == 0)
            {
                return;
            }
            var spellWidth = (overrideWidth > 0 ? overrideWidth : spell.Width) + minions.Average(m => m.BoundingRadius);
            var points     = (from minion in minions
                              select spell.GetPrediction(minion)
                              into pred
                              where pred.Hitchance >= HitChance.Medium
                              select pred.UnitPosition.To2D()).ToList();

            if (points.Any())
            {
                var possibilities = ListExtensions.ProduceEnumeration(points).Where(p => p.Count >= min).ToList();
                if (possibilities.Any())
                {
                    var hits   = 0;
                    var radius = float.MaxValue;
                    var pos    = Vector3.Zero;
                    foreach (var possibility in possibilities)
                    {
                        var mec = MEC.GetMec(possibility);
                        if (mec.Radius < spellWidth)
                        {
                            if (possibility.Count > hits || possibility.Count == hits && radius > mec.Radius)
                            {
                                hits   = possibility.Count;
                                radius = mec.Radius;
                                pos    = mec.Center.To3D();
                            }
                        }
                    }
                    if (hits >= min && !pos.Equals(Vector3.Zero))
                    {
                        spell.Cast(pos);
                    }
                }
            }
        }
 public static void Add(Spell spell, bool readyCheck = true, bool enabled = true)
 {
     try
     {
         if (_menu == null)
         {
             return;
         }
         _menu.AddItem(
             new MenuItem(_menu.Name + "." + spell.Slot, spell.Slot.ToString().ToUpper()).SetValue(enabled));
         if (readyCheck)
         {
             Functions.Add(spell.Slot.ToString(), hero => spell.IsReady() ? spell.GetDamage(hero) : 0);
         }
         else
         {
             Functions.Add(spell.Slot.ToString(), hero => spell.GetDamage(hero));
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
Ejemplo n.º 15
0
        public static void SkillShot(Obj_AI_Hero target,
            Spell spell,
            HitChance hitChance,
            bool boundingRadius = true,
            bool maxRange = true)
        {
            if (!spell.IsReady() || target == null)
            {
                return;
            }

            if (spell.Type == SkillshotType.SkillshotLine)
            {
                var prediction = CPrediction.Line(spell, target, hitChance, boundingRadius, maxRange);
                if (prediction.TotalHits >= 1)
                {
                    spell.Cast(prediction.CastPosition);
                }
            }
            else if (spell.Type == SkillshotType.SkillshotCircle)
            {
                var prediction = CPrediction.Circle(spell, target, hitChance);
                if (prediction.TotalHits >= 1)
                {
                    spell.Cast(prediction.CastPosition);
                }
            }
            else
            {
                var prediction = spell.GetPrediction(target);
                if (prediction.Hitchance >= hitChance)
                {
                    spell.Cast(prediction.CastPosition);
                }
            }
        }
Ejemplo n.º 16
0
        public static void SkillShot(Obj_AI_Hero target,
                                     Spell spell,
                                     HitChance hitChance,
                                     bool boundingRadius = true,
                                     bool maxRange       = true)
        {
            if (!spell.IsReady() || target == null)
            {
                return;
            }

            if (spell.Type == SkillshotType.SkillshotLine)
            {
                var prediction = CPrediction.Line(spell, target, hitChance, boundingRadius, maxRange);
                if (prediction.TotalHits >= 1)
                {
                    spell.Cast(prediction.CastPosition);
                }
            }
            else if (spell.Type == SkillshotType.SkillshotCircle)
            {
                var prediction = CPrediction.Circle(spell, target, hitChance);
                if (prediction.TotalHits >= 1)
                {
                    spell.Cast(prediction.CastPosition);
                }
            }
            else
            {
                var prediction = spell.GetPrediction(target);
                if (prediction.Hitchance >= hitChance)
                {
                    spell.Cast(prediction.CastPosition);
                }
            }
        }
Ejemplo n.º 17
0
        private static void LineFarm(Spell spell, List<Obj_AI_Base> minions, int min, float overrideWidth = -1f)
        {
            if (!spell.IsReady() || minions.Count == 0)
            {
                return;
            }
            var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;
            var totalHits = 0;
            var castPos = Vector3.Zero;

            var positions = (from minion in minions
                let pred = spell.GetPrediction(minion)
                where pred.Hitchance >= HitChance.Medium
                select new Tuple<Obj_AI_Base, Vector3>(minion, pred.UnitPosition)).ToList();

            if (positions.Any())
            {
                foreach (var position in positions)
                {
                    var rect = new Geometry.Polygon.Rectangle(
                        ObjectManager.Player.Position, ObjectManager.Player.Position.Extend(position.Item2, spell.Range),
                        spellWidth);
                    var count =
                        positions.Select(
                            position2 =>
                                new Geometry.Polygon.Circle(position2.Item2, position2.Item1.BoundingRadius * 0.9f))
                            .Count(circle => circle.Points.Any(p => rect.IsInside(p)));
                    if (count > totalHits)
                    {
                        totalHits = count;
                        castPos = position.Item2;
                    }
                    if (totalHits == minions.Count)
                    {
                        break;
                    }
                }
                if (!castPos.Equals(Vector3.Zero) && totalHits >= min)
                {
                    spell.Cast(castPos);
                }
            }
        }
Ejemplo n.º 18
0
 public static void SkillShot(Spell spell, HitChance hitChance, bool boundingRadius = true, bool maxRange = true)
 {
     SkillShot(TargetSelector.GetTarget(spell), spell, hitChance);
 }
Ejemplo n.º 19
0
 public static void TargetSkill(Spell spell)
 {
     TargetSkill(TargetSelector.GetTarget(spell), spell);
 }
Ejemplo n.º 20
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>());
        }
Ejemplo n.º 21
0
 public static void Farm(Spell spell,
     List<Obj_AI_Base> minions,
     int minHit = 3,
     float overrideWidth = -1f,
     bool chargeMax = true)
 {
     if (!spell.IsReady() || minions.Count == 0)
     {
         return;
     }
     if (spell.IsSkillshot)
     {
         if (spell.Collision)
         {
             minHit = 1;
         }
         if (spell.Type == SkillshotType.SkillshotCircle)
         {
             CircleFarm(spell, minions, minHit, overrideWidth);
         }
         else if (spell.Type == SkillshotType.SkillshotLine)
         {
             LineFarm(spell, minions, minHit, overrideWidth);
         }
         else if (spell.Type == SkillshotType.SkillshotCone)
         {
             ConeFarm(spell, minions, minHit, overrideWidth);
         }
     }
     else
     {
         var minion =
             minions.OrderBy(m => spell.IsKillable(m))
                 .FirstOrDefault(
                     m =>
                         spell.IsInRange(m) && spell.GetDamage(m) > m.Health ||
                         m.Health - spell.GetDamage(m) > m.MaxHealth * 0.25f);
         if (minion != null)
         {
             spell.CastOnUnit(minion);
         }
     }
 }
Ejemplo n.º 22
0
 public static void TargetSkill(Spell spell)
 {
     TargetSkill(TargetSelector.GetTarget(spell), spell);
 }
Ejemplo n.º 23
0
        public static void TargetSkill(Obj_AI_Base target, Spell spell)
        {
            if (!spell.IsReady() || target == null)
            {
                return;
            }

            spell.CastOnUnit(target);
        }
        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>()));
        }
Ejemplo n.º 25
0
 public static void FarmSelfAoe(Spell spell, List<Obj_AI_Base> minions, int minHit = 3, float overrideWidth = -1f)
 {
     if (!spell.IsReady() || minions.Count == 0)
     {
         return;
     }
     if (minions.Count >= minHit)
     {
         spell.Cast();
     }
 }
Ejemplo n.º 26
0
 private bool SpellCollision(Spell spell, Obj_AI_Base target)
 {
     return
         spell.GetCollision(Player.ServerPosition.To2D(), new List<Vector2> { target.ServerPosition.To2D() })
             .Any(c => c.NetworkId != target.NetworkId);
 }
Ejemplo n.º 27
0
 private static void CircleFarm(Spell spell, List<Obj_AI_Base> minions, int min, float overrideWidth = -1f)
 {
     if (!spell.IsReady() || minions.Count == 0)
     {
         return;
     }
     var spellWidth = (overrideWidth > 0 ? overrideWidth : spell.Width) + minions.Average(m => m.BoundingRadius);
     var points = (from minion in minions
         select spell.GetPrediction(minion)
         into pred
         where pred.Hitchance >= HitChance.Medium
         select pred.UnitPosition.To2D()).ToList();
     if (points.Any())
     {
         var possibilities = ListExtensions.ProduceEnumeration(points).Where(p => p.Count >= min).ToList();
         if (possibilities.Any())
         {
             var hits = 0;
             var radius = float.MaxValue;
             var pos = Vector3.Zero;
             foreach (var possibility in possibilities)
             {
                 var mec = MEC.GetMec(possibility);
                 if (mec.Radius < spellWidth)
                 {
                     if (possibility.Count > hits || possibility.Count == hits && radius > mec.Radius)
                     {
                         hits = possibility.Count;
                         radius = mec.Radius;
                         pos = mec.Center.To3D();
                     }
                 }
             }
             if (hits >= min && !pos.Equals(Vector3.Zero))
             {
                 spell.Cast(pos);
             }
         }
     }
 }
Ejemplo n.º 28
0
 private static void ConeFarm(Spell spell, List<Obj_AI_Base> minions, int min, float overrideWidth = -1f)
 {
     if (!spell.IsReady() || minions.Count == 0)
     {
         return;
     }
     var spellWidth = overrideWidth > 0 ? overrideWidth : spell.Width;
     var pred = spell.GetCircularFarmLocation(minions, spellWidth);
     if (pred.MinionsHit >= min)
     {
         spell.Cast(pred.Position);
     }
 }
Ejemplo n.º 29
0
 public static void SkillShot(Spell spell, HitChance hitChance, bool boundingRadius = true, bool maxRange = true)
 {
     SkillShot(TargetSelector.GetTarget(spell), spell, hitChance);
 }
 public static void Add(Spell spell, bool readyCheck = true, bool enabled = true)
 {
     try
     {
         if (_menu == null)
         {
             return;
         }
         _menu.AddItem(
             new MenuItem(_menu.Name + "." + spell.Slot, spell.Slot.ToString().ToUpper()).SetValue(enabled));
         if (readyCheck)
         {
             Functions.Add(spell.Slot.ToString(), hero => spell.IsReady() ? spell.GetDamage(hero) : 0);
         }
         else
         {
             Functions.Add(spell.Slot.ToString(), hero => spell.GetDamage(hero));
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
Ejemplo n.º 31
0
 public static Result Line(Spell spell,
     Obj_AI_Hero target,
     HitChance hitChance,
     bool boundingRadius = true,
     bool maxRange = true)
 {
     try
     {
         if (spell == null || target == null)
         {
             return new Result(Vector3.Zero, new List<Obj_AI_Hero>());
         }
         var range = (spell.IsChargedSpell && maxRange ? spell.ChargedMaxRange : spell.Range) +
                     spell.Width * 0.9f +
                     (boundingRadius ? target.BoundingRadius * BoundingRadiusMultiplicator : 0);
         var positions = (from t in GameObjects.EnemyHeroes
             where t.IsValidTarget(range, true, spell.RangeCheckFrom)
             let prediction = spell.GetPrediction(t)
             where prediction.Hitchance >= hitChance
             select new Position(t, prediction.UnitPosition)).ToList();
         if (positions.Any())
         {
             var hits = new List<Obj_AI_Hero>();
             var pred = spell.GetPrediction(target);
             if (pred.Hitchance >= hitChance)
             {
                 hits.Add(target);
                 var rect = new Geometry.Polygon.Rectangle(
                     spell.From, spell.From.Extend(pred.CastPosition, range), spell.Width);
                 if (boundingRadius)
                 {
                     hits.AddRange(
                         from point in positions.Where(p => p.Hero.NetworkId != target.NetworkId)
                         let circle =
                             new Geometry.Polygon.Circle(
                                 point.UnitPosition, point.Hero.BoundingRadius * BoundingRadiusMultiplicator)
                         where circle.Points.Any(p => rect.IsInside(p))
                         select point.Hero);
                 }
                 else
                 {
                     hits.AddRange(
                         from position in positions
                         where rect.IsInside(position.UnitPosition)
                         select position.Hero);
                 }
                 return new Result(pred.CastPosition, hits);
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return new Result(Vector3.Zero, new List<Obj_AI_Hero>());
 }