Пример #1
0
        // Generate two (roughly even) teams from the existing players in Allplayers
        public void GenerateTeam()
        {
            Random rand       = new Random();
            int    counter    = 0;
            int    counterLim = AllPlayers.Count / 2;
            int    randomIndex;

            Console.WriteLine($"Assigning {AllPlayers.Keys.Count} Players...");

            // Reset team states
            Console.WriteLine("Resetting current team...");
            DiscordMember[] keys = new DiscordMember[AllPlayers.Keys.Count];
            AllPlayers.Keys.CopyTo(keys, 0);
            foreach (DiscordMember key in keys)
            {
                Console.WriteLine($"{key.Username}'s being removed from team");
                AllPlayers[key] = -1;
                Console.WriteLine($"{key.Username}'s team has been removed.");
            }
            Console.WriteLine("Clearing team lists");
            Team1.Clear();
            Team2.Clear();

            //Randomly assigns 1 to the Half of all players
            Console.WriteLine($"Team 1 will have {counterLim} Players.");
            while (counter < counterLim)
            {
                randomIndex = rand.Next(AllPlayers.Count);
                DiscordMember key = keys[randomIndex];
                if (AllPlayers[key] == -1)
                {
                    AllPlayers[key] = 1;
                    Team1.Add(key);
                    Console.WriteLine($"{key.Username} has been added to Team 1");
                    counter++;
                }
            }

            //Adds the remaining Users to the Team 2
            Console.WriteLine($"Team 2 will have {AllPlayers.Count - counterLim} Players.");
            foreach (DiscordMember key in keys)
            {
                if (!Team1.Contains(key))
                {
                    AllPlayers[key] = 2;
                    Team2.Add(key);
                    Console.WriteLine($"{key.Username} has been added to Team 2");
                }
            }
        }
Пример #2
0
 // Stops a game and resets all variables
 public void StopGame()
 {
     StopRoundTimer();
     StopGenericTimer();
     Round               = Team1Score = Team2Score = 0;
     RoundResult         = 0;
     CurrentCurePosition = -1;
     AllPlayers.Clear();
     Team1.Clear();
     Team2.Clear();
     Cure.Clear();
     PlayedMinigames.Clear();
     Team1Lead          = Team2Lead = null;
     VoiceChannel       = null;
     CurrentMinigame    = null;
     RoundInProgress    = GenericTimerActive = false;
     LastColorIndexUsed = -1;
     LastColorUsed      = DiscordColor.None;
 }
Пример #3
0
        private void UpdateLogic()
        {
            m_logic.Update();

            if (m_logic.IsFinished())
            {
                if (m_logic is Logic.PreIntro)
                {
                    m_logic = new Logic.ShowCharacterIntro(this);
                    return;
                }

                if (m_logic is Logic.ShowCharacterIntro)
                {
                    m_logic = new Logic.DisplayRoundNumber(this);
                    return;
                }

                if (m_logic is Logic.DisplayRoundNumber)
                {
                    m_logic = new Logic.ShowFight(this);
                    return;
                }

                if (m_logic is Logic.ShowFight)
                {
                    m_logic = new Logic.Fighting(this);
                    return;
                }

                if (m_logic is Logic.Fighting)
                {
                    m_logic = new Logic.CombatOver(this);
                    return;
                }

                if (m_logic is Logic.CombatOver)
                {
                    m_logic = new Logic.ShowWinPose(this);
                    return;
                }

                if (!(m_logic is Logic.ShowWinPose))
                {
                    return;
                }

                if (Team1.Wins.Count >= RoundInformation.NumberOfRounds || Team2.Wins.Count >= RoundInformation.NumberOfRounds)
                {
                    if (Initialization.Mode == CombatMode.Arcade)
                    {
                        var index = Team2.MainPlayer.BasePlayer.Profile.ProfileLoader.PlayerProfiles
                                    .Select(o => o.Profile).ToList()
                                    .IndexOf(Team2.MainPlayer.BasePlayer.Profile) + 1;
                        if (index == Team2.MainPlayer.BasePlayer.Profile.ProfileLoader.PlayerProfiles.Count)
                        {
                            GetMainSystem <Menus.MenuSystem>().PostEvent(new Events.SwitchScreen(ScreenType.Title));
                            m_logic = new Logic.NoMoreFighting(this);
                            return;
                        }

                        RoundNumber = 1;
                        MatchNumber++;

                        // same team 1
                        Team1.Clear();
                        Team1.CreatePlayers(Initialization.Team1Mode, Initialization.Team1P1, Initialization.Team1P2);

                        // update team 2
                        var profile = Team2.MainPlayer.BasePlayer.Profile.ProfileLoader.PlayerProfiles[index].Profile;
                        Team2.Clear();
                        Team2.CreatePlayers(Initialization.Team2Mode,
                                            new PlayerCreation(profile, 0, PlayerMode.Ai),
                                            null);
                        m_logic = new Logic.PreIntro(this);
                        return;
                    }

                    GetMainSystem <Menus.MenuSystem>().PostEvent(new Events.SwitchScreen(ScreenType.Title));
                    m_logic = new Logic.NoMoreFighting(this);
                    return;
                }

                RoundNumber++;
                m_logic = new Logic.PreIntro(this);
            }
        }
Пример #4
0
        private void GenerateButton_Click(object sender, EventArgs e)
        {
            Team1.Clear();
            Team2.Clear();
            Team3.Clear();
            Team4.Clear();
            Team5.Clear();
            Team6.Clear();
            Team7.Clear();
            Team8.Clear();
            Team9.Clear();
            Team10.Clear();
            Team11.Clear();
            Team12.Clear();
            Team13.Clear();
            Team14.Clear();



            int teamSize = GetTeamSize();
            int totalTeams;

            if (teamSize == 4)
            {
                totalTeams = 7;

                vsLabel.Visible     = false;
                usaLabel.Visible    = false;
                europeLabel.Visible = false;

                Team8.Visible            = false;
                Team9.Visible            = false;
                Team10.Visible           = false;
                Team11.Visible           = false;
                Team12.Visible           = false;
                Team13.Visible           = false;
                Team14.Visible           = false;
                SendItPictureBox.Visible = true;
                DalyBox.Visible          = true;
            }
            else
            {
                totalTeams               = 14;
                vsLabel.Visible          = true;
                usaLabel.Visible         = true;
                europeLabel.Visible      = true;
                Team8.Visible            = true;
                Team9.Visible            = true;
                Team10.Visible           = true;
                Team11.Visible           = true;
                Team12.Visible           = true;
                Team13.Visible           = true;
                Team14.Visible           = true;
                SendItPictureBox.Visible = false;
                DalyBox.Visible          = false;
            }



            string[] All = { "Brian Kelly ", "Lucas Bogard ", "Drew Taylor ", "Jordan Popa", "Ryan Popa", "Dan Kellogg", "Brent Whitten", "Buddy Sheffer", "Vikash Pillay", "Jake Desrochers", "Brad Smith", "Eddie Nickerson", "Connor Dixon", "Eric Gordon", "Jake Miller", "Jake Townsend", "James Strabel", "Jordan Rife", "Kevin Bartosek", "Mike Harmeson", "Brad Fite", "Drew Nichols", "Billy Auxier", "Cam Corteggiano", "Chad Bigger", "Justin Rife", "Nick Carlson", "Troy Kierczynski" };

            int[] Rankings = { 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };

            string[] OnesArray   = { "Brian Kelly", "Lucas Bogard", "Drew Taylor" };
            string[] TwosArray   = { "Jordan Popa", "Ryan Popa", "Dan Kellogg", "Brent Whitten", "Buddy Sheffer", "Vikash Pillay", "Jake Desrochers", "Brad Smith", "Connor Dixon" };
            string[] ThreesArray = { "Eddie Nickerson", "Eric Gordon", "Jake Miller", "Jake Townsend", "James Strabel", "Jordan Rife", "Kevin Bartosek", "Mike Harmeson", "Brad Fite" };
            string[] FoursArray  = { "Drew Nichols", "Billy Auxier", "Cam Corteggiano", "Chad Bigger", "Justin Rife", "Nick Carlson", "Troy Kierczynski" };

            ArrayList Players = new ArrayList();
            ArrayList Ranks   = new ArrayList();
            ArrayList Ones    = new ArrayList();
            ArrayList Twos    = new ArrayList();
            ArrayList Threes  = new ArrayList();
            ArrayList Fours   = new ArrayList();

            Players.AddRange(All);
            Ranks.AddRange(Rankings);
            Ones.AddRange(OnesArray);
            Twos.AddRange(TwosArray);
            Threes.AddRange(ThreesArray);
            Fours.AddRange(FoursArray);

            for (int y = 1; y <= totalTeams; y++)
            {
                ArrayList Team = new ArrayList();

                int Sum = 0;
                //for (int x = 0; x < teamSize; x++)
                //{

                int playerNumber;
                if (teamSize == 4)
                {
                    if (y <= 2)
                    {
                        playerNumber = GetNumber(Ones.Count);
                        Team.Add(Ones[playerNumber]);
                        Ones.Remove(Ones[playerNumber]);

                        playerNumber = GetNumber(Threes.Count);
                        Team.Add(Threes[playerNumber]);
                        Threes.Remove(Threes[playerNumber]);

                        playerNumber = GetNumber(Threes.Count);
                        Team.Add(Threes[playerNumber]);
                        Threes.Remove(Threes[playerNumber]);

                        playerNumber = GetNumber(Fours.Count);
                        Team.Add(Fours[playerNumber]);
                        Fours.Remove(Fours[playerNumber]);
                    }


                    if (y == 3)
                    {
                        playerNumber = GetNumber(Ones.Count);
                        Team.Add(Ones[playerNumber]);
                        Ones.Remove(Ones[playerNumber]);

                        playerNumber = GetNumber(Twos.Count);
                        Team.Add(Twos[playerNumber]);
                        Twos.Remove(Twos[playerNumber]);

                        playerNumber = GetNumber(Threes.Count);
                        Team.Add(Threes[playerNumber]);
                        Threes.Remove(Threes[playerNumber]);

                        playerNumber = GetNumber(Fours.Count);
                        Team.Add(Fours[playerNumber]);
                        Fours.Remove(Fours[playerNumber]);
                    }



                    if (y > 3)
                    {
                        playerNumber = GetNumber(Twos.Count);
                        Team.Add(Twos[playerNumber]);
                        Twos.Remove(Twos[playerNumber]);

                        playerNumber = GetNumber(Twos.Count);
                        Team.Add(Twos[playerNumber]);
                        Twos.Remove(Twos[playerNumber]);

                        playerNumber = GetNumber(Threes.Count);
                        Team.Add(Threes[playerNumber]);
                        Threes.Remove(Threes[playerNumber]);

                        playerNumber = GetNumber(Fours.Count);
                        Team.Add(Fours[playerNumber]);
                        Fours.Remove(Fours[playerNumber]);
                    }



                    if (y == 1)
                    {
                        foreach (string s in Team)
                        {
                            Team1.AppendText(s);

                            Team1.AppendText("\r\n");

                            //Team1Sum.Text = Sum.ToString();
                        }
                    }

                    if (y == 2)
                    {
                        foreach (string s in Team)
                        {
                            Team2.AppendText(s);

                            Team2.AppendText("\r\n");

                            // Team2Sum.Text = Sum.ToString();
                        }
                    }

                    if (y == 3)
                    {
                        foreach (string s in Team)
                        {
                            Team3.AppendText(s);

                            Team3.AppendText("\r\n");

                            // Team3Sum.Text = Sum.ToString();
                        }
                    }

                    if (y == 4)
                    {
                        foreach (string s in Team)
                        {
                            Team4.AppendText(s);

                            Team4.AppendText("\r\n");

                            // Team4Sum.Text = Sum.ToString();
                        }
                    }

                    if (y == 5)
                    {
                        foreach (string s in Team)
                        {
                            Team5.AppendText(s);

                            Team5.AppendText("\r\n");

                            //Team5Sum.Text = Sum.ToString();
                        }
                    }

                    if (y == 6)
                    {
                        foreach (string s in Team)
                        {
                            Team6.AppendText(s);

                            Team6.AppendText("\r\n");

                            //Team6Sum.Text = Sum.ToString();
                        }
                    }

                    if (y == 7)
                    {
                        foreach (string s in Team)
                        {
                            Team7.AppendText(s);

                            Team7.AppendText("\r\n");

                            //Team7Sum.Text = Sum.ToString();
                        }
                    }
                }
                else
                {
                    if (Ones.Count > 0)
                    {
                        if (Ones.Count == 3)
                        {
                            Team.Add("Brian Kelly");
                            Team.Add("Cam Corteggiano");

                            int findBron = Ones.IndexOf("Brian Kelly");
                            int findCam  = Fours.IndexOf("Cam Corteggiano");

                            Ones.Remove(Ones[findBron]);
                            Fours.Remove(Fours[findCam]);
                        }
                        else
                        {
                            playerNumber = GetNumber(Ones.Count);
                            Team.Add(Ones[playerNumber]);



                            Team.Add(Fours[playerNumber]);
                            Fours.Remove(Fours[playerNumber]);

                            Ones.Remove(Ones[playerNumber]);
                        }
                    }
                    else if (Fours.Count > 0)
                    {
                        playerNumber = GetNumber(Twos.Count);
                        Team.Add(Twos[playerNumber]);
                        Twos.Remove(Twos[playerNumber]);

                        playerNumber = GetNumber(Fours.Count);
                        Team.Add(Fours[playerNumber]);
                        Fours.Remove(Fours[playerNumber]);
                    }
                    else if (Twos.Count > 0)
                    {
                        playerNumber = GetNumber(Twos.Count);
                        Team.Add(Twos[playerNumber]);
                        Twos.Remove(Twos[playerNumber]);

                        playerNumber = GetNumber(Threes.Count);
                        Team.Add(Threes[playerNumber]);
                        Threes.Remove(Threes[playerNumber]);
                    }
                    else
                    {
                        playerNumber = GetNumber(Threes.Count);
                        Team.Add(Threes[playerNumber]);
                        Threes.Remove(Threes[playerNumber]);

                        playerNumber = GetNumber(Threes.Count);
                        Team.Add(Threes[playerNumber]);
                        Threes.Remove(Threes[playerNumber]);
                    }



                    if (y == 1)
                    {
                        foreach (string s in Team)
                        {
                            Team1.AppendText(s);

                            Team1.AppendText("\r\n");

                            //Team1Sum.Text = Sum.ToString();
                        }
                    }

                    if (y == 2)
                    {
                        foreach (string s in Team)
                        {
                            Team8.AppendText(s);

                            Team8.AppendText("\r\n");

                            // Team2Sum.Text = Sum.ToString();
                        }
                    }

                    if (y == 3)
                    {
                        foreach (string s in Team)
                        {
                            Team2.AppendText(s);

                            Team2.AppendText("\r\n");

                            // Team3Sum.Text = Sum.ToString();
                        }
                    }

                    if (y == 4)
                    {
                        foreach (string s in Team)
                        {
                            Team9.AppendText(s);

                            Team9.AppendText("\r\n");

                            // Team4Sum.Text = Sum.ToString();
                        }
                    }

                    if (y == 5)
                    {
                        foreach (string s in Team)
                        {
                            Team3.AppendText(s);

                            Team3.AppendText("\r\n");

                            //Team5Sum.Text = Sum.ToString();
                        }
                    }

                    if (y == 6)
                    {
                        foreach (string s in Team)
                        {
                            Team10.AppendText(s);

                            Team10.AppendText("\r\n");

                            //Team6Sum.Text = Sum.ToString();
                        }
                    }

                    if (y == 7)
                    {
                        foreach (string s in Team)
                        {
                            Team4.AppendText(s);

                            Team4.AppendText("\r\n");

                            //Team7Sum.Text = Sum.ToString();
                        }
                    }



                    if (y == 8)
                    {
                        foreach (string s in Team)
                        {
                            Team11.AppendText(s);

                            Team11.AppendText("\r\n");
                        }
                    }

                    if (y == 9)
                    {
                        foreach (string s in Team)
                        {
                            Team5.AppendText(s);

                            Team5.AppendText("\r\n");
                        }
                    }

                    if (y == 10)
                    {
                        foreach (string s in Team)
                        {
                            Team12.AppendText(s);

                            Team12.AppendText("\r\n");
                        }
                    }

                    if (y == 11)
                    {
                        foreach (string s in Team)
                        {
                            Team6.AppendText(s);

                            Team6.AppendText("\r\n");
                        }
                    }

                    if (y == 12)
                    {
                        foreach (string s in Team)
                        {
                            Team13.AppendText(s);

                            Team13.AppendText("\r\n");
                        }
                    }

                    if (y == 13)
                    {
                        foreach (string s in Team)
                        {
                            Team7.AppendText(s);

                            Team7.AppendText("\r\n");
                        }
                    }

                    if (y == 14)
                    {
                        foreach (string s in Team)
                        {
                            Team14.AppendText(s);

                            Team14.AppendText("\r\n");
                        }
                    }
                }



                //if(Ones.Contains(Players[playerNumber]))
                //{
                //    Team.Add(Players[playerNumber]);

                //    Sum = Sum + (int)Ranks[playerNumber];

                //    Players.Remove(Players[playerNumber].ToString());
                //    Ranks.Remove(Ranks[playerNumber]);

                //    Ones.Remove(Ones[playerNumber].ToString());

                //}

                //Team.Add(Players[playerNumber]);

                //Sum = Sum + (int)Ranks[playerNumber];

                //Players.Remove(Players[playerNumber].ToString());
                //Ranks.Remove(Ranks[playerNumber]);


                // }



                //if (y == 1)
                //{
                //    foreach (string s in Team)
                //    {

                //        Team1.AppendText(s);

                //        Team1.AppendText("\r\n");

                //        //Team1Sum.Text = Sum.ToString();
                //    }

                //}

                //if (y == 2)
                //{
                //    foreach (string s in Team)
                //    {

                //        Team2.AppendText(s);

                //        Team2.AppendText("\r\n");

                //       // Team2Sum.Text = Sum.ToString();
                //    }
                //}

                //if (y == 3)
                //{
                //    foreach (string s in Team)
                //    {

                //        Team3.AppendText(s);

                //        Team3.AppendText("\r\n");

                //       // Team3Sum.Text = Sum.ToString();
                //    }
                //}

                //if (y == 4)
                //{
                //    foreach (string s in Team)
                //    {

                //        Team4.AppendText(s);

                //        Team4.AppendText("\r\n");

                //       // Team4Sum.Text = Sum.ToString();
                //    }
                //}

                //if (y == 5)
                //{
                //    foreach (string s in Team)
                //    {

                //        Team5.AppendText(s);

                //        Team5.AppendText("\r\n");

                //        //Team5Sum.Text = Sum.ToString();
                //    }
                //}

                //if (y == 6)
                //{
                //    foreach (string s in Team)
                //    {

                //        Team6.AppendText(s);

                //        Team6.AppendText("\r\n");

                //        //Team6Sum.Text = Sum.ToString();
                //    }
                //}

                //if (y == 7)
                //{
                //    foreach (string s in Team)
                //    {

                //        Team7.AppendText(s);

                //        Team7.AppendText("\r\n");

                //        //Team7Sum.Text = Sum.ToString();
                //    }
                //}



                //if (y == 8)
                //{

                //    foreach (string s in Team)
                //    {


                //        Team8.AppendText(s);

                //        Team8.AppendText("\r\n");
                //    }
                //}

                //if (y == 9)
                //{

                //    foreach (string s in Team)
                //    {

                //        Team9.AppendText(s);

                //        Team9.AppendText("\r\n");
                //    }
                //}

                //if (y == 10)
                //{
                //    foreach (string s in Team)
                //    {

                //        Team10.AppendText(s);

                //        Team10.AppendText("\r\n");
                //    }
                //}

                //if (y == 11)
                //{
                //    foreach (string s in Team)
                //    {

                //        Team11.AppendText(s);

                //        Team11.AppendText("\r\n");
                //    }
                //}

                //if (y == 12)
                //{
                //    foreach (string s in Team)
                //    {

                //        Team12.AppendText(s);

                //        Team12.AppendText("\r\n");
                //    }
                //}

                //if (y == 13)
                //{
                //    foreach (string s in Team)
                //    {

                //        Team13.AppendText(s);

                //        Team13.AppendText("\r\n");
                //    }
                //}

                //if (y == 14)
                //{
                //    foreach (string s in Team)
                //    {

                //        Team14.AppendText(s);

                //        Team14.AppendText("\r\n");
                //    }
                //}
            }
        }