Exemple #1
0
        private void ManageFight(Catcheur c1, Catcheur c2) // génération du match round par round
        {
            if (MatchThisSeason % 8 == 0 && MatchThisSeason != 0)
            {
                Season++;
                MatchThisSeason = 1;
            }
            else
            {
                MatchThisSeason++;
            }

            someoneIsDead = false;
            iteration     = 1;
            whoIsDead     = null;

            for (iteration = 1; iteration <= iterationMax; iteration++)
            {
                if (!someoneIsDead)
                {
                    Console.WriteLine($"\n\nITERATION {iteration} !");
                    // On détermine les actions à faire (random)
                    c1.ChooseAction();
                    c2.ChooseAction();

                    // On lance le dé pour voir qui commence, si randomInt = 1 c1 commence / si randomInt = 2 c2 commence
                    Catcheur[] order = WhoIsAttackingFirst(iteration, c1, c2);
                    c1 = order[0]; // commence
                    c2 = order[1]; // fini

                    // On détermine le combo d'action et on le transforme en string, chaque cas est représenté par un duo de nombre compris entre 0 et 2 :
                    // 0 = Attaque
                    // 1 = Defense
                    // 2 = AttaqueSpe
                    // On a donc 00, 01, 02, 10, 11, 12, 20, 21, 22
                    string trinaryAction = "" + ((int)c1.action) + "" + ((int)c2.action);
                    //GetMatchUpScreen( c1, c2, trinaryAction);

                    IterationMatchUp(c1, c2, trinaryAction);

                    // On regarde si l'un des deux joueurs est mort à la fin de l'itération en cours.
                    if (CheckDeathAndManageDeath(c1, c2))
                    {
                        RefreshBonus(c1, c2);
                        DisplayResultCurrentIteration(c1, c2, iteration);
                        break;
                    }
                    // On display le résultat pour cette itération
                    RefreshBonus(c1, c2);
                    DisplayResultCurrentIteration(c1, c2, iteration);
                    Thread.Sleep(1000);
                }

                if (iteration == iterationMax)
                {
                    break;
                }
            }
            DisplayAndManageEndGame(c1, c2);
        }
Exemple #2
0
 public static void ColorAttack(Catcheur c) // affiche l'action "attack" en rouge
 {
     Console.Write($"\n{c.Pseudo} - {c.Health}HP - Action : ");
     Console.ForegroundColor = ConsoleColor.DarkRed;
     Console.WriteLine(c.action + "\n");
     Console.ResetColor();
 }
Exemple #3
0
 public static void ColorAttackSpe(Catcheur c) // affiche l'action "AttackSpecial" en violet
 {
     Console.Write($"\n{c.Pseudo} - {c.Health}HP - Action : ");
     Console.ForegroundColor = ConsoleColor.DarkMagenta;
     Console.WriteLine(c.action + "\n");
     Console.ResetColor();
 }
Exemple #4
0
 public static void ColorDefend(Catcheur c) // affiche l'action "defend" en  vert
 {
     Console.Write($"\n{c.Pseudo} - {c.Health}HP - Action : ");
     Console.ForegroundColor = ConsoleColor.DarkGreen;
     Console.WriteLine(c.action + "\n");
     Console.ResetColor();
 }
Exemple #5
0
        public Boolean AttackTarget(Catcheur cible)
        {
            int targetDefense = 0;

            if (cible.action == CatcheurAction.Attack || cible.action == CatcheurAction.SpeAttackFailed || cible.action == CatcheurAction.Heal)
            {
                Console.WriteLine($"{Pseudo} attaque {cible.Pseudo} à hauteur de {Attack + BonusAttack - DebuffAttack}, {cible.Pseudo} absorbe {cible.BonusDefense} point de dégat !");
                if (this.BonusHeal > 0)
                {
                    Console.WriteLine($"{Pseudo} vol {BonusHeal}");
                    Health += BonusHeal;
                }
                else if (this.DebuffHealth > 0)
                {
                    Console.WriteLine($"{Pseudo} se prend -{DebuffHealth} point de dégat de malus dans la face !");
                    Health -= DebuffHealth;
                }
                targetDefense = 0;
            }
            else if (cible.action == CatcheurAction.Defend)
            {
                Console.WriteLine($"{Pseudo} attaque {cible.Pseudo} à hauteur de {Attack + BonusAttack - DebuffAttack}, {cible.Pseudo} absorbe {cible.Defense + cible.BonusDefense} point de dégat !");
                targetDefense = cible.Defense + cible.BonusDefense;
                if (this.BonusHeal > 0)
                {
                    Console.WriteLine($"{Pseudo} vol {BonusHeal}");
                    Health += BonusHeal;
                }
                else if (DebuffHealth > 0)
                {
                    Console.WriteLine($"{Pseudo} se prend -{DebuffHealth} point de dégat de malus !");
                    Health -= DebuffHealth;
                }
            }


            int healthCalculated;

            healthCalculated = (cible.Health + targetDefense - cible.DebuffDefense) - (this.Attack + this.BonusAttack - this.DebuffAttack);
            //Console.WriteLine(healthCalculated);
            if (healthCalculated > 0)
            {
                if (healthCalculated < cible.Health)
                {
                    cible.Health = healthCalculated;
                }
                // else no changes...


                return(true);
            }
            else
            {
                Console.WriteLine($"{cible.Pseudo} est mort sur le coup...");
                cible.CatcheurState = CatcheurState.Mort;
                cible.Health        = 0;
                return(false);
            }
        }
Exemple #6
0
 public static void HealWinner(Catcheur winner) // heal le gagnant
 {
     winner.Health           = winner.maxHealth;
     Console.ForegroundColor = ConsoleColor.DarkGray;
     Console.WriteLine($"Le gagnant {winner.Pseudo} a été soigné de la totalité de ses points de vie !");
     Console.ResetColor();
     UpdateConvalAndChangeState();
 }
Exemple #7
0
 private Catcheur[] WhoWinsAndLooses(Catcheur c1, Catcheur c2) // need explication
 {
     if (c1.Health > c2.Health)
     {
         return(new Catcheur[] { c1, c2 });
     }
     else
     {
         return(new Catcheur[] { c2, c1 });
     }
 }
Exemple #8
0
 private Boolean CheckDeathAndManageDeath(Catcheur c1, Catcheur c2) // on verifie l'état du catcheur pour savoir si il est mort
 {
     if (c1.CatcheurState == CatcheurState.Mort)
     {
         return(SetDeath(c1));
     }
     else if (c2.CatcheurState == CatcheurState.Mort)
     {
         return(SetDeath(c2));
     }
     return(false);
 }
Exemple #9
0
        private void DisplayEndScreen(Catcheur c1, Catcheur c2) // flo c'est vraiment l'ecran de game over ?
        {
            Console.WriteLine("Appuyez sur n'importe quelle touche pour accéder à l'écran de fin");
            Console.ReadLine();
            Console.Clear();
            Console.WriteLine("THE END");
            Console.WriteLine("Résumé : ");
            // à faire par qui veux

            //retour menu principal
            MenuManager.instance.RetourMainMenu();
        }
Exemple #10
0
 public static void SetConvalAndHeal(Catcheur winner, Catcheur looser) // on heal le gagnant puis on verifie la vie du perdant et on lui change son état si besoin
 {
     HealWinner(winner);
     if (looser.Health < (looser.maxHealth / 2))
     {
         looser.DayRemainingBeforeOp = MatchManager.instance.dice.Next(2, 6);
         looser.CatcheurState        = CatcheurState.Convalescent;
         Console.ForegroundColor     = ConsoleColor.DarkGray;
         Console.WriteLine($"Le perdant {looser.Pseudo} part en convalescence pour {looser.DayRemainingBeforeOp} jours suite à ses blessures...\n");
         Console.ResetColor();
     }
     else
     {
         Console.ForegroundColor = ConsoleColor.DarkGray;
         Console.WriteLine($"Le perdant {looser.Pseudo} est assez en forme pour continuer la saison !\n");
         Console.ResetColor();
     }
 }
Exemple #11
0
        private void DisplayAndManageEndGame(Catcheur c1, Catcheur c2) // genère le fin de game
        {
            Catcheur[] winnerLooser = WhoWinsAndLooses(c1, c2);
            Catcheur   winner       = winnerLooser[0];
            Catcheur   looser       = winnerLooser[1];
            double     gainDuMatch;

            if (whoIsDead == null)
            {
                gainDuMatch = MoneyManager.instance.UpdateMoney(iteration, false);
                Console.WriteLine($"\n\nLES {iteration} ROUNDS SONT FINIS, FIN DU MATCH SANS MORT !\n");

                Console.WriteLine($"Le Vainqueur du match est {winner.Pseudo}, BRAVO ! *El Chapo applaudit*");
                Console.WriteLine($"Le perdant n'est nul autre que {looser.Pseudo}, ce match lui aura valu une bonne convalescence !\n");
                MoneyManager.instance.ColorAndDisplayMoney(gainDuMatch, MoneyManager.instance.Money);
                HistoryManager.instance.Addhistory(winner, looser, WinState.PAR_DELAI, iteration, gainDuMatch);
                Console.WriteLine("  ####  NEWS  ####\n  ");
                Hospital.SetConvalAndHeal(winner, looser);
            }
            else
            {
                SoundManager.instance.playSimpleSoundMort();
                gainDuMatch = MoneyManager.instance.UpdateMoney(iteration, true);
                Console.WriteLine($"\n\nLE MATCH C'EST TERMINE EN {iteration} ROUNDS, malheureusement {looser.Pseudo} est mort !\n");
                Console.WriteLine($"Le Vainqueur du match est {winner.Pseudo}, BRAVO ! *El Chapo applaudit*");
                Console.WriteLine($"Le perdant n'est nul autre que {looser.Pseudo}, ce match lui aura valu une bonne convalescence !\n");
                MoneyManager.instance.ColorAndDisplayMoney(gainDuMatch, MoneyManager.instance.Money);
                HistoryManager.instance.Addhistory(winner, looser, WinState.KO, iteration, gainDuMatch);
                Hospital.HealWinner(winner);
            }

            if (Hospital.IsEveryoneDead())
            {
                DisplayEndScreen(c1, c2);
            }
            else
            {
                MenuManager.instance.RetourMainMenu();
            }
        }
Exemple #12
0
        private void RefreshBonus(Catcheur c1, Catcheur c2) // permet de remettre les bonus a 0
        {
            // Refresh bonus
            c1.BonusAttack  = 0;
            c1.BonusDefense = 0;

            c2.BonusAttack  = 0;
            c2.BonusDefense = 0;

            c1.BonusHeal = 0;
            c2.BonusHeal = 0;


            c1.DebuffHealth = 0;
            c2.DebuffHealth = 0;

            c1.DebuffAttack = 0;
            c2.DebuffAttack = 0;

            c1.DebuffDefense = 0;
            c2.DebuffDefense = 0;
        }
Exemple #13
0
        private Catcheur[] WhoIsAttackingFirst(int iteration, Catcheur c1, Catcheur c2)
        {
            if (iteration == 1)
            {
                int randomInt = dice.Next(1, 3);

                if (randomInt == 2)
                {
                    Catcheur tempC1 = c1;
                    c1 = c2;
                    c2 = tempC1;
                    startedToAttack = c2;
                }
                else
                {
                    startedToAttack = c1;
                }
            }
            else
            {
                if (startedToAttack == c1)
                {
                    Catcheur tempC1 = c1;
                    c1 = c2;
                    c2 = tempC1;
                    startedToAttack = c2;
                }
                else
                {
                    Catcheur tempC2 = c2;
                    c2 = c1;
                    c1 = tempC2;
                    startedToAttack = c1;
                }
            }
            Catcheur[] orderedCatcheurs = { c1, c2 };
            return(orderedCatcheurs);
        }
        public void SpecialAttackComputing(Catcheur attaquant)
        {
            List <Object> whatToDo = new List <Object>();
            Boolean       specialAttackSuccess;
            string        specialAttackSelected;

            switch (attaquant.SpecialAtk)
            {
            //BLOQUE : Defense
            //L’ordonnateur des pompes funèbres  -> 0.3 bloque
            //Jarvan cinquième du nom            -> 0.3 bloque
            //Jeff Radis                         -> 0.3 bloque
            //Chris Hart                         -> 0.3 bloque
            case SpecialAttack.Bloque:
                whatToDo              = AttackSpecialSuccess(attaquant.Pseudo, SpecialAttack.Bloque, new int[] { 30 });
                specialAttackSuccess  = (Boolean)whatToDo[0];
                specialAttackSelected = (string)whatToDo[1];
                if (specialAttackSuccess)
                {
                    attaquant.action       = CatcheurAction.Defend;
                    attaquant.BonusDefense = int.MaxValue - 1000;     //apparement si int.MaxValue dépasse la max value justement le nombre devient négatif ! J'ai soustrait 1000 pour éviter ça :)
                }
                else
                {
                    attaquant.action = CatcheurAction.SpeAttackFailed;
                }
                break;

            //ONESHOT : Attaque
            // Bret Benoit -> 0.08 tue en un coup
            case SpecialAttack.Oneshot:
                whatToDo              = AttackSpecialSuccess(attaquant.Pseudo, SpecialAttack.Oneshot, new int[] { 8 });
                specialAttackSuccess  = (Boolean)whatToDo[0];
                specialAttackSelected = (string)whatToDo[1];
                if (specialAttackSuccess)
                {
                    attaquant.action      = CatcheurAction.Attack;
                    attaquant.BonusAttack = int.MaxValue - 1000;
                }
                else
                {
                    attaquant.action = CatcheurAction.SpeAttackFailed;
                }
                break;

            //JudyPower :
            //P1 -> 0.4 +5 hp ATTAQUE
            //P2 -> 0.6 def + 1 DEFEND
            case SpecialAttack.JuddyPower:
                whatToDo              = AttackSpecialSuccess(attaquant.Pseudo, SpecialAttack.JuddyPower, new int[] { 60, 40 });
                specialAttackSuccess  = (Boolean)whatToDo[0];
                specialAttackSelected = (string)whatToDo[1];
                if (specialAttackSuccess)
                {
                    if (specialAttackSelected == "P1")
                    {
                        attaquant.action       = CatcheurAction.Defend;
                        attaquant.BonusDefense = 1;     // +1 DEF
                    }
                    else if (specialAttackSelected == "P2")
                    {
                        attaquant.action    = CatcheurAction.Heal;
                        attaquant.BonusHeal = 5;
                    }
                }
                else
                {
                    attaquant.action = CatcheurAction.SpeAttackFailed;
                }
                break;

            //DeadPoulePower :
            //P1 -> 0.1 def + 1 DEFEND
            //P2 -> 0.1 inflige (3 HP + Attaque) se soigne 3HP ATTAQUE
            //P3 -> 0.3 +2HP ATTAQUE
            case SpecialAttack.DeadPoulePower:
                whatToDo              = AttackSpecialSuccess(attaquant.Pseudo, SpecialAttack.DeadPoulePower, new int[] { 30, 10, 10 });
                specialAttackSuccess  = (Boolean)whatToDo[0];
                specialAttackSelected = (string)whatToDo[1];
                if (specialAttackSuccess)
                {
                    if (specialAttackSelected == "P1")
                    {
                        attaquant.action    = CatcheurAction.Heal;
                        attaquant.BonusHeal = 2;
                    }
                    else if (specialAttackSelected == "P2")
                    {
                        attaquant.action      = CatcheurAction.Attack;
                        attaquant.BonusAttack = 3;
                    }
                    else if (specialAttackSelected == "P3")
                    {
                        attaquant.action       = CatcheurAction.Defend;
                        attaquant.BonusDefense = 1;
                    }
                }
                else
                {
                    attaquant.action = CatcheurAction.SpeAttackFailed;
                }
                break;

            //Triple Hache
            //Hache Foudroyante : 0.2 inflige attaque +2dmg, perd 1HP
            case SpecialAttack.HacheFoudroyante:
                whatToDo              = AttackSpecialSuccess(attaquant.Pseudo, SpecialAttack.HacheFoudroyante, new int[] { 20 });
                specialAttackSuccess  = (Boolean)whatToDo[0];
                specialAttackSelected = (string)whatToDo[1];
                if (specialAttackSuccess)
                {
                    attaquant.action       = CatcheurAction.Attack;
                    attaquant.BonusAttack  = 2;
                    attaquant.DebuffHealth = 1;
                }
                else
                {
                    attaquant.action = CatcheurAction.SpeAttackFailed;
                }
                break;

            case SpecialAttack.OffensiveBlock:
                whatToDo              = AttackSpecialSuccess(attaquant.Pseudo, SpecialAttack.OffensiveBlock, new int[] { 40 });
                specialAttackSuccess  = (Boolean)whatToDo[0];
                specialAttackSelected = (string)whatToDo[1];
                if (specialAttackSuccess)
                {
                    attaquant.action       = CatcheurAction.Attack;
                    attaquant.DebuffAttack = 2;     // tape à 1... un peu cochon mais bon...
                    attaquant.BonusDefense = 4;
                }
                else
                {
                    attaquant.action = CatcheurAction.SpeAttackFailed;
                }

                break;

            case SpecialAttack.RaieDuC:
                whatToDo              = AttackSpecialSuccess(attaquant.Pseudo, SpecialAttack.RaieDuC, new int[] { 60, 40 });
                specialAttackSuccess  = (Boolean)whatToDo[0];
                specialAttackSelected = (string)whatToDo[1];
                if (specialAttackSuccess)
                {
                    if (specialAttackSelected == "P1")
                    {
                        attaquant.action       = CatcheurAction.Attack;
                        attaquant.BonusAttack  = 1;    // tape à 1... un peu cochon mais bon...
                        attaquant.BonusDefense = 2;
                    }
                    else if (specialAttackSelected == "P2")
                    {
                        attaquant.action    = CatcheurAction.Heal;
                        attaquant.BonusHeal = -3;
                    }
                }
                else
                {
                    attaquant.action = CatcheurAction.SpeAttackFailed;
                }
                break;
            }
        }
Exemple #15
0
 private void NothingIsHappening(Catcheur c1, Catcheur c2) // nothing is happening
 {
     Console.WriteLine($"{c1.Pseudo} et {c2.Pseudo} se regardent droit dans les yeux, mais rien ne se passe...");
 }
Exemple #16
0
        public void ManageActionAndDisplayResult(Catcheur attaquant, Catcheur defenseur) // gère les actions
        {
            switch (attaquant.action)
            {
            case CatcheurAction.Defend:
                if (defenseur.action == CatcheurAction.Attack)
                {
                    defenseur.AttackTarget(attaquant);
                }
                else if (defenseur.action == CatcheurAction.Heal)
                {
                    defenseur.Heal(defenseur.BonusHeal);
                }
                else
                {
                    NothingIsHappening(attaquant, defenseur);
                }

                break;

            case CatcheurAction.Attack:
                if (defenseur.action == CatcheurAction.Attack)
                {
                    if (attaquant.AttackTarget(defenseur))
                    {
                        defenseur.AttackTarget(attaquant);
                    }
                }
                if (defenseur.action == CatcheurAction.Heal)
                {
                    if (attaquant.AttackTarget(defenseur))
                    {
                        defenseur.Heal(defenseur.BonusHeal);
                    }
                }
                else if (defenseur.action == CatcheurAction.Defend)
                {
                    attaquant.AttackTarget(defenseur);
                }
                else if (defenseur.action == CatcheurAction.SpeAttackFailed)
                {
                    attaquant.AttackTarget(defenseur);
                }
                break;

            case CatcheurAction.Heal:
                if (defenseur.action == CatcheurAction.Attack)
                {
                    attaquant.Heal(attaquant.BonusHeal);
                    defenseur.AttackTarget(attaquant);
                }
                if (defenseur.action == CatcheurAction.Heal)
                {
                    attaquant.Heal(attaquant.BonusHeal);
                    defenseur.Heal(defenseur.BonusHeal);
                }
                else if (defenseur.action == CatcheurAction.Defend)
                {
                    attaquant.Heal(attaquant.BonusHeal);
                }
                else if (defenseur.action == CatcheurAction.SpeAttackFailed)
                {
                    attaquant.Heal(attaquant.BonusHeal);
                }
                break;

            case CatcheurAction.SpeAttackFailed:
                if (defenseur.action == CatcheurAction.Attack)
                {
                    defenseur.AttackTarget(attaquant);
                }
                else if (defenseur.action == CatcheurAction.Heal)
                {
                    defenseur.Heal(defenseur.BonusHeal);
                }
                else
                {
                    NothingIsHappening(attaquant, defenseur);
                }
                break;
            }
        }
Exemple #17
0
 private void DisplayResultCurrentIteration(Catcheur c1, Catcheur c2, int iteration) // notification de l'état des catcheurs a chaque itération
 {
     Console.WriteLine($"\nRésumé du round {iteration} : \n{c1.Pseudo} : {c1.Health} HP\n{c2.Pseudo} : {c2.Health} HP\n");
 }
Exemple #18
0
        public void IterationMatchUp(Catcheur c1, Catcheur c2, string trinary) // on génère les actions du round
        {
            switch (trinary)
            {
            // Attaque - Attaque
            case "00":
                Colorer.ColorAttack(c1);
                Colorer.ColorAttack(c2);

                if (c1.AttackTarget(c2))     // Si c1 attaque c2 & c2 ne meurt pas
                {
                    c2.AttackTarget(c1);
                }
                break;

            // Attaque - Defense
            case "01":
                Colorer.ColorAttack(c1);
                Colorer.ColorDefend(c2);
                c1.AttackTarget(c2);
                break;

            // Attaque - AttaqueSpe
            case "02":
                Colorer.ColorAttack(c1);
                Colorer.ColorAttackSpe(c2);
                SpecialAttackManager.instance.SpecialAttackComputing(c2);
                ManageActionAndDisplayResult(c1, c2);
                break;

            // Defense - Attaque
            case "10":
                Colorer.ColorDefend(c1);
                Colorer.ColorAttack(c2);
                c2.AttackTarget(c1);
                break;

            // Defense - Defense
            case "11":
                Colorer.ColorDefend(c1);
                Colorer.ColorDefend(c2);
                NothingIsHappening(c1, c2);
                break;

            // Defense - AttaqueSpe
            case "12":
                Colorer.ColorDefend(c1);
                Colorer.ColorAttackSpe(c2);
                SpecialAttackManager.instance.SpecialAttackComputing(c2);
                ManageActionAndDisplayResult(c1, c2);
                break;

            //AttaqueSpe - Attaque
            case "20":
                Colorer.ColorAttackSpe(c1);
                Colorer.ColorAttack(c2);
                SpecialAttackManager.instance.SpecialAttackComputing(c1);
                ManageActionAndDisplayResult(c1, c2);
                break;

            //AttaqueSpe - Defense
            case "21":
                Colorer.ColorAttackSpe(c1);
                Colorer.ColorDefend(c2);
                SpecialAttackManager.instance.SpecialAttackComputing(c1);
                ManageActionAndDisplayResult(c1, c2);
                break;

            // AttaqueSpe - AttaqueSpe
            case "22":
                Colorer.ColorAttackSpe(c1);
                Colorer.ColorAttackSpe(c2);
                SpecialAttackManager.instance.SpecialAttackComputing(c1);
                SpecialAttackManager.instance.SpecialAttackComputing(c2);
                ManageActionAndDisplayResult(c1, c2);
                break;
            }
        }
Exemple #19
0
 public void Addhistory(Catcheur victory, Catcheur perdant, WinState state, int round, double gain)
 {
     HistoryCatcheur.Add(new History(victory.Pseudo, perdant.Pseudo, state, round, gain));
 }
Exemple #20
0
 private Boolean SetDeath(Catcheur dead) // on passe le statue du catcheur mort a mort
 {
     whoIsDead     = dead;
     someoneIsDead = true;
     return(true);
 }