コード例 #1
0
 public static bool Clash(Challenger user, Player opponent)
 {
     if (user.WeaponOfChoice == WeaponOfChoice.paper)
     {
         if (opponent.WeaponOfChoice == WeaponOfChoice.rock)
         {
             Console.WriteLine($"{user.Name.ToUpper()}'S MIGHTY SHEET OF PRINTER PAPER ENTIRELY ENCOMPASSES {opponent.Name.ToUpper()}'S PUNY PEBBLE!");
             return(true);
         }
         else if (opponent.WeaponOfChoice == WeaponOfChoice.scissors)
         {
             Console.WriteLine($"THE FINELY SHARPENED EDGES OF {opponent.Name.ToUpper()}'S BLADES TEAR {user.Name.ToUpper()}'S WEAK PAPER TO SHREDS!");
             return(false);
         }
         else
         {
             Console.WriteLine("THE PAPERS STACK ATOP EACH OTHER NEATLY! NO BLOOD IS SPILT! DO IT AGAIN!");
             return(Combat(user, opponent.Name));
         }
     }
     else if (user.WeaponOfChoice == WeaponOfChoice.rock)
     {
         if (opponent.WeaponOfChoice == WeaponOfChoice.scissors)
         {
             Console.WriteLine($"{user.Name.ToUpper()}'S BOULDER DEMOLOISHES {opponent.Name.ToUpper()}'S SHEARS AS IF THEY WERE MADE OF TIN FOIL!");
             return(true);
         }
         else if (opponent.WeaponOfChoice == WeaponOfChoice.paper)
         {
             Console.WriteLine($"{user.Name.ToUpper()}'S BOULDER IS IMMOVEABLE! {opponent.Name.ToUpper()}'S PAPER IS PLACED NEATLY ATOP IT!");
             return(false);
         }
         else
         {
             Console.WriteLine("THE TWO ROCKS SMASH AMONGST EACH OTHER! BOTH ARE DESTROYED! THE CROWD FOUND THAT ENJOYABLE! DO IT AGAIN!");
             return(Combat(user, opponent.Name));
         }
     }
     else
     {
         if (opponent.WeaponOfChoice == WeaponOfChoice.paper)
         {
             Console.WriteLine($"{user.Name.ToUpper()}'S SCISSORS CUT THROUGH {opponent.Name.ToUpper()}'S PAPER LIKE IT WAS PAPER!");
             return(true);
         }
         else if (opponent.WeaponOfChoice == WeaponOfChoice.rock)
         {
             Console.WriteLine($"{user.Name.ToUpper()} IS CRUSHED UNDER THE MASSIVE WEIGHT OF {opponent.Name.ToUpper()}'S ROCK SLIDE!");
             return(false);
         }
         else
         {
             Console.WriteLine("THE TWO SCISSORS SIMPLY SHARPEN EACH OTHER! DO IT AGAIN! WITH MORE DANGER!");
             return(Combat(user, opponent.Name));
         }
     }
 }
コード例 #2
0
 public static string ChooseYourChampion(Challenger user)
 {
     Console.Clear();
     //display the options of champions
     DisplayChampionList();
     //have the user decide which combatant they want to square off against and be sure it's a valid option.
     return(GetUserInput($"WELCOME {user.Name.ToUpper()}! CHOOSE THE SLAYER WHO WILL FACILITATE YOUR DEMISE!",
                         "C'MON. I KNOW IT'S HARD TO FACE YOUR OWN MORTALITY BUT I'M ON A SCHEDULE HERE...",
                         "melvin/melvin the conquerer/harry/harry the unstoppable/1/2"));
 }
コード例 #3
0
        public static bool Combat(Challenger user, string champion)
        {
            //have the user choose their weapon
            user.WeaponOfChoice = user.GenerateRoshambo();

            bool win = false;

            //create the opponent
            if (champion.ToLower() == "melvin" || champion.ToLower() == "melvin the conquerer" || champion == "1")
            {
                Melvin opponent = CreateMelvin();
                opponent.WeaponOfChoice = opponent.GenerateRoshambo();
                win = Clash(user, opponent);
            }
            else
            {
                Harry opponent = CreateHarry();
                opponent.WeaponOfChoice = opponent.GenerateRoshambo();
                win = Clash(user, opponent);
            }
            return(win);
        }
コード例 #4
0
        public static void RunApplication()
        {
            bool       playAgain = true;
            bool       win       = false;
            int        winCount  = 0;
            int        lossCount = 0;
            Challenger user      = new Challenger();

            //get the user's name
            user.Name = IntroductionToTheArena();
            //have the user choose their opponent
            string champion = ChooseYourChampion(user);

            while (playAgain)
            {
                win = Combat(user, champion);
                if (win == true)
                {
                    winCount++;
                }
                else
                {
                    lossCount++;
                }
                string response = GetUserInput("DO YOU DARE REENTER THE ARENA, FOOL?", "YES OR NO! ARE YOU BRASH ENOUGH TO FACE THE MONSTERS AGAIN??", "yes/no");
                if (response.ToLower() == "yes")
                {
                    playAgain = true;
                }
                else
                {
                    playAgain = false;
                    Console.WriteLine($"{user.Name.ToUpper()}'S RECORD IN THE ARENA IS AS FOLLOWS! {winCount} - {lossCount}");
                }
            }
        }