コード例 #1
0
ファイル: Challenge.cs プロジェクト: Godovich/Skillz17
        private static void Handle12111()
        {
            foreach (var pirate in Globals.Game.GetMyLivingPirates())
            {
                if (Globals.Game.GetTurn() < 4)
                {
                    pirate.Navigate(new Location(12, 32));
                }
                else if (Globals.Game.GetEnemyLivingDrones().Any(x => pirate.InAttackRange(x)))
                {
                    Globals.Game.Attack(pirate,
                                        Globals.Game.GetEnemyLivingDrones().First(x => pirate.InAttackRange(x)));
                }
                else if (Globals.Game.GetEnemyLivingPirates().Any(x => pirate.InAttackRange(x)))
                {
                    Globals.Game.Attack(pirate,
                                        Globals.Game.GetEnemyLivingPirates().First(x => pirate.InAttackRange(x)));
                }
                else if (Globals.Game.GetEnemyLivingDrones().Any())
                {
                    pirate.Navigate(Globals.Game.GetEnemyLivingDrones().MinBy(x => x.Distance(pirate)).Location);
                }
                else if (Globals.Game.GetEnemyLivingPirates().Any())
                {
                    pirate.Navigate(Globals.Game.GetEnemyLivingPirates().MinBy(x => x.Distance(pirate)).Location);
                }
            }

            DroneHandler.Handle(0);
        }
コード例 #2
0
ファイル: Challenge.cs プロジェクト: Godovich/Skillz17
        private static void Handle12218()
        {
            var enemies1 = Globals.Game.GetEnemyLivingPirates();

            foreach (var pirate in Globals.Game.GetMyLivingPirates())
            {
                if (enemies1.Any(x => pirate.InAttackRange(x)))
                {
                    var enemy = enemies1.First(x => pirate.InAttackRange(x));
                    Globals.Game.Attack(pirate, enemy);

                    if (enemy.CurrentHealth == 1)
                    {
                        enemies1.Remove(enemy);
                    }
                }
                else if (Globals.Game.GetTurn() < 5)
                {
                    pirate.Navigate(new Location(22, 71));
                }
                else if (Globals.Game.GetEnemyLivingPirates().Any())
                {
                    pirate.Navigate(Globals.Game.GetEnemyLivingPirates().MinBy(x => x.Distance(pirate)).Location);
                }
                else
                {
                    pirate.Navigate(new Location(13, 37));
                }
            }

            DroneHandler.Handle();
            return;
        }
コード例 #3
0
ファイル: Challenge.cs プロジェクト: Godovich/Skillz17
        private static void Handle12221()
        {
            int id = -1;

            DecoyHandler.Handle(ref id);

            var island0 = Globals.Game.GetAllIslands()[0];
            var enemies = Globals.Game.GetEnemyLivingPirates();

            foreach (var pirate in Globals.Game.GetMyLivingPirates())
            {
                if (enemies.Any(x => pirate.InAttackRange(x)))
                {
                    var enemy = enemies.First(x => pirate.InAttackRange(x));
                    Globals.Game.Attack(pirate, enemy);

                    if (enemy.CurrentHealth == 1)
                    {
                        enemies.Remove(enemy);
                    }

                    continue;
                }

                if (!pirate.Location.IsEqualTo(island0.Location))
                {
                    Move(pirate, island0.Location);
                }
            }

            DroneHandler.Handle();
        }
コード例 #4
0
ファイル: Challenge.cs プロジェクト: Godovich/Skillz17
        private static void Handle12217()
        {
            Scores.AttackCloseDrones = 0;
            Scores.AttackFarDrones   = 0;
            Scores.ConquerIsland     = 470;
            Scores.ProtectIsland     = 0;
            Scores.AttackPirates     = 540;
            Scores.GroupProtection   = 0;

            DroneHandler.Handle();

            if (Globals.Game.GetMyScore() + Globals.Game.GetMyLivingDrones().Count > Globals.Game.GetEnemyScore() + 10 || m_started122217)
            {
                m_started122217 = true;
                var bot0 = Globals.Game.GetMyPirateById(0);
                var bot1 = Globals.Game.GetMyPirateById(1);
                var bot2 = Globals.Game.GetMyPirateById(2);

                if (bot0.IsAlive() && !bot0.Location.IsEqualTo(new Location(18, 7)))
                {
                    Move(bot0, new Location(18, 7));
                }
                else if (Globals.Game.GetEnemyLivingDrones().Any(x => bot0.InAttackRange(x)))
                {
                    Globals.Game.Attack(bot0, Globals.Game.GetEnemyLivingDrones().First(x => bot0.InAttackRange(x)));
                }

                if (Globals.Game.GetEnemyLivingDrones().Any(x => bot1.InAttackRange(x)))
                {
                    Globals.Game.Attack(bot1, Globals.Game.GetEnemyLivingDrones().First(x => bot1.InAttackRange(x)));
                }
                else if (bot1.IsAlive() && !bot1.Location.IsEqualTo(new Location(22, 14)))
                {
                    Move(bot1, new Location(22, 14));
                }

                if (Globals.Game.GetEnemyLivingDrones().Any(x => bot2.InAttackRange(x)))
                {
                    Globals.Game.Attack(bot2, Globals.Game.GetEnemyLivingDrones().First(x => bot2.InAttackRange(x)));
                }
                else if (bot2.IsAlive() && !bot2.Location.IsEqualTo(new Location(19, 7)))
                {
                    Move(bot2, new Location(19, 7));
                }

                return;
            }
            else
            {
                new Entry().HandlePirates(-1);
            }
        }
コード例 #5
0
ファイル: Challenge.cs プロジェクト: Godovich/Skillz17
        private static void Handle12223()
        {
            var used = new List <int>();

            foreach (var island in Globals.Game.GetNotMyIslands())
            {
                if (island.Id == 0)
                {
                    continue;
                }
                var p = Globals.Game.GetMyLivingPirates().MinBy(x => x.Distance(island));
                p.Navigate(island.Location);
                used.Add(p.Id);
            }

            foreach (var pirate in Globals.Game.GetMyLivingPirates())
            {
                if (used.Contains(pirate.Id))
                {
                    continue;
                }

                if (Globals.Game.GetEnemyLivingDrones().Any(x => pirate.InAttackRange(x)))
                {
                    Globals.Game.Attack(pirate,
                                        Globals.Game.GetEnemyLivingDrones().First(x => pirate.InAttackRange(x)));
                }
                else if (Globals.Game.GetEnemyLivingPirates().Any(x => pirate.InAttackRange(x)))
                {
                    Globals.Game.Attack(pirate,
                                        Globals.Game.GetEnemyLivingPirates().First(x => pirate.InAttackRange(x)));
                }
                else if (Globals.Game.GetEnemyLivingDrones().Any())
                {
                    pirate.Navigate(Globals.Game.GetEnemyLivingDrones().MinBy(x => x.Distance(pirate)).Location);
                }
                else if (Globals.Game.GetEnemyLivingPirates().Any())
                {
                    pirate.Navigate(Globals.Game.GetEnemyLivingPirates().MinBy(x => x.Distance(pirate)).Location);
                }
            }

            DroneHandler.Handle(15);
        }
コード例 #6
0
        public void DoTurn(PirateGame game)
        {
            Globals.Game   = game;
            Globals.Drones = new DroneGroups();

            // Debug initialization
            if (Globals.Game.GetTurn() == 1)
            {
                Globals.Game.Debug(" - Javier, v3.0.0");
            }

            // Handle challenges
            Debug.Write("Opponent: " + Globals.Game.GetOpponentName());
            if (Challenge.Handle(Globals.Game.GetOpponentName()))
            {
                return;
            }

            // Handle enemy decoy
            DecoyDetector.Update(game.GetEnemyLivingPirates());
            DecoyDetector.Detect();

            // Move drones towards home
            DroneHandler.Handle();

            // Handle friendly decoy
            int id = -1;

            DecoyHandler.Handle(ref id);

            // Handle pirates
            HandlePirates(id);

            // Handle decoy movement
            HandleDecoyMovement();
        }