Exemplo n.º 1
0
 //Méthodes envoyant les équipes de gladiateurs en lice au combat et récupérant le gagnant du tournoi
 public void startTournament()
 {
     Match match = new Match(TeamsInTournament);
     winnerOfTournament = match.startMatch();
     Thread.Sleep(2000);
     Console.ForegroundColor = ConsoleColor.Magenta;
     if (p1.TeamList.Contains(winnerOfTournament))
     {
         Console.WriteLine("\n--------------------------------------------------------------------------------");
         Console.WriteLine("Le gagnant du tournoi est: " + p1.Pseudo + " avec son équipe " + winnerOfTournament.TeamName + ".\n\t\t GLOIRE AU CHAMPION " + p1.Pseudo.ToUpper() + " !!");
         Console.WriteLine("--------------------------------------------------------------------------------");
     }
     else if (p2.TeamList.Contains(winnerOfTournament))
     {
         Console.WriteLine("--------------------------------------------------------------------------------");
         Console.WriteLine("Le gagnant du tournoi est: " + p2.Pseudo + " avec son équipe " + winnerOfTournament.TeamName + ".\n\t\t GLOIRE AU CHAMPION " + p2.Pseudo.ToUpper() + " !!");
         Console.WriteLine("--------------------------------------------------------------------------------");
     }
     else if (p3.TeamList.Contains(winnerOfTournament))
     {
         Console.WriteLine("--------------------------------------------------------------------------------");
         Console.WriteLine("Le gagnant du tournoi est: " + p3.Pseudo + " avec son équipe " + winnerOfTournament.TeamName + ".\n\t\t GLOIRE AU CHAMPION " + p3.Pseudo.ToUpper() + " !!");
         Console.WriteLine("--------------------------------------------------------------------------------");
     }
     else if (p4.TeamList.Contains(winnerOfTournament))
     {
         Console.WriteLine("--------------------------------------------------------------------------------");
         Console.WriteLine("Le gagnant du tournoi est: " + p4.Pseudo+ " avec son équipe "+winnerOfTournament.TeamName +".\n\t\t GLOIRE AU CHAMPION "+p4.Pseudo.ToUpper()+" !!");
         Console.WriteLine("--------------------------------------------------------------------------------");
     }
     Console.ResetColor();
     Thread.Sleep(2000);
 }
Exemplo n.º 2
0
Arquivo: Match.cs Projeto: AuroreT/POO
        /*Méthode récupérant les équipes de gladiateurs en lice,
         *les tri selon leur ratio
         *les envoie 2 par 2 se battre,
         *incrémente les victoires/défaites de chaque équipe selon leur résultat,
         *renvoie l'équipe gagnante
        */
        public Team startMatch()
        {
            sortTeamsWithRatio(TeamsInTournament);

            while (count < 3)
            {
                t1ToFight = TeamsInTournament[0];
                t2ToFight = TeamsInTournament[1];

                if(count == 1)
                {
                    t1ToFight = TeamsInTournament[2];
                    t2ToFight = TeamsInTournament[3];
                }
                if(count == 2)
                {
                    if(TeamsInTournament[0].InCourse == true)
                    {
                        t1ToFight = TeamsInTournament[0];
                    }
                    else if (TeamsInTournament[1].InCourse == true)
                    {
                        t1ToFight = TeamsInTournament[1];
                    }
                    if (TeamsInTournament[2].InCourse == true)
                    {
                        t2ToFight = TeamsInTournament[2];
                    }
                    else if (TeamsInTournament[3].InCourse == true)
                    {
                        t2ToFight = TeamsInTournament[3];
                    }
                }

                Fight fight = new Fight(t1ToFight, t2ToFight);
                looserT = fight.teamsFight();
                looserT.InCourse = false;
                count++;
            }

            if (TeamsInTournament[0].InCourse == true && TeamsInTournament[1].InCourse == false && TeamsInTournament[2].InCourse == false && TeamsInTournament[3].InCourse == false)
            {
                winnerT = TeamsInTournament[0];
                TeamsInTournament[0].Victories++;
                TeamsInTournament[1].Defeats++;
                TeamsInTournament[2].Defeats++;
                TeamsInTournament[3].Defeats++;
            }
            else if (TeamsInTournament[0].InCourse == false && TeamsInTournament[1].InCourse == true && TeamsInTournament[2].InCourse == false && TeamsInTournament[3].InCourse == false)
            {
                winnerT = TeamsInTournament[0];
                TeamsInTournament[1].Victories++;
                TeamsInTournament[0].Defeats++;
                TeamsInTournament[2].Defeats++;
                TeamsInTournament[3].Defeats++;
            }
            if (TeamsInTournament[0].InCourse == false && TeamsInTournament[1].InCourse == false && TeamsInTournament[2].InCourse == true && TeamsInTournament[3].InCourse == false)
            {
                winnerT = TeamsInTournament[0];
                TeamsInTournament[2].Victories++;
                TeamsInTournament[1].Defeats++;
                TeamsInTournament[0].Defeats++;
                TeamsInTournament[3].Defeats++;
            }
            if (TeamsInTournament[0].InCourse == false && TeamsInTournament[1].InCourse == false && TeamsInTournament[2].InCourse == false && TeamsInTournament[3].InCourse == true)
            {
                winnerT = TeamsInTournament[0];
                TeamsInTournament[3].Victories++;
                TeamsInTournament[1].Defeats++;
                TeamsInTournament[2].Defeats++;
                TeamsInTournament[0].Defeats++;
            }
            return winnerT;
        }
Exemplo n.º 3
0
 public void deleteTeam(Team t)
 {
     this.TeamList.Remove(t);
 }
Exemplo n.º 4
0
 //Méthode prévoyant l'insertion d'une équipe si le quotat maximum/joueur n'est pas atteint
 public void newTeam(Team t)
 {
     if (this.TeamList.Count < teamNumberMaximumByPlayer){this.TeamList.Add(t);}
     else {Console.WriteLine("Nombre maximum d'équipes atteint");}
 }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            //CONSTRUCTION DES JOUEURS----------------------------------------------------------------------------------------------------------------------------
            Player firstPlayer = new Player("Grurm", "Jean", "Dubois");
            Player secondPlayer = new Player("Zadin", "Jeanne", "Dutilleul");
            Player thirdPlayer = new Player("Lycan", "Pierre", "Dupont");
            Player fourthPlayer = new Player("Goteka", "Marie", "Martin");

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("\n---------------------------QUE LE TOURNOI COMMENCE !!---------------------------"); // <-- This line is still white on blue.
            Console.ResetColor();

            Thread.Sleep(1800);

            Console.WriteLine("\nVont s'affronter les joueurs suivants: " + firstPlayer.Pseudo + ", " + secondPlayer.Pseudo + ", " + thirdPlayer.Pseudo + " et " + fourthPlayer.Pseudo+"\n");

            //CONSTRUCTION DES EQUIPES ET ATTRIBUTION AUX JOUEURS (1équipe/joueur pour ce test)---------------------------------------------------------------------------------------------------
            Team firstTeam = new Team("Seventh Device", "EncoreUneDescription");
            Team secondTeam = new Team("Order of the Imperial", "UneNouvelleDescription");
            Team thirdTeam = new Team("Council of the Blue Threat", "UneDescriptio");
            Team fourthTeam = new Team("Ninja Eagles", "UneDernièreDescription");

            firstTeam.Victories = 0;
            firstTeam.Defeats = 2;
            secondTeam.Victories = 3;
            secondTeam.Defeats = 0;
            thirdTeam.Victories = 8;
            thirdTeam.Defeats = 1;
            fourthTeam.Victories = 2;
            fourthTeam.Defeats = 2;

            firstPlayer.newTeam(firstTeam);
            secondPlayer.newTeam(secondTeam);
            thirdPlayer.newTeam(thirdTeam);
            fourthPlayer.newTeam(fourthTeam);

            Console.WriteLine("Le joueur " + firstPlayer.Pseudo + " engage son équipe: "+ firstPlayer.TeamList[0].TeamName);
            Console.WriteLine("Le joueur " + secondPlayer.Pseudo + " engage son équipe: "+ secondPlayer.TeamList[0].TeamName);
            Console.WriteLine("Le joueur " + thirdPlayer.Pseudo + " engage son équipe: "+ thirdPlayer.TeamList[0].TeamName);
            Console.WriteLine("Le joueur " + fourthPlayer.Pseudo + " engage son équipe: "+ fourthPlayer.TeamList[0].TeamName + "\n");
            Console.WriteLine("\n");

            Thread.Sleep(1800);
            //CONSTRUCTION DES GLADIATEURS ET EQUIPEMENTS ET ATTRIBUTION AUX EQUIPES (3gladiateurs/équipe pour ce test)---------------------------------------------------------------------------------------------------

            Gladiator g1 = new Gladiator("Spartacus");
            g1.newEquipment(new Dagger());
            g1.newEquipment(new Shield());

            Gladiator g2 = new Gladiator("Crixus");
            g2.newEquipment(new Helmet());
            g2.newEquipment(new Sword());

            Gladiator g3 = new Gladiator("Marcus");
            g3.newEquipment(new Helmet());
            g3.newEquipment(new Net());

            Gladiator g4 = new Gladiator("Attilius");
            g4.newEquipment(new Net());
            g4.newEquipment(new Helmet());

            Gladiator g5 = new Gladiator("Flamma");
            g5.newEquipment(new Trident());
            g5.newEquipment(new Helmet());

            Gladiator g6 = new Gladiator("Commodus");
            g6.newEquipment(new Sword());
            g6.newEquipment(new Dagger());

            Gladiator g7 = new Gladiator("Priscus");
            g7.newEquipment(new Helmet());
            g7.newEquipment(new Spear());

            Gladiator g8 = new Gladiator("Verus");
            g8.newEquipment(new Dagger());
            g8.newEquipment(new Dagger());
            g8.newEquipment(new Helmet());

            Gladiator g9 = new Gladiator("Carpophorus");
            g9.newEquipment(new Dagger());
            g9.newEquipment(new Spear());

            Gladiator g10 = new Gladiator("Ivy");
            g10.newEquipment(new Dagger());
            g10.newEquipment(new Spear());

            Gladiator g11 = new Gladiator("Kilik");
            g11.newEquipment(new Sword());
            g11.newEquipment(new Dagger());

            Gladiator g12 = new Gladiator("Paul");
            g12.newEquipment(new SmallShield());
            g12.newEquipment(new Dagger());

            firstTeam.NewGladiator(g1);
            firstTeam.NewGladiator(g2);
            firstTeam.NewGladiator(g3);
            secondTeam.NewGladiator(g4);
            secondTeam.NewGladiator(g5);
            secondTeam.NewGladiator(g6);
            thirdTeam.NewGladiator(g7);
            thirdTeam.NewGladiator(g8);
            thirdTeam.NewGladiator(g9);
            fourthTeam.NewGladiator(g10);
            fourthTeam.NewGladiator(g11);
            fourthTeam.NewGladiator(g12);

            Tournament trnmt = new Tournament(firstPlayer, secondPlayer, thirdPlayer, fourthPlayer);
            trnmt.startTournament();

            Console.Read();
        }