コード例 #1
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");
        }
コード例 #2
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);
        }
コード例 #3
0
        public static List <Player> Create(List <Player> loadCustomRoster)
        {
            if (loadCustomRoster.Any())
            {
                customRoster = loadCustomRoster;
            }
            else
            {
                customRoster = new List <Player>();
            }

            #region Player Initialization
            // Team
            Console.Clear();
            newPlayerTeam = AssignPlayerTeam();

            // Name
            Console.Clear();
            TextFormat.Log("Team: " + newPlayerTeam + "\n");
            newPlayerName = AssignPlayerName();

            // Number
            Console.Clear();
            TextFormat.Log("Team: " + newPlayerTeam +
                           "\nName: " + newPlayerName + "\n");
            newPlayerNumber = (byte)AssignPlayerNumber();

            // Position
            Console.Clear();
            TextFormat.Log("Team: " + newPlayerTeam +
                           "\nName: " + newPlayerName +
                           "\nNumber: " + newPlayerNumber + "\n");
            newPlayerPosition = (Positions)AssignPlayerPosition();
            #endregion

            #region Roster Validations
            Player newPlayer = new Player(newPlayerTeam, newPlayerName, newPlayerPosition, newPlayerNumber);
            Console.Clear();
            Console.Write($"Checking {newPlayerTeam} roster");
            for (int i = 0; i < 3; i++)
            {
                Thread.Sleep(625);
                Console.Write('.');
            }
            Thread.Sleep(625);
            Console.WriteLine();

            PositionValidation(newPlayer);
            NameNumberValidation(newPlayer);
            #endregion

            #region Stat Points Allocation
            Console.Clear();
            TextFormat.Log($"Success! Welcome to the {newPlayerTeam}, {newPlayer.Name}!\n");
            short spBank = (short)SelectDifficulty();
            Console.Clear();
            AllocatePoints(newPlayer, spBank);
            #endregion

            customRoster.Add(newPlayer);
            Console.Clear();
            TextFormat.Green($"{newPlayer.Name} has been successfully added to the {newPlayerTeam.Name} roster!\n");
            Thread.Sleep(1000);
            Console.WriteLine("Press any key to return to the main menu...");
            Console.ReadKey();
            return(customRoster);
        }