Esempio n. 1
0
    public void CastSpell(int chosenSpell)
    {
        switch (chosenSpell)
        {
        case (int)SPELLS.Movement:
            Debug.Log("Movement");
            break;

        case (int)SPELLS.Fireball:
            if (fireball.Cast())
            {
                ClearStatus();
            }
            else
            {
                gui.SetCursorStatus("On Cooldown!");
            }
            ClearStatus();
            break;

        case (int)SPELLS.Fireblast:
            if (fireblast.Cast())
            {
                ClearStatus();
            }
            else
            {
                gui.SetCursorStatus("On Cooldown!");
                ClearStatus();
            }
            break;


        case (int)SPELLS.Teleport:
            if (teleport.Cast())
            {
                ClearStatus();
            }
            else
            {
                gui.SetCursorStatus("On Cooldown!");
                ClearStatus();
            }
            break;

        case (int)SPELLS.Windblast:
            if (windblast.Cast())
            {
                ClearStatus();
            }
            else
            {
                gui.SetCursorStatus("On Cooldown!");
                ClearStatus();
            }
            break;
        }
    }
Esempio n. 2
0
        protected override void Update()
        {
            base.Update();
            if (withinRange())
            {
                Teleport teleport = (Teleport)this.GetSpell("Teleport");
                teleport.SetLocation(targetPosition);
                teleport.Cast();

                TimerCount = true;
            }
            if (TimerCount == true)
            {
                timer += Time.deltaTime;
            }
            if (timer > 1)
            {
                Explosion explosion = (Explosion)this.GetSpell("Explosion");
                explosion.SetBody(targetBody);
                explosion.Cast();
            }
        }
Esempio n. 3
0
        /// <summary>
        ///     Picking best Position to move to.
        /// </summary>
        public static void BestPosition()
        {
            if (ObjectsManager.ClosestAlly != null && ObjectsManager.ClosestAlly.Distance(Player.Instance) > 2500)
            {
                Teleport.Cast();
            }

            if (TeamFight)
            {
                LastTeamFight = Core.GameTickCount;
            }

            // If player is Zombie moves follow nearest Enemy.
            if (Player.Instance.IsZombie())
            {
                if (ObjectsManager.NearestEnemy != null)
                {
                    Program.Moveto = "NearestEnemy";
                    Position       = ObjectsManager.NearestEnemy.PredictPosition();
                    return;
                }
                if (ObjectsManager.NearestEnemyMinion != null)
                {
                    Program.Moveto = "NearestEnemyMinion";
                    Position       = ObjectsManager.NearestEnemyMinion.PredictPosition();
                    return;
                }
            }

            // Hunting Bard chimes kappa.
            if (Player.Instance.Hero == Champion.Bard && ObjectsManager.BardChime != null && ObjectsManager.BardChime.Distance(Player.Instance) <= 600)
            {
                Program.Moveto = "BardChime";
                Position       = ObjectsManager.BardChime.Position.Random();
                return;
            }

            // Moves to HealthRelic if the bot needs heal.
            if ((Player.Instance.HealthPercent <= HealthRelicHP || (Player.Instance.ManaPercent <= HealthRelicMP && !Player.Instance.IsNoManaHero())) && ObjectsManager.HealthRelic != null &&
                ((DontStealHR && !EntityManager.Heroes.Allies.Any(a => Player.Instance.Health > a.Health && a.Path.LastOrDefault().IsInRange(ObjectsManager.HealthRelic, ObjectsManager.HealthRelic.BoundingRadius + a.BoundingRadius) && !a.IsMe && a.IsValidTarget() && !a.IsDead)) || !DontStealHR))
            {
                var formana = Player.Instance.ManaPercent < HealthRelicMP && !Player.Instance.IsNoManaHero();
                var rect    = new Geometry.Polygon.Rectangle(Player.Instance.ServerPosition, ObjectsManager.HealthRelic.Position, 375);
                if (ObjectsManager.EnemyTurret != null)
                {
                    var Circle = new Geometry.Polygon.Circle(ObjectsManager.EnemyTurret.ServerPosition, ObjectsManager.EnemyTurret.GetAutoAttackRange());
                    if ((!Circle.Points.Any(p => rect.IsInside(p)) || Circle.Points.Any(p => rect.IsInside(p)) && SafeToDive) && !EntityManager.Heroes.Enemies.Any(e => rect.IsInside(e.PredictPosition()) && e.IsValidTarget() && !e.IsDead))
                    {
                        if (ObjectsManager.HealthRelic.Name.Contains("Bard"))
                        {
                            if (!formana)
                            {
                                Program.Moveto = "BardShrine";
                                Position       = ObjectsManager.HealthRelic.Position;
                                return;
                            }
                        }
                        else
                        {
                            Program.Moveto = "HealthRelic";
                            Position       = ObjectsManager.HealthRelic.Position;
                            return;
                        }
                    }
                }
                else
                {
                    if (!EntityManager.Heroes.Enemies.Any(e => rect.IsInside(e.PredictPosition()) && e.IsValidTarget() && !e.IsDead))
                    {
                        if (ObjectsManager.HealthRelic.Name.Contains("Bard"))
                        {
                            if (!formana)
                            {
                                Program.Moveto = "BardShrine2";
                                Position       = ObjectsManager.HealthRelic.Position;
                                return;
                            }
                        }
                        else
                        {
                            Program.Moveto = "HealthRelic2";
                            Position       = ObjectsManager.HealthRelic.Position;
                            return;
                        }
                    }
                }
            }

            // Pick Thresh Lantern
            if (Player.Instance.HealthPercent <= 50 && ObjectsManager.ThreshLantern != null && ObjectsManager.ThreshLantern.Distance(Player.Instance) <= 800)
            {
                if (Player.Instance.Distance(ObjectsManager.ThreshLantern) > 300)
                {
                    Program.Moveto = "ThreshLantern";
                    Position       = ObjectsManager.ThreshLantern.Position.Random();
                }
                else
                {
                    Player.UseObject(ObjectsManager.ThreshLantern);
                }
                return;
            }

            if (ObjectsManager.DravenAxe != null)
            {
                Program.Moveto = "DravenAxe";
                Position       = ObjectsManager.DravenAxe.Position;
                return;
            }

            // Moves to the Farthest Ally if the bot has Autsim
            if (Brain.Alone() && ObjectsManager.FarthestAllyToFollow != null && Player.Instance.Distance(ObjectsManager.AllySpawn) <= 3000)
            {
                Program.Moveto = "FarthestAllyToFollow";
                Position       = ObjectsManager.FarthestAllyToFollow.PredictPosition().Random();
                return;
            }

            // Stays Under tower if the bot health under 10%.
            if ((ModesManager.Flee || (Player.Instance.HealthPercent < 10 && Player.Instance.CountAlliesInRange(3000) < 3)) && EntityManager.Heroes.Enemies.Count(e => !e.IsDead && e.IsValidTarget(SafeValue + 200)) > 0)
            {
                if (ObjectsManager.SafeAllyTurret != null)
                {
                    Program.Moveto = "SafeAllyTurret";
                    Position       = ObjectsManager.SafeAllyTurret.PredictPosition().Random().Extend(ObjectsManager.AllySpawn.Position.Random(), 400).To3D();
                    return;
                }
                if (ObjectsManager.AllySpawn != null)
                {
                    Program.Moveto = "AllySpawn";
                    Position       = ObjectsManager.AllySpawn.Position.Random();
                    return;
                }
            }

            // Moves to AllySpawn if the bot is diving and it's not safe to dive.
            if (((Player.Instance.UnderEnemyTurret() && !SafeToDive) || Core.GameTickCount - Brain.LastTurretAttack < 2000) && ObjectsManager.AllySpawn != null)
            {
                Program.Moveto = "AllySpawn2";
                Position       = ObjectsManager.AllySpawn.Position.Random();
                return;
            }

            if (Player.Instance.IsMelee)
            {
                MeleeLogic();
            }
            else
            {
                RangedLogic();
            }
        }
Esempio n. 4
0
        /// <summary>
        ///     Picking best Position to move to.
        /// </summary>
        public static void BestPosition()
        {
            if (EnableTeleport && ObjectsManager.ClosestAlly != null)
            {
                Program.Moveto = "Teleporting";
                Teleport.Cast();
            }

            // If player is Zombie moves follow nearest Enemy.
            if (Player.Instance.IsZombie())
            {
                var ZombieTarget = TargetSelector.GetTarget(1000, DamageType.True);
                if (ZombieTarget != null)
                {
                    Program.Moveto = "ZombieTarget";
                    Position       = ZombieTarget.PredictPosition();
                    return;
                }
                if (ObjectsManager.NearestEnemy != null)
                {
                    Program.Moveto = "NearestEnemy";
                    Position       = ObjectsManager.NearestEnemy.PredictPosition();
                    return;
                }
                if (ObjectsManager.NearestEnemyMinion != null)
                {
                    Program.Moveto = "NearestEnemyMinion";
                    Position       = ObjectsManager.NearestEnemyMinion.PredictPosition();
                    return;
                }
            }

            // Feeding Poros
            if (ObjectsManager.ClosesetPoro != null)
            {
                var porosnax = new Item(2052);
                if (porosnax != null && porosnax.IsOwned(Player.Instance) && porosnax.IsReady())
                {
                    porosnax.Cast(ObjectsManager.ClosesetPoro);
                    Logger.Send("Feeding ClosesetPoro");
                }
            }

            // Hunting Bard chimes kappa.
            if (PickBardChimes && ObjectsManager.BardChime != null)
            {
                Program.Moveto = "BardChime";
                Position       = ObjectsManager.BardChime.Position.Random();
                return;
            }

            // Moves to HealthRelic if the bot needs heal.
            if ((Player.Instance.PredictHealthPercent() <= HealthRelicHP || (Player.Instance.ManaPercent <= HealthRelicMP && !Player.Instance.IsNoManaHero())) && ObjectsManager.HealthRelic != null &&
                ((DontStealHR && !EntityManager.Heroes.Allies
                  .Any(a => Player.Instance.PredictHealth() > a.PredictHealth() && a.Path.LastOrDefault().IsInRange(ObjectsManager.HealthRelic, ObjectsManager.HealthRelic.BoundingRadius + a.BoundingRadius) &&
                       !a.IsMe && a.IsValidTarget())) || !DontStealHR))
            {
                var formana = Player.Instance.ManaPercent < HealthRelicMP && !Player.Instance.IsNoManaHero();
                var rect    = new Geometry.Polygon.Rectangle(Player.Instance.ServerPosition, ObjectsManager.HealthRelic.Position, 375);
                if (ObjectsManager.EnemyTurret != null)
                {
                    var Circle = new Geometry.Polygon.Circle(ObjectsManager.EnemyTurret.ServerPosition, ObjectsManager.EnemyTurret.GetAutoAttackRange());
                    if ((!Circle.Points.Any(p => rect.IsInside(p)) || Circle.Points.Any(p => rect.IsInside(p)) && SafeToDive) && !EntityManager.Heroes.Enemies.Any(e => rect.IsInside(e.PredictPosition()) && e.IsValid && !e.IsDead))
                    {
                        if (ObjectsManager.HealthRelic.Name.Contains("Bard"))
                        {
                            if (!formana)
                            {
                                Program.Moveto = "BardShrine";
                                Position       = ObjectsManager.HealthRelic.Position;
                                return;
                            }
                        }
                        else
                        {
                            Program.Moveto = "HealthRelic";
                            Position       = ObjectsManager.HealthRelic.Position;
                            return;
                        }
                    }
                }
                else
                {
                    if (!EntityManager.Heroes.Enemies.Any(e => rect.IsInside(e.PredictPosition()) && e.IsValid && !e.IsDead))
                    {
                        if (ObjectsManager.HealthRelic.Name.Contains("Bard"))
                        {
                            if (!formana)
                            {
                                Program.Moveto = "BardShrine2";
                                Position       = ObjectsManager.HealthRelic.Position;
                                return;
                            }
                        }
                        else
                        {
                            Program.Moveto = "HealthRelic2";
                            Position       = ObjectsManager.HealthRelic.Position;
                            return;
                        }
                    }
                }
            }

            // Pick Thresh Lantern
            if (ObjectsManager.ThreshLantern != null)
            {
                if (Player.Instance.Distance(ObjectsManager.ThreshLantern) > 300)
                {
                    Program.Moveto = "ThreshLantern";
                    Position       = ObjectsManager.ThreshLantern.Position.Random();
                }
                else
                {
                    Program.Moveto = "ThreshLantern";
                    Player.UseObject(ObjectsManager.ThreshLantern);
                }
                return;
            }

            if (PickDravenAxe && ObjectsManager.DravenAxe != null)
            {
                Program.Moveto = "DravenAxe";
                Position       = ObjectsManager.DravenAxe.Position;
                return;
            }

            if (PickZacBlops && ObjectsManager.ZacBlop != null)
            {
                Program.Moveto = "ZacBlop";
                Position       = ObjectsManager.ZacBlop.Position;
                return;
            }

            /* fix core pls not working :pepe:
             * if (PickCorkiBomb && ObjectsManager.CorkiBomb != null)
             * {
             *  Program.Moveto = "CorkiBomb";
             *  if (Player.Instance.IsInRange(ObjectsManager.CorkiBomb, 300))
             *  {
             *      Program.Moveto = "UsingCorkiBomb";
             *      Player.UseObject(ObjectsManager.CorkiBomb);
             *  }
             *  Position = ObjectsManager.CorkiBomb.Position;
             *  return;
             * }*/

            // Moves to the Farthest Ally if the bot has Autsim
            if (Brain.Alone() && ObjectsManager.FarthestAllyToFollow != null && Player.Instance.Distance(ObjectsManager.AllySpawn) <= 3000)
            {
                Program.Moveto = "FarthestAllyToFollow";
                Position       = ObjectsManager.FarthestAllyToFollow.PredictPosition().Random();
                return;
            }

            // Stays Under tower if the bot health under 10%.
            if ((ModesManager.CurrentMode == ModesManager.Modes.Flee || (Player.Instance.PredictHealthPercent() < 10 && Player.Instance.CountAllyHeros(SafeValue + 2000) < 3)) &&
                EntityManager.Heroes.Enemies.Count(e => e.IsValid && !e.IsDead && e.IsInRange(Player.Instance, SafeValue + 200)) > 0)
            {
                if (ObjectsManager.SafeAllyTurret != null)
                {
                    Program.Moveto = "SafeAllyTurretFlee";
                    Position       = ObjectsManager.SafeAllyTurret.PredictPosition().Random().Extend(ObjectsManager.AllySpawn.Position.Random(), 400).To3D();
                    return;
                }
                if (ObjectsManager.AllySpawn != null)
                {
                    Program.Moveto = "AllySpawnFlee";
                    Position       = ObjectsManager.AllySpawn.Position.Random();
                    return;
                }
            }

            // Moves to AllySpawn if the bot is diving and it's not safe to dive.
            if (((Player.Instance.UnderEnemyTurret() && !SafeToDive) || Core.GameTickCount - Brain.LastTurretAttack < 2000) && ObjectsManager.AllySpawn != null)
            {
                Program.Moveto = "AllySpawn2";
                Position       = ObjectsManager.AllySpawn.Position.Random();
                return;
            }

            if (Player.Instance.GetAutoAttackRange() < 425)
            {
                MeleeLogic();
            }
            else
            {
                RangedLogic();
            }
        }
Esempio n. 5
0
        /// <summary>
        ///     Picking best Position to move to.
        /// </summary>
        public static Vector3 BestPosition()
        {
            if (EnableTeleport && ObjectsManager.ClosestAlly != null)
            {
                Program.Moveto = "Teleporting";
                Teleport.Cast();
            }

            // If player is Zombie moves follow nearest Enemy.
            if (Player.Instance.IsZombie())
            {
                var ZombieTarget = TargetSelector.GetTarget(1000, DamageType.Mixed);
                if (ZombieTarget != null)
                {
                    Program.Moveto = "ZombieTarget";
                    Position       = ZombieTarget.PredictPosition();
                    return(Position);
                }
                if (ObjectsManager.NearestEnemy != null)
                {
                    Program.Moveto = "NearestEnemy";
                    Position       = ObjectsManager.NearestEnemy.PredictPosition();
                    return(Position);
                }
                if (ObjectsManager.NearestEnemyMinion != null)
                {
                    Program.Moveto = "NearestEnemyMinion";
                    Position       = ObjectsManager.NearestEnemyMinion.PredictPosition();
                    return(Position);
                }
            }

            // Feeding Poros
            var poro = ObjectsManager.ClosesetPoro;

            if (poro != null)
            {
                var porosnax = new Item(2052);
                if (porosnax != null && porosnax.IsOwned(Player.Instance) && porosnax.IsReady())
                {
                    porosnax.Cast(poro);
                    Logger.Send("Feeding ClosesetPoro");
                }
            }

            // Moves to HealthRelic if the bot needs heal.
            var needHR      = Player.Instance.PredictHealthPercent() <= HealthRelicHP || Player.Instance.ManaPercent <= HealthRelicMP && !Player.Instance.IsNoManaHero();
            var healthRelic = ObjectsManager.HealthRelic;

            if (needHR && healthRelic != null)
            {
                var allyneedHR = EntityManager.Heroes.Allies.Any(a => !a.IsMe && Player.Instance.PredictHealth() > a.PredictHealth() &&
                                                                 a.Path.LastOrDefault(p => p.IsInRange(healthRelic, a.BoundingRadius + healthRelic.BoundingRadius)) != null);

                if (!allyneedHR && DontStealHR || !DontStealHR)
                {
                    var safeHR = Player.Instance.SafePath(healthRelic) || Player.Instance.Distance(healthRelic) <= 200;
                    if (safeHR)
                    {
                        var formana = Player.Instance.ManaPercent <= HealthRelicMP && !Player.Instance.IsNoManaHero();
                        if (healthRelic.Name.Contains("Bard") && !formana)
                        {
                            Program.Moveto = "BardShrine";
                            Position       = healthRelic.Position.Random(MyHero.Instance.BoundingRadius);
                            return(Position);
                        }
                        Program.Moveto = "HealthRelic";
                        Position       = healthRelic.Position.Random(MyHero.Instance.BoundingRadius);
                        return(Position);
                    }
                }
            }

            // Hunting Bard chimes kappa.
            var BardChime = ObjectsManager.BardChime;

            if (PickBardChimes && BardChime != null)
            {
                Program.Moveto = "BardChime";
                Position       = BardChime.Position.Random(MyHero.Instance.BoundingRadius);
                return(Position);
            }

            // Pick Thresh Lantern
            var ThreshLantern = ObjectsManager.ThreshLantern;

            if (ThreshLantern != null)
            {
                if (Player.Instance.Distance(ThreshLantern) > 300)
                {
                    Program.Moveto = "ThreshLantern";
                    Position       = ThreshLantern.Position.Random();
                }
                else
                {
                    Program.Moveto = "ThreshLantern";
                    Player.UseObject(ThreshLantern);
                }
                return(Position);
            }

            if (PickDravenAxe && ObjectsManager.DravenAxe != null)
            {
                Program.Moveto = "DravenAxe";
                Position       = ObjectsManager.DravenAxe.Position;
                return(Position);
            }

            if (PickOlafAxe && ObjectsManager.OlafAxe != null)
            {
                Program.Moveto = "OlafAxe";
                Position       = ObjectsManager.OlafAxe.Position;
                return(Position);
            }

            if (PickZacBlops && ObjectsManager.ZacBlop != null)
            {
                Program.Moveto = "ZacBlop";
                Position       = ObjectsManager.ZacBlop.Position;
                return(Position);
            }

            /* fix core pls not working :pepe:
             * if (PickCorkiBomb && ObjectsManager.CorkiBomb != null)
             * {
             *  Program.Moveto = "CorkiBomb";
             *  if (Player.Instance.IsInRange(ObjectsManager.CorkiBomb, 300))
             *  {
             *      Program.Moveto = "UsingCorkiBomb";
             *      Player.UseObject(ObjectsManager.CorkiBomb);
             *  }
             *  Position = ObjectsManager.CorkiBomb.Position;
             *  return;
             * }*/

            // Moves to the Farthest Ally if the bot has Autsim
            if (Brain.Alone() && ObjectsManager.FarthestAllyToFollow != null && Player.Instance.Distance(ObjectsManager.AllySpawn) <= 3000)
            {
                Program.Moveto = "FarthestAllyToFollow";
                Position       = ObjectsManager.FarthestAllyToFollow.PredictPosition().Random();
                return(Position);
            }

            // Stays Under tower if the bot health under 10%.
            if ((ModesManager.CurrentMode == ModesManager.Modes.Flee || (Player.Instance.PredictHealthPercent() < 10 && Player.Instance.CountAllyHeros(SafeValue + 2000) < 3)) &&
                EntityManager.Heroes.Enemies.Count(e => e.IsValid && !e.IsDead && e.IsInRange(Player.Instance, SafeValue + 200)) > 0)
            {
                if (ObjectsManager.SafeAllyTurret != null)
                {
                    Program.Moveto = "SafeAllyTurretFlee";
                    Position       = ObjectsManager.SafeAllyTurret.PredictPosition().Random().Extend(ObjectsManager.AllySpawn.Position.Random(), 400).To3D();
                    return(Position);
                }
                if (ObjectsManager.AllySpawn != null)
                {
                    Program.Moveto = "AllySpawnFlee";
                    Position       = ObjectsManager.AllySpawn.Position.Random();
                    return(Position);
                }
            }

            // Moves to AllySpawn if the bot is diving and it's not safe to dive.
            if (((Player.Instance.UnderEnemyTurret() && !SafeToDive) || MyHero.TurretAttackingMe) && ObjectsManager.AllySpawn != null)
            {
                Program.Moveto = "AllySpawn2";
                Position       = ObjectsManager.AllySpawn.Position.Random();
                return(Position);
            }

            return(Position = Player.Instance.GetAutoAttackRange() < 425 ? MeleeLogic() : RangedLogic());
        }