Exemplo n.º 1
0
        private static Positions?AssignPlayerPosition()
        {
            do
            {
                Console.WriteLine("(C)enter\n(W)inger\n(D)efenseman");
                Console.Write("Please select a position: ");
                input = Console.ReadLine().Trim().ToLower();

                switch (input)
                {
                case "c":
                case "center":
                    return(Positions.center);

                case "w":
                case "winger":
                    return(Positions.winger);

                case "d":
                case "defenseman":
                    return(Positions.defenseman);

                case "g":
                case "goalie":
                    TextFormat.Error("Custom goalie feature has not and may not be implemented. Please try again.\n");
                    break;

                default:
                    TextFormat.Error("Invalid selection. Please try again.\n");
                    break;
                }
            } while (true);
        }
Exemplo n.º 2
0
        private static short?SelectDifficulty()
        {
            Console.WriteLine("Please select your player's skill level:");
            Console.WriteLine("(R)ookie (Hard): 560 skill points / overall avg ~80");
            Console.WriteLine("(V)eteran (Normal): 600 skill points / overall avg ~86");
            Console.WriteLine("(F)ranchise (Easy): 640 skill points / overall avg ~91\n");

            do
            {
                Console.Write("Skill level: ");
                input = Console.ReadLine().Trim().ToLower();

                switch (input)
                {
                case "r":
                case "rookie":
                    return(560);

                case "v":
                case "vet":
                case "veteran":
                    return(600);

                case "f":
                case "franchise":
                    return(640);
                }

                TextFormat.Error("Invalid selection. Please try again.\n");
                input = "";
            } while (true);
        }
Exemplo n.º 3
0
        private static string AssignPlayerName()
        {
            do
            {
                Console.Write("Enter your player's name: ");
                input = Console.ReadLine().Trim();

                if (input.Equals(""))
                {
                    TextFormat.Error("Player's name cannot be empty. Please try again.\n");
                }
                else if (input.Length > 35)
                {
                    TextFormat.Error("Player's name cannot be more than 35 characters. Please try again.\n");
                }
                else if (input.ToLower().Contains("gretzky") ||
                         input.ToLower().Contains("gretzki") ||
                         input.ToLower().Contains("gretsky") ||
                         input.ToLower().Contains("gretski"))
                {
                    TextFormat.Error("No, just...no. Please try again.\n");
                }
                else
                {
                    return(input);
                }
            } while (true);
        }
Exemplo n.º 4
0
        private static void AllocatePoints(Player newPlayer, short spBank)
        {
            short spBankReset = spBank;
            byte  speed;
            byte  strength;
            byte  stickHandling;
            byte  passing;
            byte  shooting;
            byte  offAwareness;
            byte  defAwareness = 0;
            bool  valid        = false;

            do
            {
                spBank = spBankReset;
                Console.Clear();
                DisplayStatExplaination(spBank);

                speed   = AssignStat("Speed", spBank, 7);
                spBank -= speed;

                strength = AssignStat("Strength", spBank, 6);
                spBank  -= strength;

                stickHandling = AssignStat("Stick Handling", spBank, 5);
                spBank       -= stickHandling;

                passing = AssignStat("Passing", spBank, 4);
                spBank -= passing;

                shooting = AssignStat("Shooting", spBank, 3);
                spBank  -= shooting;

                offAwareness = AssignStat("Offensive Awareness", spBank, 2);
                spBank      -= offAwareness;

                if (spBank == 0)
                {
                    TextFormat.Error("You do not have enough skill points to proceed.");
                    Console.WriteLine("Press any key to re-enter stats...");
                    Console.ReadKey();
                }
                else
                {
                    defAwareness = AssignStat("Defensive Awareness", spBank, 1);
                    valid        = (defAwareness > 0 ? true : false);
                }
            } while (!valid);

            newPlayer.Speed         = speed;
            newPlayer.Strength      = strength;
            newPlayer.StickHandling = stickHandling;
            newPlayer.Passing       = passing;
            newPlayer.Shooting      = shooting;
            newPlayer.OffAwareness  = offAwareness;
            newPlayer.DefAwareness  = defAwareness;
        }
Exemplo n.º 5
0
        private static void DisplayStatExplaination(short spBank)
        {
            Console.Write("You have ");
            TextFormat.Green(spBank.ToString());
            Console.WriteLine(" points to spend on the following stats:");

            Console.WriteLine("    * Speed\n\tUsed for outskating your opponent and increase breakaway chances.");
            Console.WriteLine("    * Strength\n\tGood for checking opponents to force turnovers or break through zones.");
            Console.WriteLine("    * Stick Handling\n\tIncrease passing and shooting chances; used in faceoffs (Center position only).");
            Console.WriteLine("    * Passing\n\tSet up one-timers or pass through zones; CPU teammates will gain control of puck.");
            Console.WriteLine("    * Shooting\n\tSelf-explanitory.");
            Console.WriteLine("    * Offensive Awareness\n\tProvides stat bonuses and additional options in the offensive zone.");
            Console.WriteLine("    * Defensive Awareness\n\tProvides stat bonuses and additional options in the defensive zone.\n");
            TextFormat.Error("Skill point values may range from 1 - 99\n");
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            PrintHeader();
            Console.ReadKey();
            Console.Clear();

            #region Menu
            bool          exit         = false;
            string        input        = "";
            List <Player> customRoster = new List <Player>();

            // TODO Research and implement cursor functionality
            // https://stackoverflow.com/questions/46908148/controlling-menu-with-the-arrow-keys-and-enter

            PrintMenu(customRoster);
            do
            {
                Console.Write("Menu option: ");
                input = Console.ReadLine();

                switch (input)
                {
                case "1":
                    //customRoster.Add(new Player(TeamRenders.RenderStockTeam("STL"), "a", Positions.center,33,99,99,99,99,1,99,99));
                    Exhibition.Start(customRoster);
                    PrintMenu(customRoster);
                    break;

                case "2":
                    customRoster = CustomPlayerMenu.CallSubMenu(customRoster);
                    PrintMenu(customRoster);
                    break;

                case "3":
                    Console.WriteLine("Exiting game...");
                    exit = !exit;
                    break;

                default:
                    TextFormat.Error("Invalid entry. Please try again.\n");
                    break;
                }
            } while (!exit);
            #endregion
        }
Exemplo n.º 7
0
        private static byte?AssignPlayerNumber()
        {
            Console.WriteLine("Select a jersey number between #1 - #98");

            if (newPlayerTeam.RetiredNumbers.Any())
            {
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.Write("NOTE: The following retired numbers cannot be chosen: ");
                foreach (byte retired in newPlayerTeam.RetiredNumbers)
                {
                    Console.Write("#" + retired + " ");
                }
                Console.ResetColor();
            }

            do
            {
                Console.Write("\nNumber: #");
                input = Console.ReadLine().Trim();
                int n = 0;

                if (!int.TryParse(input, out n) || (n < 1 || n > 99))
                {
                    TextFormat.Error("Player number must be between 1 - 98. Please try again.");
                }
                else
                {
                    if (n == 99)
                    {
                        TextFormat.Error("Wayne Gretzky's number, #99, was retired league-wide on " +
                                         "Feb. 6, 2000. Please try again.");
                    }
                    else if (newPlayerTeam.RetiredNumbers.Contains((byte)n))
                    {
                        TextFormat.Error($"#{n} is a retired number and cannot be worn by " +
                                         $"current and future {newPlayerTeam.Name} players. Please try again.");
                    }
                    else
                    {
                        return((byte)n);
                    }
                }
            } while (true);
        }
Exemplo n.º 8
0
        private static Team SelectTeam(char sel)
        {
            do
            {
                input = "";

                Console.Write("Enter the 3-letter abbreviation for " +
                              $"{(sel.Equals('p') ? "your" : "opposing")} team selection: ");
                input = Console.ReadLine().ToUpper();

                if (IsAbbreviationValid(input))
                {
                    Console.WriteLine();
                    return(TeamRenders.RenderStockTeam(input));
                }

                TextFormat.Error("Invalid selection. Please try again.\n");
            } while (true);
        }
Exemplo n.º 9
0
        private static void SelectPlayer(Team t)
        {
            Console.WriteLine("Select a player:\n" +
                              $"(C)enter: {t.Center}\n" +
                              $"(W)inger: {t.Winger}\n" +
                              $"(D)efensman: {t.Defenseman}\n");

            do
            {
                string p = "";
                Console.Write("Please select a position: ");
                p = Console.ReadLine().ToLower();

                switch (p)
                {
                case "c":
                case "center":
                    user = t.Center;
                    return;

                case "w":
                case "winger":
                    user = t.Winger;
                    return;

                case "d":
                case "defenseman":
                    user = t.Defenseman;
                    return;

                case "g":
                case "goalie":
                    TextFormat.Error("Goalie is not a playable position. Please try again.\n");
                    break;

                default:
                    TextFormat.Error("Invalid selection. Please try again.\n");
                    break;
                }
            } while (true);
        }
Exemplo n.º 10
0
        private static Team AssignPlayerTeam()
        {
            Team t;

            #region Team Selection Menu Options
            Console.WriteLine(@"ANA | Anaheim Ducks         ARI | Arizona Coyotes        BOS | Boston Bruins");
            Console.WriteLine(@"BUF | Buffalo Sabres        CGY | Calgary Flames         CAR | Carolina Hurricanes");
            Console.WriteLine(@"CHI | Chicago Blackhawks    COL | Colorado Avalanche     CBJ | Columbus Blue Jackets");
            Console.WriteLine(@"DAL | Dallas Stars          DET | Detroit Red Wings      EDM | Edmonton Oilers");
            Console.WriteLine(@"FLA | Florida Panthers      LAK | Los Angeles Kings      MIN | Minnesota Wild");
            Console.WriteLine(@"MTL | Montreal Canadiens    NSH | Nashville Predators    NJD | New Jersey Devils");
            Console.WriteLine(@"NYI | New York Islanders    NYR | New York Rangers       OTT | Ottawa Senators");
            Console.WriteLine(@"PHI | Philadelphia Flyers   PIT | Pittsburgh Penguins    STL | Saint Louis Blues");
            Console.WriteLine(@"SJS | San Jose Sharks       TBL | Tampa Bay Lightning    TOR | Toronto Maple Leafs");
            Console.WriteLine(@"VAN | Vancouver Canucks     VGK | Vegas Golden Knights   WSH | Washington Capitals");
            Console.WriteLine("WPG | Winnipeg Jets\n");
            #endregion

            do
            {
                Console.Write("Enter the 3-letter abbreviation for your team: ");
                input = Console.ReadLine().ToUpper();
                if (IsAbbreviationValid(input))
                {
                    t = TeamRenders.RenderCustomTeam(TeamRenders.RenderStockTeam(input), customRoster);

                    if (t.Center.IsCustom && t.Winger.IsCustom && t.Defenseman.IsCustom)
                    {
                        TextFormat.Error($"\nWarning! The {newPlayerTeam} roster contains all custom players.\n" +
                                         "If you continue, you will be required to overwrite one of the preexisting " +
                                         "custom players.\nWould you like to continue?\n");

                        do
                        {
                            Console.Write("Select (Y)es/(N)o: ");
                            string overwriteInput = Console.ReadLine().Trim().ToLower();

                            switch (overwriteInput)
                            {
                            case "yes":
                            case "y":
                                return(t);

                            case "no":
                            case "n":
                                return(AssignPlayerTeam());

                            default:
                                TextFormat.Error("Invalid selection. Please try again.\n");
                                break;
                            }
                        } while (true);
                    }
                    else
                    {
                        return(t);
                    }
                }
                else
                {
                    TextFormat.Error("Invalid selection. Please try again.\n");
                }
            } while (true);
        }
Exemplo n.º 11
0
        private static byte AssignStat(string desc, short spBank, short remainingStats)
        {
            int  stat  = 0;
            bool valid = false;

            do
            {
                Console.Write("You have ");
                TextFormat.Green(spBank.ToString());
                Console.Write($" skill points remaining (~");
                TextFormat.Green((spBank / remainingStats).ToString());
                Console.WriteLine("/stat).");


                Console.Write(desc + ": ");
                input = Console.ReadLine();

                if (!int.TryParse(input, out stat) || (stat < 1 || stat > 99))
                {
                    TextFormat.Error("Stat value must be between 1 and 99. Please try again.\n");
                }
                else if (stat > spBank)
                {
                    TextFormat.Error("You do not have enough skill points. Please try again.\n");
                }
                else if (stat < spBank && desc.Equals("Defensive Awareness"))
                {
                    Console.Write("\nYou still have ");
                    TextFormat.Green((spBank - stat).ToString());
                    Console.WriteLine(" skill points remaining." +
                                      "\nWould you like to continue?\n");

                    do
                    {
                        Console.Write("Select (Y)es/(N)o: ");
                        input = Console.ReadLine().Trim().ToLower();

                        switch (input)
                        {
                        case "yes":
                        case "y":
                            Console.WriteLine();
                            return((byte)stat);

                        case "no":
                        case "n":
                            Console.Write("\nWould you like to reset ");
                            Console.ForegroundColor = ConsoleColor.Red;
                            Console.Write("ALL");
                            Console.ResetColor();
                            Console.WriteLine(" stats and try again?\n");

                            do
                            {
                                Console.Write("Select (Y)es/(N)o: ");
                                input = Console.ReadLine().Trim().ToLower();

                                switch (input)
                                {
                                case "yes":
                                case "y":
                                    return(0);

                                case "no":
                                case "n":
                                    valid = true;
                                    break;

                                default:
                                    TextFormat.Error("Invalid selection. Please try again.\n");
                                    break;
                                }
                            } while (!valid);
                            break;

                        default:
                            TextFormat.Error("Invalid selection. Please try again.\n");
                            break;
                        }
                    } while (!valid);
                }
                else
                {
                    Console.WriteLine();
                    return((byte)stat);
                }
            } while (true);
        }
Exemplo n.º 12
0
        private static void NameNumberValidation(Player newPlayer)
        {
            // Name validation
            bool valid = false;

            do
            {
                List <string> playerNames = new List <string>()
                {
                    newPlayerTeam.Goalie.Name.ToLower()
                };

                if (newPlayer.Position != Positions.center)
                {
                    playerNames.Add(newPlayerTeam.Center.Name.ToLower());
                }

                if (newPlayer.Position != Positions.winger)
                {
                    playerNames.Add(newPlayerTeam.Winger.Name.ToLower());
                }

                if (newPlayer.Position != Positions.defenseman)
                {
                    playerNames.Add(newPlayerTeam.Defenseman.Name.ToLower());
                }

                if (playerNames.Contains(newPlayer.Name.ToLower()))
                {
                    TextFormat.Error($"{newPlayer.Name} is already on the {newPlayerTeam.Name} roster.\n");
                    newPlayer.Name = AssignPlayerName();
                }
                else
                {
                    valid = true;
                }
            } while (!valid);

            // Number validation
            valid = false;

            do
            {
                if (newPlayer.Number == newPlayerTeam.Goalie.Number)
                {
                    TextFormat.Error($"#{newPlayer.Number} is already taken by {newPlayerTeam.Goalie}. " +
                                     "Please select a different number.\n");
                    newPlayer.Number = (byte)AssignPlayerNumber();
                }
                else if (newPlayer.Number == newPlayerTeam.Center.Number && newPlayer.Position != Positions.center)
                {
                    TextFormat.Error($"#{newPlayer.Number} is already taken by {newPlayerTeam.Center}. " +
                                     "Please select a different number.\n");
                    newPlayer.Number = (byte)AssignPlayerNumber();
                }
                else if (newPlayer.Number == newPlayerTeam.Winger.Number && newPlayer.Position != Positions.winger)
                {
                    TextFormat.Error($"#{newPlayer.Number} is already taken by {newPlayerTeam.Winger}. " +
                                     "Please select a different number.\n");
                    newPlayer.Number = (byte)AssignPlayerNumber();
                }
                else if (newPlayer.Number == newPlayerTeam.Defenseman.Number && newPlayer.Position != Positions.defenseman)
                {
                    TextFormat.Error($"#{newPlayer.Number} is already taken by {newPlayerTeam.Defenseman}. " +
                                     "Please select a different number.\n");
                    newPlayer.Number = (byte)AssignPlayerNumber();
                }
                else
                {
                    valid = true;
                }
            } while (!valid);
        }
Exemplo n.º 13
0
        private static void PositionValidation(Player newPlayer)
        {
            Player currentPlayer = newPlayer;

            switch (newPlayer.Position)
            {
            case Positions.center:
                currentPlayer = newPlayerTeam.Center;
                break;

            case Positions.winger:
                currentPlayer = newPlayerTeam.Winger;
                break;

            case Positions.defenseman:
                currentPlayer = newPlayerTeam.Defenseman;
                break;
            }

            if ((newPlayer.Position == currentPlayer.Position) && currentPlayer.IsCustom)
            {
                TextFormat.Error($"\nA custom player is already assigned to the {newPlayerTeam.Name} " +
                                 $"{currentPlayer.Position} position.\nWould you like to overwrite {currentPlayer.Name}?");

                do
                {
                    Console.Write("Select (Y)es/(N)o: ");
                    string overwriteInput = Console.ReadLine().Trim().ToLower();

                    switch (overwriteInput)
                    {
                    case "yes":
                    case "y":
                        TextFormat.Error($"\nYou're about to overwrite {currentPlayer.Name}. " +
                                         "You cannot undo this action.\nAre you sure you want to continue?");
                        do
                        {
                            Console.Write("Select (Y)es/(N)o: ");
                            string confirmInput = Console.ReadLine().Trim().ToLower();

                            switch (confirmInput)
                            {
                            case "yes":
                            case "y":
                                customRoster.Remove(currentPlayer);
                                return;

                            case "no":
                            case "n":
                                AssignPlayerPosition();
                                PositionValidation(newPlayer);
                                return;

                            default:
                                TextFormat.Error("Invalid selection. Please try again.");
                                break;
                            }
                        } while (true);

                    case "no":
                    case "n":
                        AssignPlayerPosition();
                        PositionValidation(newPlayer);
                        return;

                    default:
                        TextFormat.Error("Invalid selection. Please try again.");
                        break;
                    }
                } while (true);
            }
        }
Exemplo n.º 14
0
        private static string DisplayUserChoices()
        {
            #region Shot Attempt
            if (user.HasPuck && zone == Zones.goal)
            {
                Console.WriteLine("\nWhere will you shoot the puck?\n");
                Console.WriteLine("1. Low stick side");
                Console.WriteLine("2. Low glove side");
                Console.WriteLine("3. High stick side");
                Console.WriteLine("4. High glove side");
                Console.WriteLine("5. Between the legs");

                isShooting = true;

                do
                {
                    input = "";

                    Console.Write("\nChoice: ");
                    input = Console.ReadLine().ToLower();
                    Console.WriteLine();

                    if (home.IsUserTeam)
                    {
                        TextFormat.UserHome(user.Name);
                    }
                    else
                    {
                        TextFormat.UserAway(user.Name);
                    }

                    switch (input)
                    {
                    case "1":
                    case "low stick":
                    case "low stick side":
                        Console.Write(" shoots for the low stick side!");
                        return("low stick");

                    case "2":
                    case "low glove":
                    case "low glove side":
                        Console.Write(" shoots for the low glove side!");
                        return("low glove");

                    case "3":
                    case "high stick":
                    case "high stick side":
                        Console.Write(" shoots for the high stick side!");
                        return("high st shoots for ick");

                    case "4":
                    case "high glove":
                    case "high glove side":
                        Console.Write(" shoots for the high glove side!");
                        return("high glove");

                    case "5":
                    case "legs":
                    case "between legs":
                        Console.Write(" shoots for between the goalie's legs!");
                        return("legs");

                    default:
                        Console.WriteLine("Invalid selection. Please try again.");
                        break;
                    }
                } while (true);
            }
            #endregion

            #region Offense
            else if (user.HasPuck)
            {
                Console.WriteLine("How will you proceed?\n");
                Console.WriteLine("1. Skate past the defender (Speed)");
                Console.WriteLine("2. Power through the defender (Strength)");
                Console.WriteLine("3. Deke past the defender (Stick Handling)");

                if (zone != Zones.offensive)
                {
                    Console.Write((user.OffAwareness >= 70 ? "4. Pass to a teammate (Off. Awareness 70+)\n" : ""));
                }
                else
                {
                    Console.WriteLine("4. Shoot the puck (Shooting)");
                    Console.Write((user.OffAwareness >= 86 ? "5. Attempt a one-timer (Passing 87+)\n" : ""));
                }

                do
                {
                    input = "";

                    Console.Write("\nChoice: ");
                    input = Console.ReadLine().ToLower();
                    Console.WriteLine();

                    if (input.Equals("1") || input.Equals("speed"))
                    {
                        if (home.HasPuck)
                        {
                            TextFormat.UserHome(user.Name);
                            Console.Write(" attempts to skate past ");
                            TextFormat.Away(opponent.Name);
                        }
                        else
                        {
                            TextFormat.UserAway(user.Name);
                            Console.Write($" attempts to skate past {opponent}");
                        }
                        return("speed");
                    }
                    else if (input.Equals("2") || input.Equals("strength"))
                    {
                        if (home.HasPuck)
                        {
                            TextFormat.UserHome(user.Name);
                            Console.Write(" attempts to power through ");
                            TextFormat.Away(opponent.Name);
                        }
                        else
                        {
                            TextFormat.UserAway(user.Name);
                            Console.Write($" attempts to power through {opponent}");
                        }
                        return("strength");
                    }
                    else if (input.Equals("3") || input.Contains("stick") || input.Contains("handling"))
                    {
                        if (home.HasPuck)
                        {
                            TextFormat.UserHome(user.Name);
                            Console.Write(" attempts to deke around ");
                            TextFormat.Away(opponent.Name);
                        }
                        else
                        {
                            TextFormat.UserAway(user.Name);
                            Console.Write($" attempts to deke around {opponent}");
                        }
                        return("stickhandling");
                    }
                    else if (zone != Zones.offensive && user.OffAwareness >= 70 &&
                             (input.Equals("4") || input.Contains("passing")))
                    {
                        if (home.HasPuck)
                        {
                            TextFormat.UserHome(user.Name);
                        }
                        else
                        {
                            TextFormat.UserAway(user.Name);
                        }
                        Console.Write(" attempts a stretch pass");
                        return("passing");
                    }
                    else if (zone == Zones.offensive && (input.Equals("4") || input.Contains("shooting")))
                    {
                        if (home.HasPuck)
                        {
                            TextFormat.UserHome(user.Name);
                        }
                        else
                        {
                            TextFormat.UserAway(user.Name);
                        }
                        Console.Write(" shoots from the blue line!");
                        isShooting = true;
                        goalie     = home.IsUserTeam ? away.Goalie : home.Goalie;
                        return("shooting");
                    }
                    else if (zone == Zones.offensive && user.OffAwareness > 86 &&
                             (input.Equals("5") || input.Contains("passing")))
                    {
                        if (home.HasPuck)
                        {
                            TextFormat.UserHome(user.Name);
                            Console.Write(" sets up the one-timer");
                            do
                            {
                                teammate = PickRandomPlayer(home);
                            } while (user.Name.Equals(teammate.Name));
                        }
                        else
                        {
                            TextFormat.UserAway(user.Name);
                            Console.Write(" sets up the one-timer");
                            do
                            {
                                teammate = PickRandomPlayer(away);
                            } while (user.Name.Equals(teammate.Name));
                        }
                        isShooting = true;
                        return("one-timer");
                    }
                    else
                    {
                        TextFormat.Error("Invalid selection. Please try again.");
                    }
                } while (true);
            }
            #endregion

            #region Defense
            Console.WriteLine("How will you defend?\n");
            Console.WriteLine("1. Poke check the puck carrier (Speed)");
            Console.WriteLine("2. Check the puck carrier (Strength)");
            Console.WriteLine("3. \"Pickpocket\" the puck carrier (Stick Handling)");

            do
            {
                input = "";

                Console.Write("\nChoice: ");
                input = Console.ReadLine().ToLower();
                Console.WriteLine();

                if (input.Equals("1") || input.Equals("speed"))
                {
                    if (away.HasPuck)
                    {
                        TextFormat.UserHome(user.Name);
                        Console.Write(" speeds up to poke check ");
                        TextFormat.Away(opponent.Name);
                    }
                    else
                    {
                        TextFormat.UserAway(user.Name);
                        Console.Write($" speeds up to poke check {opponent}");
                    }
                    return("speed");
                }
                else if (input.Equals("2") || input.Equals("strength"))
                {
                    if (away.HasPuck)
                    {
                        TextFormat.UserHome(user.Name);
                        Console.Write(" gets ready to check ");
                        TextFormat.Away(opponent.Name);
                    }
                    else
                    {
                        TextFormat.UserAway(user.Name);
                        Console.Write($" gets ready to check {opponent}");
                    }
                    return("strength");
                }
                else if (input.Equals("3") || input.Contains("stick") || input.Contains("handling"))
                {
                    if (away.HasPuck)
                    {
                        TextFormat.UserHome(user.Name);
                        Console.Write(" attempts to pick ");
                        TextFormat.Away(opponent.Name + "'s");
                        Console.Write(" pocket");
                    }
                    else
                    {
                        TextFormat.UserAway(user.Name);
                        Console.Write($" attempts to pick {opponent}'s pocket");
                    }
                    return("stickhandling");
                }
                else
                {
                    TextFormat.Error("Invalid selection. Please try again.");
                }
            } while (true);
            #endregion
        }
Exemplo n.º 15
0
        public static void Start(List <Player> customRoster)
        {
            Team userTeam;
            Team opponent;

            Console.Clear();

            Console.WriteLine("NHL Threes Exhibition Game\n");

            // Select teams
            #region Team Selection Menu Options
            Console.WriteLine(@"ANA | Anaheim Ducks         ARI | Arizona Coyotes        BOS | Boston Bruins");
            Console.WriteLine(@"BUF | Buffalo Sabres        CGY | Calgary Flames         CAR | Carolina Hurricanes");
            Console.WriteLine(@"CHI | Chicago Blackhawks    COL | Colorado Avalanche     CBJ | Columbus Blue Jackets");
            Console.WriteLine(@"DAL | Dallas Stars          DET | Detroit Red Wings      EDM | Edmonton Oilers");
            Console.WriteLine(@"FLA | Florida Panthers      LAK | Los Angeles Kings      MIN | Minnesota Wild");
            Console.WriteLine(@"MTL | Montreal Canadiens    NSH | Nashville Predators    NJD | New Jersey Devils");
            Console.WriteLine(@"NYI | New York Islanders    NYR | New York Rangers       OTT | Ottawa Senators");
            Console.WriteLine(@"PHI | Philadelphia Flyers   PIT | Pittsburgh Penguins    STL | Saint Louis Blues");
            Console.WriteLine(@"SJS | San Jose Sharks       TBL | Tampa Bay Lightning    TOR | Toronto Maple Leafs");
            Console.WriteLine(@"VAN | Vancouver Canucks     VGK | Vegas Golden Knights   WSH | Washington Capitals");
            Console.WriteLine("WPG | Winnipeg Jets\n");
            #endregion

            userTeam            = SelectTeam('p');
            userTeam.IsUserTeam = true;
            do
            {
                opponent = SelectTeam('c');

                if (userTeam.Name.Equals(opponent.Name))
                {
                    TextFormat.Error($"The {userTeam} has already been selected. Please try again.\n");
                }
            } while (userTeam.Name.Equals(opponent.Name));

            // Select player
            if (customRoster.Any())
            {
                userTeam = TeamRenders.RenderCustomTeam(userTeam, customRoster);
                opponent = TeamRenders.RenderCustomTeam(opponent, customRoster);
            }

            SelectPlayer(userTeam);

            // Home/away designations
            if (Roll(2) == 1)
            {
                home            = userTeam;
                away            = opponent;
                home.IsUserTeam = true;
            }
            else
            {
                home            = opponent;
                away            = userTeam;
                away.IsUserTeam = true;
            }
            home.IsHome = true;

            Console.Clear();
            Console.Write("TONIGHT! The visiting ");
            TextFormat.Away(away.Name);
            Console.WriteLine($" play against the {home}!\n");
            Thread.Sleep(1000);

            PlayGame();
        }