Esempio n. 1
0
        public static void gameOver()
        {
            Console.Clear();
            Program.WriteFormattedLine("{0}", Program.colors[4], "===============================");
            Program.WriteFormattedLine("{0}", Program.colors[4], "===========GAME OVER===========");
            Program.WriteFormattedLine("{0}", Program.colors[4], "===============================");
            Console.WriteLine("Voulez vous rejouer ? (o/n)");
            string overInput = Console.ReadLine();

            if (overInput == "o")
            {
                Console.Clear();
                Init f = new Init();
                f.goHome();
            }
            else if (overInput == "n")
            {
                Environment.Exit(0);
            }
            else
            {
                gameOver();
            }
        }
Esempio n. 2
0
        private void endCombat(bool won, int rndSaved = 0, bool loop = false)
        {


            if (won)
            {
                //showCombat();
                //Console.WriteLine("\n");
                Console.Clear();
                Program.WriteFormattedLine("{0}", Program.colors[2], "======== Vous avez gagné ! ========");
                Program.WriteFormattedLine("{0}", Program.colors[2], "##======= Félicitations ! =======##");


                //Program.WriteFormattedLine("{0}", Program.colors[14], "+ " + dragon.goldReward + " G");
                //if (!loop) player.golds += dragon.goldReward;


                //Program.WriteFormattedLine("{0}", Program.colors[11], "+ " + dragon.xpReward + " XP");
                //if (!loop) player.xp += dragon.xpReward;

                //player.checkLevelUp();

                Console.WriteLine();
                Program.WriteFormattedLine("Appuyez sur {0} pour recommencer", Program.colors[4], "o");

                switch (Console.ReadKey().Key)
                {
                    case ConsoleKey.O:
                        Console.Clear();
                        Init f = new Init();
                        f.goHome();
                        break;
                    default: endCombat(won, 0, true); break;
                    
                }
            }

            else
            {
                Random rnd = new Random();
                int save = rnd.Next(0, 10);
                if (save > 5 || loop)
                {
                    showCombat();
                    Console.WriteLine("\n");
                    Program.WriteFormattedLine("{0}", Program.colors[4], "=============== Vous avez perdu ! ===============");
                    Program.WriteFormattedLine("{0}", Program.colors[4], "...Mais vous parvenez à vous enfuir de justesse !");

                    Program.WriteFormattedLine("{0}", Program.colors[14], "+ " + dragon.goldReward + " G");
                    if (!loop) player.golds += dragon.goldReward / 2;


                    Program.WriteFormattedLine("{0}", Program.colors[11], "+ " + dragon.xpReward + " XP");
                    if (!loop) player.xp += dragon.xpReward / 2;

                    player.checkLevelUp();

                    player.hp = Convert.ToInt32(player.totalHp * 0.10);

                    Console.WriteLine();
                    Program.WriteFormattedLine("Appuyez sur {0} pour retourner à l'accueil", Program.colors[4], "b");

                    switch (Console.ReadKey().Key)
                    {
                        case ConsoleKey.B:
                            new Home(player);
                            break;
                        default: endCombat(won, save, true); break;

                    }

                } else
                {
                    Program.gameOver();
                }
            }
        }