private Composite MountingRoutine()
 {
     ControlInput.SendKey(Keys.S);
     ControlInput.SendKey(Keys.Z);
     Thread.Sleep(1100);
     return(null);
 }
        protected override RunStatus Run(object context)
        {
            var gameState = (CurrentGameState)context;

            foreach (var skill in gameState.Me.HeroData.Skills)
            {
                if (!skill.ShouldCastOnCreeps)
                {
                    continue;
                }
                if (DateTime.Now < skill.OnCooldownUntil)
                {
                    continue;
                }

                if (skill.Properties.Contains(Skill.SkillProperty.Buff))
                {
                    if (gameState.FriendlyCreepsNearby.Any(o =>
                                                           o.Distance2D(gameState.Me.HeroScreenPosition) < 500))
                    {
                        ControlInput.SendKey(skill.Key);
                        ControlInput.MouseClick(ControlInput.MouseClickButton.Left,
                                                gameState.FriendlyCreepsNearby.First());
                        skill.OnCooldownUntil = DateTime.Now.AddSeconds(skill.Cooldown);
                        MainWindow.Log(MainWindow.LogType.Combat,
                                       string.Format("Using '{0}' (range - {1})", skill.Name, skill.Range));

                        return(RunStatus.Success);
                    }
                }
                if (!gameState.EnemyCreepsNearby.Any())
                {
                    return(RunStatus.Failure);
                }
                var unit =
                    gameState.EnemyCreepsNearby.OrderBy(
                        o => o.Distance2D(gameState.Me.HeroScreenPosition)).First();
                //TODO: ADD SMART AOE. THIS JUST SUCKS.
                var dist = unit.Distance2D(gameState.Me.HeroScreenPosition);
                if (dist < skill.Range)
                {
                    var center =
                        new Point(
                            gameState.EnemyCreepsNearby.Sum(o => o.X) /
                            gameState.EnemyCreepsNearby.Length,
                            gameState.EnemyCreepsNearby.Sum(o => o.Y) /
                            gameState.EnemyCreepsNearby.Length);
                    ControlInput.SendKey(skill.Key);
                    ControlInput.MouseClick(ControlInput.MouseClickButton.Left, unit);
                    skill.OnCooldownUntil = DateTime.Now.AddSeconds(skill.Cooldown);
                    MainWindow.Log(MainWindow.LogType.Combat,
                                   string.Format("Using '{0}' ({1} -> {2})", skill.Name, skill.Range, dist));
                    return(RunStatus.Success);
                }
            }
            return(RunStatus.Failure);
        }
        protected override RunStatus Run(object context)
        {
            var gameState = (CurrentGameState)context;

            foreach (var skill in gameState.Me.HeroData.Skills)
            {
                if ((skill.Properties.Contains(Skill.SkillProperty.SoloHeal) ||
                     skill.Properties.Contains(Skill.SkillProperty.AOEHeal)) && skill.IsCastable)
                {
                    if (skill.Cooldown < gameState.Me.HeroHP / 3)
                    {
                        ControlInput.SendKey(skill.Key);
                        ControlInput.MouseClick(ControlInput.MouseClickButton.Left,
                                                gameState.Me.HeroScreenPosition);
                        return(RunStatus.Success);
                    }
                }
            }
            return(RunStatus.Failure);
        }
 private Composite TeleportAction()
 {
     ControlInput.SendKey(Keys.B);
     return(null);
 }