예제 #1
0
        private void CastExtendedQ()
        {
            if (!Variables.Spell[Variables.Spells.Q].IsReady())
            {
                return;
            }
            var target        = TargetSelector.GetTarget(Variables.Spell[Variables.Spells.Q2].Range, DamageType.Physical);
            var minionsAround = MinionManager.GetMinions(Variables.Spell[Variables.Spells.Q].Range);

            foreach (var minion in minionsAround)
            {
                var qRetangle  = new EloBuddy.SDK.Geometry.Polygon.Rectangle(ObjectManager.Player.Position, ObjectManager.Player.Position.LSExtend(minion.Position, Variables.Spell[Variables.Spells.Q2].Range), Variables.Spell[Variables.Spells.Q2].Width);
                var prediction = Variables.Spell[Variables.Spells.Q2].GetPrediction(target);
                if (!qRetangle.IsOutside(prediction.UnitPosition.To2D()) && prediction.Hitchance >= HitChance.High)
                {
                    Variables.Spell[Variables.Spells.Q].Cast(minion);
                }
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: volder1/PortAIO
        private static void OnProcess(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (E.IsReady() && ObjectManager.Player.ManaPercent >= getSliderItem(esettings, "min.mana.for.e"))
            {
                if (esettings["e.engage." + args.SData.Name] != null)
                {
                    if (sender.IsValid <AIHeroClient>() && sender.IsAlly && getCheckBoxItem(esettings, "e.engage." + args.SData.Name) && getCheckBoxItem(esettings, "e." + sender.BaseSkinName) && E.IsInRange(sender) && !sender.IsDead && !sender.IsZombie && sender.IsValid)
                    {
                        E.CastOnUnit(sender);
                    }
                }

                if (esettings["e.protect." + args.SData.Name] != null)
                {
                    if (sender.IsValid <AIHeroClient>() && sender.IsEnemy && args.Target.IsValid <AIHeroClient>() && args.Target.IsAlly && E.IsInRange((AIHeroClient)args.Target) && getCheckBoxItem(esettings, "e.protect." + args.SData.Name) && getCheckBoxItem(esettings, "e." + sender.BaseSkinName))
                    {
                        E.Cast((AIHeroClient)args.Target);
                    }
                }

                if (esettings["e.protect.targetted." + args.SData.Name] != null)
                {
                    if (sender.IsValid <AIHeroClient>() && sender.IsEnemy && args.Target.IsValid <AIHeroClient>() && args.Target.IsAlly && E.IsInRange((AIHeroClient)args.Target) && getCheckBoxItem(esettings, "e.protect.targetted." + args.SData.Name) && getCheckBoxItem(esettings, "e." + sender.BaseSkinName))
                    {
                        E.Cast((AIHeroClient)args.Target);
                    }
                }
            }

            if (args.Target is Obj_AI_Minion || !(sender is AIHeroClient))
            {
                return;
            }

            if (getCheckBoxItem(esettings, "Janna_AutoE") && E.IsReady())
            {
                if (sender.IsEnemy)
                {
                    var StartPos  = args.Start;
                    var EndPos    = args.End;
                    var NonTRange = new EloBuddy.SDK.Geometry.Polygon.Rectangle(StartPos, EndPos, sender.BoundingRadius + 30);
                    var Target    = EntityManager.Heroes.Allies.FirstOrDefault(f => f.Position.LSDistance(Player.Position) <= E.Range && NonTRange.IsInside(f.Position));
                    if (Target != null)
                    {
                        E.Cast(Target, true);
                        return;
                    }
                    if (args.Target != null && args.Target.Position.LSDistance(Player.Position) <= E.Range && args.Target is AIHeroClient)
                    {
                        var ShieldTarget = EntityManager.Heroes.Allies.FirstOrDefault(f => f.Position.LSDistance(args.Target.Position) <= 10);
                        E.Cast(ShieldTarget, true);
                        return;
                    }
                }
                if (sender.IsAlly && args.Target is AIHeroClient)
                {
                    if (sender.Position.LSDistance(Player.Position) <= E.Range && args.Target != null && args.SData.Name.ToLower().Contains("attack"))
                    {
                        E.CastOnUnit(sender, true);
                        return;
                    }
                }
            }
        }
예제 #3
0
        private static void OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            var unit = sender as AIHeroClient;


            /*
             *  Credits => JokerArt
             */


            if (unit == null || !unit.IsValid)
            {
                return;
            }


            if (unit.IsMe && args.Slot.Equals(SpellSlot.E))
            {
                Orbwalker.ResetAutoAttack();
                return;
            }

            if (!unit.IsEnemy || !check(blocking, "BLOCK") || !DemSpells.W.IsReady())
            {
                return;
            }

            if (Evade.SpellDatabase.GetByName(args.SData.Name) != null && !check(blocking, "evade"))
            {
                return;
            }

            if (!SpellBlock.Contains(unit, args))
            {
                return;
            }

            if (args.End.Distance(Player.Instance) == 0)
            {
                return;
            }

            if (check(blocking, "RANGE") && unit.Distance(myhero.Position) > DemSpells.W.Range)
            {
                return;
            }


            var castUnit = unit;
            var type     = args.SData.TargettingType;

            if (!unit.IsValidTarget())
            {
                var target = TargetSelector.GetTarget(DemSpells.W.Range, DamageType.Mixed);
                if (target == null || !target.IsValidTarget(DemSpells.W.Range))
                {
                    target = TargetSelector.SelectedTarget;
                }

                if (target != null && target.IsValidTarget(DemSpells.W.Range))
                {
                    castUnit = target;
                }
            }

            if (unit.ChampionName.Equals("Caitlyn") && args.Slot == SpellSlot.Q)
            {
                Core.DelayAction(() => CastW(castUnit),
                                 ((int)(args.Start.Distance(Player.Instance) / args.SData.MissileSpeed * 1000) -
                                  (int)(args.End.Distance(Player.Instance) / args.SData.MissileSpeed) - 500) + 250);
            }
            if (unit.ChampionName.Equals("Cassiopeia"))
            {
                switch (args.Slot)
                {
                case SpellSlot.Q:
                    if (Prediction.Position.PredictUnitPosition(myhero, 400).Distance(args.Target.Position) <= 75)
                    {
                        Core.DelayAction(() => CastW(castUnit), 300);
                    }
                    break;

                case SpellSlot.E:
                    if (args.Target.IsMe)
                    {
                        Core.DelayAction(() => CastW(castUnit),
                                         ((int)(args.Start.Distance(Player.Instance) / args.SData.MissileSpeed * 1000) -
                                          (int)(args.End.Distance(Player.Instance) / args.SData.MissileSpeed) - 500));
                    }
                    break;

                case SpellSlot.R:
                    if (Prediction.Position.PredictUnitPosition(myhero, 500).Distance(args.Target.Position) <= 875 && PassiveManager.AngleBetween(myhero.Position.To2D(), unit.Position.To2D(), unit.Direction.To2D()) <= 85)
                    {
                        Core.DelayAction(() => CastW(castUnit), 400);
                    }
                    break;
                }
            }
            if (unit.ChampionName.Equals("Blitzcrank") && args.Slot == SpellSlot.R && unit.Distance(myhero.Position) < 600)
            {
                CastW(castUnit);
            }
            if (unit.ChampionName.Equals("Pantheon") && args.Slot == SpellSlot.W && args.Target.IsMe)
            {
                Core.DelayAction(() => CastW(castUnit), 50);
            }
            if (unit.ChampionName.Equals("Darius") && args.Slot == SpellSlot.Q && unit.Distance(myhero.Position) < 420)
            {
                Core.DelayAction(() => CastW(castUnit), 700);
            }
            if (unit.ChampionName.Equals("Jax") && args.Slot == SpellSlot.E && unit.Distance(myhero.Position) < 187.5f &&
                Prediction.Position.PredictUnitPosition(myhero, 1000).Distance(unit.ServerPosition) < 187.5f)
            {
                Core.DelayAction(() => CastW(castUnit), 1100);
            }
            if (unit.ChampionName.Equals("Malphite") && args.Slot == SpellSlot.R && myhero.Position.Distance(args.End) < 300)
            {
                Core.DelayAction(() => CastW(castUnit),
                                 ((int)(args.Start.Distance(Player.Instance) / 700 * 1000) -
                                  (int)(args.End.Distance(Player.Instance) / 700) - 500) + 100);
            }
            if (unit.ChampionName.Equals("Morgana") && args.Slot == SpellSlot.R && unit.Distance(myhero.Position) < 1050 &&
                Prediction.Position.PredictUnitPosition(myhero, 1000).Distance(unit.ServerPosition) < 1050)
            {
                Core.DelayAction(() => CastW(castUnit), 3000);
            }
            if (unit.ChampionName.Equals("KogMaw") && args.Slot == SpellSlot.R && myhero.Position.Distance(args.End) < 240)
            {
                Core.DelayAction(() => CastW(castUnit), 1200);
            }
            if (unit.ChampionName.Equals("Taric") && args.Slot == SpellSlot.E && Prediction.Position.PredictUnitPosition(myhero, 1000).Distance(unit.ServerPosition) < 575)
            {
                var loc = new EloBuddy.SDK.Geometry.Polygon.Rectangle(args.Start, args.End, 140);

                if (loc.IsInside(Prediction.Position.PredictUnitPosition(myhero, 1000)) ||
                    loc.Points.Where(x => x.Distance(Prediction.Position.PredictUnitPosition(myhero, 1000)) < myhero.BoundingRadius).Any())
                {
                    Core.DelayAction(() => CastW(castUnit), 900);
                }
            }
            if (unit.ChampionName.Equals("Ziggs") && args.Slot == SpellSlot.R && myhero.Position.Distance(args.End) < 550)
            {
                Core.DelayAction(() => CastW(castUnit),
                                 ((int)(args.Start.Distance(Player.Instance) / 2800 * 1000) -
                                  (int)(args.End.Distance(Player.Instance) / 2800) - 500) + 900);
            }
            if (unit.ChampionName.Equals("Karthus") && (args.Slot == SpellSlot.R || args.Slot == SpellSlot.Q))
            {
                switch (args.Slot)
                {
                case SpellSlot.R:
                    Core.DelayAction(() => CastW(castUnit), 2900);
                    break;

                case SpellSlot.Q:
                    if (Prediction.Position.PredictUnitPosition(myhero, 450).Distance(args.Target.Position) < 100)
                    {
                        Core.DelayAction(() => CastW(castUnit), 450);
                    }
                    break;
                }
            }
            if (unit.ChampionName.Equals("Shen") && args.Slot == SpellSlot.E && args.End.Distance(myhero.Position) < 100)
            {
                Core.DelayAction(() => CastW(castUnit),
                                 ((int)(args.Start.Distance(Player.Instance) / 1600 * 1000) -
                                  (int)(args.End.Distance(Player.Instance) / 1600) - 500) + 250);
            }
            if (unit.ChampionName.Equals("Zyra"))
            {
                Core.DelayAction(() => CastW(castUnit),
                                 (int)(args.Start.Distance(Player.Instance) / args.SData.MissileSpeed * 1000) -
                                 (int)(args.End.Distance(Player.Instance) / args.SData.MissileSpeed) - 500);
            }
            if (unit.ChampionName.Equals("Amumu") && args.Slot == SpellSlot.R && unit.Distance(myhero.Position) <= 550)
            {
                CastW(castUnit);
            }
            if (args.End.Distance(Player.Instance) < 250)
            {
                if (unit.ChampionName.Equals("Bard") && args.End.Distance(Player.Instance) < 300)
                {
                    Core.DelayAction(() => CastW(castUnit), (int)(unit.Distance(Player.Instance) / 7f) + 400);
                }
                else if (unit.ChampionName.Equals("Ashe"))
                {
                    Core.DelayAction(() => CastW(castUnit),
                                     (int)(args.Start.Distance(Player.Instance) / args.SData.MissileSpeed * 1000) -
                                     (int)args.End.Distance(Player.Instance));
                    return;
                }
                else if (unit.ChampionName.Equals("Varus") || unit.ChampionName.Equals("TahmKench") ||
                         unit.ChampionName.Equals("Lux"))
                {
                    if (unit.ChampionName.Equals("Lux") && args.Slot == SpellSlot.R)
                    {
                        Core.DelayAction(() => CastW(castUnit), 400);
                    }
                    Core.DelayAction(() => CastW(castUnit),
                                     (int)(args.Start.Distance(Player.Instance) / args.SData.MissileSpeed * 1000) -
                                     (int)(args.End.Distance(Player.Instance) / args.SData.MissileSpeed) - 500);
                }
                else if (unit.ChampionName.Equals("Amumu"))
                {
                    if (sender.Distance(Player.Instance) < 1100)
                    {
                        Core.DelayAction(() => CastW(castUnit),
                                         (int)(args.Start.Distance(Player.Instance) / args.SData.MissileSpeed * 1000) -
                                         (int)(args.End.Distance(Player.Instance) / args.SData.MissileSpeed) - 500);
                    }
                }
            }

            if (args.Target != null && type.Equals(SpellDataTargetType.Unit))
            {
                if (!args.Target.IsMe ||
                    (args.Target.Name.Equals("Barrel") && args.Target.Distance(Player.Instance) > 200 &&
                     args.Target.Distance(Player.Instance) < 400))
                {
                    return;
                }

                if (unit.ChampionName.Equals("Nautilus") ||
                    (unit.ChampionName.Equals("Caitlyn") && args.Slot.Equals(SpellSlot.R)))
                {
                    var d          = unit.Distance(Player.Instance);
                    var travelTime = d / 3200;
                    var delay      = Math.Floor(travelTime * 1000) + 900;
                    Console.WriteLine("TT: " + travelTime + " Delay: " + delay);
                    Core.DelayAction(() => CastW(castUnit), (int)delay);
                    return;
                }
                CastW(castUnit);
            }

            if (type.Equals(SpellDataTargetType.Unit))
            {
                if (unit.ChampionName.Equals("Bard") && args.End.Distance(Player.Instance) < 300)
                {
                    Core.DelayAction(() => CastW(castUnit), 400 + (int)(unit.Distance(Player.Instance) / 7f));
                }
                else if (unit.ChampionName.Equals("Riven") && args.End.Distance(Player.Instance) < 260)
                {
                    CastW(castUnit);
                }
                else
                {
                    CastW(castUnit);
                }
            }
            else if (type.Equals(SpellDataTargetType.LocationAoe) &&
                     args.End.Distance(Player.Instance) < args.SData.CastRadius)
            {
                if (unit.ChampionName.Equals("Annie") && args.Slot.Equals(SpellSlot.R))
                {
                    return;
                }
                CastW(castUnit);
            }
            else if (type.Equals(SpellDataTargetType.Cone) &&
                     args.End.Distance(Player.Instance) < args.SData.CastRadius)
            {
                CastW(castUnit);
            }
            else if (type.Equals(SpellDataTargetType.SelfAoe) || type.Equals(SpellDataTargetType.Self))
            {
                var d = args.End.Distance(Player.Instance.ServerPosition);
                var p = args.SData.CastRadius > 5000 ? args.SData.CastRange : args.SData.CastRadius;
                if (d < p)
                {
                    CastW(castUnit);
                }
            }
        }
예제 #4
0
        private static void OnProcess(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (sender == null)
            {
                return;
            }
            if (E.IsReady())
            {
                if (esettings["e.engage." + args.SData.Name] != null)
                {
                    if (sender is AIHeroClient && sender.IsAlly && getCheckBoxItem(esettings, "e.engage." + args.SData.Name) && getCheckBoxItem(esettings, "e." + sender.BaseSkinName) && E.IsInRange((AIHeroClient)args.Target) && !sender.IsDead && !sender.IsZombie && sender.IsValid)
                    {
                        E.CastOnUnit(sender);
                    }
                }

                if (args.Target != null && !sender.IsMinion)
                {
                    if (args.Target.IsAlly && args.Target.IsValid)
                    {
                        if (esettings["e." + ((AIHeroClient)args.Target).ChampionName] != null)
                            if (sender is AIHeroClient && sender.IsEnemy && args.Target.IsAlly && args.Target.Type == GameObjectType.AIHeroClient && args.SData.IsAutoAttack() && ObjectManager.Player.ManaPercent >= getSliderItem(esettings, "min.mana.for.e") && getCheckBoxItem(esettings, "e." + ((AIHeroClient)args.Target).ChampionName) && E.IsInRange((AIHeroClient)args.Target))
                            {
                                E.Cast((AIHeroClient)args.Target);
                            }
                    }
                }

                if (args.Target != null)
                {
                    if (args.Target.IsAlly && sender is Obj_AI_Turret)
                    {
                        if (esettings["e." + ((AIHeroClient)args.Target).ChampionName] != null)
                        {
                            if (sender is Obj_AI_Turret && args.Target.IsAlly && ObjectManager.Player.ManaPercent >= getSliderItem(esettings, "min.mana.for.e")
                                && getCheckBoxItem(esettings, "e." + ((AIHeroClient)args.Target).ChampionName) && E.IsInRange((AIHeroClient)args.Target)
                                && getCheckBoxItem(esettings, "protect.carry.from.turret"))
                            {
                                E.Cast((AIHeroClient)args.Target);
                            }
                        }
                    }
                }

                if (esettings["e.protect." + args.SData.Name] != null || esettings["e.protect.targetted." + args.SData.Name] != null)
                {
                    if (sender is AIHeroClient && args.Target.IsAlly && args.Target.Type == GameObjectType.AIHeroClient
                        && !args.SData.IsAutoAttack() && (getCheckBoxItem(esettings, "e.protect." + args.SData.Name) || getCheckBoxItem(esettings, "e.protect.targetted." + args.SData.Name))
                        && sender.IsEnemy && sender.LSGetSpellDamage(((AIHeroClient)args.Target), args.SData.Name) > ((AIHeroClient)args.Target).Health)
                    {
                        E.Cast((AIHeroClient)args.Target);
                    }
                }

                 if (sender is AIHeroClient && sender.IsEnemy && args.Target.IsAlly && args.Target.Type == GameObjectType.obj_AI_Turret
                    && args.SData.IsAutoAttack() && ObjectManager.Player.ManaPercent >= getSliderItem(esettings, "min.mana.for.e") && E.IsInRange((Obj_AI_Turret)args.Target)
                    && ((Obj_AI_Turret)args.Target).HealthPercent < getSliderItem(esettings, "turret.hp.percent"))
                {
                    E.Cast((AIHeroClient)args.Target);
                }
            }

            if (args.Target is Obj_AI_Minion || !(sender is AIHeroClient))
                return;
            if (getCheckBoxItem(esettings, "Janna_AutoE") && E.IsReady())
            {
                if (sender.IsEnemy)
                {
                    var StartPos = args.Start;
                    var EndPos = args.End;
                    var NonTRange = new EloBuddy.SDK.Geometry.Polygon.Rectangle(StartPos, EndPos, sender.BoundingRadius + 30);
                    var Target = HeroManager.Allies.FirstOrDefault(f => f.Position.LSDistance(Player.Position) <= E.Range && NonTRange.IsInside(f.Position));
                    if (Target != null)
                    {
                        E.Cast(Target, true);
                        return;
                    }
                    if (args.Target != null && args.Target.Position.LSDistance(Player.Position) <= E.Range && args.Target is AIHeroClient)
                    {
                        var ShieldTarget = HeroManager.Allies.FirstOrDefault(f => f.Position.LSDistance(args.Target.Position) <= 10);
                        E.Cast(ShieldTarget, true);
                        return;
                    }
                }
                if (sender.IsAlly && args.Target is AIHeroClient)
                {
                    if (sender.Position.LSDistance(Player.Position) <= E.Range && args.Target != null && args.SData.Name.ToLower().Contains("attack"))
                    {
                        E.CastOnUnit(sender, true);
                        return;
                    }
                }
            }
        }
예제 #5
0
        private static void OnProcess(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            if (E.IsReady())
            {
                Console.WriteLine("1");
                if (esettings["e.engage." + args.SData.Name] != null)
                {
                    if (sender.IsAlly && sender is AIHeroClient && getCheckBoxItem(esettings, "e.engage." + args.SData.Name) && getCheckBoxItem(esettings, "e." + sender.BaseSkinName) && sender.LSDistance(ObjectManager.Player.Position) <= E.Range && !sender.IsDead && !sender.IsZombie && sender.IsValid)
                    {
                        E.CastOnUnit(sender);
                    }
                }

                Console.WriteLine("2");
                if (args.Target != null && !sender.IsMinion)
                {
                    if (args.Target.IsAlly && args.Target.IsValid)
                    {
                        if (esettings["e." + ((AIHeroClient)args.Target).ChampionName] != null)
                        {
                            if (sender is AIHeroClient && sender.IsEnemy && args.Target.IsAlly && args.Target.Type == GameObjectType.AIHeroClient && args.SData.IsAutoAttack() && ObjectManager.Player.ManaPercent >= getSliderItem(esettings, "min.mana.for.e") && getCheckBoxItem(esettings, "e." + ((AIHeroClient)args.Target).ChampionName) && ((AIHeroClient)args.Target).LSDistance(ObjectManager.Player.Position) < E.Range)
                            {
                                E.Cast((AIHeroClient)args.Target);
                            }
                        }
                    }
                }

                Console.WriteLine("3");
                if (args.Target != null)
                {
                    if (args.Target.IsAlly && sender is Obj_AI_Turret)
                    {
                        if (esettings["e." + ((AIHeroClient)args.Target).ChampionName] != null)
                        {
                            if (sender is Obj_AI_Turret && args.Target.IsAlly && ObjectManager.Player.ManaPercent >= getSliderItem(esettings, "min.mana.for.e") &&
                                getCheckBoxItem(esettings, "e." + ((AIHeroClient)args.Target).ChampionName) && ((AIHeroClient)args.Target).LSDistance(ObjectManager.Player.Position) < E.Range &&
                                getCheckBoxItem(esettings, "protect.carry.from.turret"))
                            {
                                E.Cast((AIHeroClient)args.Target);
                            }
                        }
                    }
                }

                Console.WriteLine("4");
                if (esettings["e.protect." + args.SData.Name] != null || esettings["e.protect.targetted." + args.SData.Name] != null)
                {
                    if (sender is AIHeroClient && args.Target.IsAlly && args.Target.Type == GameObjectType.AIHeroClient &&
                        !args.SData.IsAutoAttack() && (getCheckBoxItem(esettings, "e.protect." + args.SData.Name) || getCheckBoxItem(esettings, "e.protect.targetted." + args.SData.Name)) &&
                        sender.IsEnemy && sender.LSGetSpellDamage(((AIHeroClient)args.Target), args.SData.Name) > ((AIHeroClient)args.Target).Health)
                    {
                        E.Cast((AIHeroClient)args.Target);
                    }
                }

                Console.WriteLine("5");
                if (sender is AIHeroClient && sender.IsEnemy && args.Target.IsAlly && args.Target.Type == GameObjectType.obj_AI_Turret &&
                    args.SData.IsAutoAttack() && ObjectManager.Player.ManaPercent >= getSliderItem(esettings, "min.mana.for.e") &&
                    ((AIHeroClient)args.Target).LSDistance(ObjectManager.Player.Position) < E.Range &&
                    ((AIHeroClient)args.Target).HealthPercent < getSliderItem(esettings, "turret.hp.percent"))
                {
                    E.Cast((AIHeroClient)args.Target);
                }
            }

            if (args.Target is Obj_AI_Minion || !(sender is AIHeroClient))
            {
                return;
            }
            if (getCheckBoxItem(esettings, "Janna_AutoE") && E.IsReady())
            {
                if (sender.IsEnemy)
                {
                    var StartPos  = args.Start;
                    var EndPos    = args.End;
                    var NonTRange = new EloBuddy.SDK.Geometry.Polygon.Rectangle(StartPos, EndPos, sender.BoundingRadius + 30);
                    var Target    = HeroManager.Allies.FirstOrDefault(f => f.Position.LSDistance(Player.Position) <= E.Range && NonTRange.IsInside(f.Position));
                    if (Target != null)
                    {
                        E.Cast(Target, true);
                        return;
                    }
                    if (args.Target != null && args.Target.Position.LSDistance(Player.Position) <= E.Range && args.Target is AIHeroClient)
                    {
                        Console.WriteLine("7");
                        var ShieldTarget = HeroManager.Allies.FirstOrDefault(f => f.Position.LSDistance(args.Target.Position) <= 10);
                        E.Cast(ShieldTarget, true);
                        return;
                    }
                }
                if (sender.IsAlly && args.Target is AIHeroClient)
                {
                    if (sender.Position.LSDistance(Player.Position) <= E.Range && args.Target != null && args.SData.Name.ToLower().Contains("attack"))
                    {
                        E.CastOnUnit(sender, true);
                        return;
                    }
                }
            }
        }
예제 #6
0
파일: Program.cs 프로젝트: Toyota7/EloBuddy
        private static void OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
        {
            var unit = sender as AIHeroClient;

            /*
                Credits => JokerArt
            */

            if (unit == null || !unit.IsValid)
            {
                return;
            }

            if (unit.IsMe && args.Slot.Equals(SpellSlot.E))
            {
                Orbwalker.ResetAutoAttack();
                return;
            }

            if (!unit.IsEnemy || !check(blocking, "BLOCK") || !DemSpells.W.IsReady())
            {
                return;
            }

            if (Evade.SpellDatabase.GetByName(args.SData.Name) != null && !check(blocking, "evade"))
                return;

            if (!SpellBlock.Contains(unit, args))
                return;

            if (args.End.Distance(Player.Instance) == 0)
                return;

            if (check(blocking, "RANGE") && unit.Distance(myhero.Position) > DemSpells.W.Range)
                return;

            var castUnit = unit;
            var type = args.SData.TargettingType;

            if (!unit.IsValidTarget())
            {
                var target = TargetSelector.GetTarget(DemSpells.W.Range, DamageType.Mixed);
                if (target == null || !target.IsValidTarget(DemSpells.W.Range))
                {
                    target = TargetSelector.SelectedTarget;
                }

                if (target != null && target.IsValidTarget(DemSpells.W.Range))
                {
                    castUnit = target;
                }
            }

            if (unit.ChampionName.Equals("Caitlyn") && args.Slot == SpellSlot.Q)
            {
                Core.DelayAction(() => CastW(castUnit),
                    ((int)(args.Start.Distance(Player.Instance) / args.SData.MissileSpeed * 1000) -
                    (int)(args.End.Distance(Player.Instance) / args.SData.MissileSpeed) - 500) + 250);
            }
            if (unit.ChampionName.Equals("Cassiopeia"))
            {
                switch (args.Slot)
                {
                    case SpellSlot.Q:
                        if (Prediction.Position.PredictUnitPosition(myhero, 400).Distance(args.Target.Position) <= 75)
                        {
                            Core.DelayAction(() => CastW(castUnit), 300);
                        }
                        break;
                    case SpellSlot.E:
                        if (args.Target.IsMe)
                        {
                            Core.DelayAction(() => CastW(castUnit),
                                ((int)(args.Start.Distance(Player.Instance) / args.SData.MissileSpeed * 1000) -
                                (int)(args.End.Distance(Player.Instance) / args.SData.MissileSpeed) - 500));
                        }
                        break;
                    case SpellSlot.R:
                        if (Prediction.Position.PredictUnitPosition(myhero, 500).Distance(args.Target.Position) <= 875 && PassiveManager.AngleBetween(myhero.Position.To2D(), unit.Position.To2D(), unit.Direction.To2D()) <= 85)
                        {
                            Core.DelayAction(() => CastW(castUnit), 400);
                        }
                        break;
                }
            }
            if (unit.ChampionName.Equals("Blitzcrank") && args.Slot == SpellSlot.R && unit.Distance(myhero.Position) < 600)
            {
                CastW(castUnit);
            }
            if (unit.ChampionName.Equals("Pantheon") && args.Slot == SpellSlot.W && args.Target.IsMe)
            {
                Core.DelayAction(() => CastW(castUnit), 50);
            }
            if (unit.ChampionName.Equals("Darius") && args.Slot == SpellSlot.Q && unit.Distance(myhero.Position) < 420)
            {
                Core.DelayAction(() => CastW(castUnit), 700);
            }
            if (unit.ChampionName.Equals("Jax") && args.Slot == SpellSlot.E && unit.Distance(myhero.Position) < 187.5f &&
                Prediction.Position.PredictUnitPosition(myhero, 1000).Distance(unit.ServerPosition) < 187.5f)
            {
                Core.DelayAction(() => CastW(castUnit), 1100);
            }
            if (unit.ChampionName.Equals("Malphite") && args.Slot == SpellSlot.R && myhero.Position.Distance(args.End) < 300)
            {
                Core.DelayAction(() => CastW(castUnit),
                    ((int)(args.Start.Distance(Player.Instance) / 700 * 1000) -
                    (int)(args.End.Distance(Player.Instance) / 700) - 500) + 100);
            }
            if (unit.ChampionName.Equals("Morgana") && args.Slot == SpellSlot.R && unit.Distance(myhero.Position) < 1050 &&
                Prediction.Position.PredictUnitPosition(myhero, 1000).Distance(unit.ServerPosition) < 1050)
            {
                Core.DelayAction(() => CastW(castUnit), 3000);
            }
            if (unit.ChampionName.Equals("KogMaw") && args.Slot == SpellSlot.R && myhero.Position.Distance(args.End) < 240)
            {
                Core.DelayAction(() => CastW(castUnit), 1200);
            }
            if (unit.ChampionName.Equals("Taric") && args.Slot == SpellSlot.E && Prediction.Position.PredictUnitPosition(myhero,1000).Distance(unit.ServerPosition) < 575)
            {
                var loc = new EloBuddy.SDK.Geometry.Polygon.Rectangle(args.Start, args.End, 140);

                if (loc.IsInside(Prediction.Position.PredictUnitPosition(myhero, 1000)) ||
                    loc.Points.Where(x => x.Distance(Prediction.Position.PredictUnitPosition(myhero, 1000)) < myhero.BoundingRadius).Any())
                {
                    Core.DelayAction(() => CastW(castUnit), 900);
                }
            }
            if (unit.ChampionName.Equals("Ziggs") && args.Slot == SpellSlot.R && myhero.Position.Distance(args.End) < 550)
            {
                Core.DelayAction(() => CastW(castUnit),
                    ((int)(args.Start.Distance(Player.Instance) / 2800 * 1000) -
                    (int)(args.End.Distance(Player.Instance) / 2800) - 500) + 900);
            }
            if (unit.ChampionName.Equals("Karthus") && (args.Slot == SpellSlot.R || args.Slot == SpellSlot.Q))
            {
                switch (args.Slot)
                {
                    case SpellSlot.R:
                        Core.DelayAction(() => CastW(castUnit), 2900);
                        break;
                    case SpellSlot.Q:
                        if (Prediction.Position.PredictUnitPosition(myhero, 450).Distance(args.Target.Position) < 100)
                        {
                            Core.DelayAction(() => CastW(castUnit), 450);
                        }
                        break;
                }
            }
            if (unit.ChampionName.Equals("Shen") && args.Slot == SpellSlot.E && args.End.Distance(myhero.Position) < 100)
            {
                Core.DelayAction(() => CastW(castUnit),
                    ((int)(args.Start.Distance(Player.Instance) / 1600 * 1000) -
                    (int)(args.End.Distance(Player.Instance) / 1600) - 500) + 250);
            }
            if (unit.ChampionName.Equals("Zyra"))
            {
                Core.DelayAction(() => CastW(castUnit),
                    (int)(args.Start.Distance(Player.Instance) / args.SData.MissileSpeed * 1000) -
                    (int)(args.End.Distance(Player.Instance) / args.SData.MissileSpeed) - 500);
            }
            if (unit.ChampionName.Equals("Amumu") && args.Slot == SpellSlot.R && unit.Distance(myhero.Position) <= 550)
            {
                CastW(castUnit);
            }
            if (args.End.Distance(Player.Instance) < 250)
            {
                if (unit.ChampionName.Equals("Bard") && args.End.Distance(Player.Instance) < 300)
                {
                    Core.DelayAction(() => CastW(castUnit), (int)(unit.Distance(Player.Instance) / 7f) + 400);
                }
                else if (unit.ChampionName.Equals("Ashe"))
                {
                    Core.DelayAction(() => CastW(castUnit),
                        (int)(args.Start.Distance(Player.Instance) / args.SData.MissileSpeed * 1000) -
                        (int)args.End.Distance(Player.Instance));
                    return;
                }
                else if (unit.ChampionName.Equals("Varus") || unit.ChampionName.Equals("TahmKench") ||
                         unit.ChampionName.Equals("Lux"))
                {
                    if (unit.ChampionName.Equals("Lux") && args.Slot == SpellSlot.R)
                    {
                        Core.DelayAction(() => CastW(castUnit), 400);
                    }
                    Core.DelayAction(() => CastW(castUnit),
                        (int)(args.Start.Distance(Player.Instance) / args.SData.MissileSpeed * 1000) -
                        (int)(args.End.Distance(Player.Instance) / args.SData.MissileSpeed) - 500);

                }
                else if (unit.ChampionName.Equals("Amumu"))
                {
                    if (sender.Distance(Player.Instance) < 1100)
                        Core.DelayAction(() => CastW(castUnit),
                            (int)(args.Start.Distance(Player.Instance) / args.SData.MissileSpeed * 1000) -
                            (int)(args.End.Distance(Player.Instance) / args.SData.MissileSpeed) - 500);
                }
            }

            if (args.Target != null && type.Equals(SpellDataTargetType.Unit))
            {
                if (!args.Target.IsMe ||
                    (args.Target.Name.Equals("Barrel") && args.Target.Distance(Player.Instance) > 200 &&
                     args.Target.Distance(Player.Instance) < 400))
                {
                    return;
                }

                if (unit.ChampionName.Equals("Nautilus") ||
                    (unit.ChampionName.Equals("Caitlyn") && args.Slot.Equals(SpellSlot.R)))
                {
                    var d = unit.Distance(Player.Instance);
                    var travelTime = d / 3200;
                    var delay = Math.Floor(travelTime * 1000) + 900;
                    Console.WriteLine("TT: " + travelTime + " Delay: " + delay);
                    Core.DelayAction(() => CastW(castUnit), (int)delay);
                    return;
                }
                CastW(castUnit);
            }

            if (type.Equals(SpellDataTargetType.Unit))
            {
                if (unit.ChampionName.Equals("Bard") && args.End.Distance(Player.Instance) < 300)
                {
                    Core.DelayAction(() => CastW(castUnit), 400 + (int)(unit.Distance(Player.Instance) / 7f));
                }
                else if (unit.ChampionName.Equals("Riven") && args.End.Distance(Player.Instance) < 260)
                {
                    CastW(castUnit);
                }
                else
                {
                    CastW(castUnit);
                }
            }
            else if (type.Equals(SpellDataTargetType.LocationAoe) &&
                     args.End.Distance(Player.Instance) < args.SData.CastRadius)
            {
                if (unit.ChampionName.Equals("Annie") && args.Slot.Equals(SpellSlot.R))
                {
                    return;
                }
                CastW(castUnit);
            }
            else if (type.Equals(SpellDataTargetType.Cone) &&
                     args.End.Distance(Player.Instance) < args.SData.CastRadius)
            {
                CastW(castUnit);
            }
            else if (type.Equals(SpellDataTargetType.SelfAoe) || type.Equals(SpellDataTargetType.Self))
            {
                var d = args.End.Distance(Player.Instance.ServerPosition);
                var p = args.SData.CastRadius > 5000 ? args.SData.CastRange : args.SData.CastRadius;
                if (d < p)
                    CastW(castUnit);
            }
        }