Exemplo n.º 1
0
        public static void SetupTeam(string team)
        {
            List <Player> ActiveReserves;
            List <Player> ActiveOnField;

            if (team == "Home")
            {
                ActiveOnField   = HomeOnField;
                ActiveReserves  = HomeReserves;
                Cursor.Position = new int[] { 0, 0 };
            }
            else
            {
                ActiveOnField   = AwayOnField;
                ActiveReserves  = AwayReserves;
                Cursor.Position = new int[] { 13, 0 };
            }
            AvailableActions = new List <string> {
                "Open the reserves", "Move Player", "Return the Player on this tile to the reserves", "End Setup"
            };
            while (true)
            {
                RenderHandler.RenderPitch();
                string SelectedChoice = Cursor.MoveCursorOnPitch(team);
                switch (SelectedChoice)
                {
                case "Open the reserves":
                    Player SelectedPlayer = GetPlayerFromList(ActiveReserves);
                    ActiveReserves.Remove(SelectedPlayer);
                    ActiveOnField.Add(SelectedPlayer);
                    Cursor.HoldingPlayer = SelectedPlayer;
                    break;

                case "Return the Player on this tile to the reserves":
                    if (PitchHandler.Pitch[Cursor.Position[0], Cursor.Position[1]].StoredPlayer != null)
                    {
                        ActiveOnField.Remove(PitchHandler.Pitch[Cursor.Position[0], Cursor.Position[1]].StoredPlayer);
                        ActiveReserves.Add(PitchHandler.Pitch[Cursor.Position[0], Cursor.Position[1]].StoredPlayer);
                        PitchHandler.Pitch[Cursor.Position[0], Cursor.Position[1]].StoredPlayer = null;
                    }
                    break;

                case "Move Player":
                    Cursor.HoldingPlayer = PitchHandler.Pitch[Cursor.Position[0], Cursor.Position[1]].StoredPlayer;
                    PitchHandler.Pitch[Cursor.Position[0], Cursor.Position[1]].StoredPlayer = null;
                    break;

                case "End Setup":
                    int onLoS     = 0;
                    int inWideTop = 0;
                    int inWideBot = 0;
                    foreach (Player player in ActiveOnField)
                    {
                        if ((player.Position[0] == 12 || player.Position[0] == 13) && (player.Position[1] > 3 || player.Position[1] < 11))
                        {
                            onLoS++;
                        }
                        if (player.Position[1] <= 3)
                        {
                            inWideTop++;
                        }
                        if (player.Position[1] >= 11)
                        {
                            inWideBot++;
                        }
                    }
                    if (inWideBot > 2 || inWideTop > 2)
                    {
                        Console.WriteLine("You may only have two players in the widezones");
                        Console.ReadKey();
                        break;
                    }
                    else if (onLoS < 0)     //Fix count, debug rn
                    {
                        Console.WriteLine("You must have at least 3 players on the line of scrimage");
                        Console.WriteLine("(You currently have: {0} players on the line of scrimage)", onLoS);
                        Console.ReadKey();
                        break;
                    }
                    else if (ActiveOnField.Count > 11)
                    {
                        Console.WriteLine("You cannot have more than 11 players on the field");
                        Console.ReadKey();
                        break;
                    }
                    else if (ActiveOnField.Count < 0)     //Fix playercount, debug rn
                    {
                        Console.WriteLine("You must place as many players as you can on the field (up to 11 players)");
                        Console.ReadKey();
                        break;
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }