コード例 #1
0
        public Stat(int id, int category)
        {
            ID       = id;
            Category = category;
            //Category = (int)values.GetValue(RandomNumberGenerator.RandomInt(0, values.Length - 1));

            int index = RandomNumberGenerator.RandomInt(0, StatTemplates.GetStatTemplateByID(Category).StatNames.Count - 1);

            Name = StatTemplates.GetStatTemplateByID(Category).StatNames[index];
            StatTemplates.GetStatTemplateByID(Category).StatNames.RemoveAt(index);


            Value = RandomNumberGenerator.RandomInt(1, 15);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            StatTemplates.InitializeStatTemplates();
            var player = new Player();

            foreach (var s in player.PlayerStats)
            {
                Console.ForegroundColor = StatTemplates.GetStatTemplateByID(s.Category).StatDisplayColor;
                Console.WriteLine(s.Name + ": " + s.Value);
            }
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("");
            for (int i = 1; i < 11; i++)
            {
                if (player.CheckForStatAmount(i) == 0)
                {
                    Console.WriteLine(StatTemplates.GetStatTemplateByID(i).ZeroMessage);
                    Console.WriteLine("");
                    Console.WriteLine("However...");
                    Console.WriteLine("");
                }
            }
            for (int i = 1; i < 11; i++)
            {
                if (player.CheckForStatAmount(i) == 2)
                {
                    Console.WriteLine(StatTemplates.GetStatTemplateByID(i).TwoMessage);
                }
            }
            player.DisplayMoney();
            player.PickupMoney(100);

            if (Console.ReadKey().Key.ToString().ToUpper() == "L")
            {
                player.LevelUp();

                Console.ReadKey();
            }
            else if (Console.ReadKey().Key.ToString().ToUpper() == "S")
            {
                if (player.CheckForStatAmount(StatTemplates.Intelligence.ID) != 0)
                {
                    player.ReadBook(9, 1);
                }
                else
                {
                    PrintSlow("You cannot read books.");
                }

                Console.ReadKey();
            }
            else if (Console.ReadKey().Key.ToString().ToUpper() == "G")
            {
                if (player.CheckForStatAmount(StatTemplates.Intelligence.ID) != 0)
                {
                    player.ReadBook(5, 0);
                }
                else
                {
                    PrintSlow("You cannot read books.");
                }

                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("");
                PrintSlow("You are standing in front of §Your Homeß in the town of §" + NameGenerator.TownNameGenerator().ToUpper() + "ß.");
                Console.WriteLine("");
                PrintSlow("The town has a §General Storeß, a §Church of the Lordß, a §Public Buildingß and two §Residential Homesß.");
                Console.ReadLine();
                Console.WriteLine("");
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: TheSwiftTiger/weirdo
        static void Main(string[] args)
        {
            StatTemplates.InitializeStatTemplates();
            var player = new Player();
            var map    = new Map();

            player.CreateIn(map.Areas[3, 3].SubAreas[0]);

            foreach (var s in player.PlayerStats)
            {
                Console.ForegroundColor = StatTemplates.GetStatTemplateByID(s.Category).StatDisplayColor;
                Console.WriteLine(s.Name + ": " + s.Value);
            }
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("");
            for (int i = 1; i < 11; i++)
            {
                if (player.CheckForStatAmount(i) == 0)
                {
                    Console.WriteLine(StatTemplates.GetStatTemplateByID(i).ZeroMessage);
                    Console.WriteLine("");
                    Console.WriteLine("However...");
                    Console.WriteLine("");
                }
            }
            for (int i = 1; i < 11; i++)
            {
                if (player.CheckForStatAmount(i) == 2)
                {
                    Console.WriteLine(StatTemplates.GetStatTemplateByID(i).TwoMessage);
                }
            }
            // player.DisplayMoney();
            // player.PickupMoney(100);

            ConsoleKeyInfo _input;

            _input = Console.ReadKey(false);
            Debug.WriteLine(_input.KeyChar.ToString().ToUpper());
            if (_input.KeyChar.ToString().ToUpper() == "L")
            {
                player.LevelUp();
            }
            else if (_input.KeyChar.ToString().ToUpper() == "S")
            {
                if (player.CheckForStatAmount(StatTemplates.Intelligence.ID) != 0)
                {
                    player.ReadBook(9, 1);
                }
                else
                {
                    PrintSlow("You cannot read books.");
                }
            }
            else if (_input.KeyChar.ToString().ToUpper() == "G")
            {
                if (player.CheckForStatAmount(StatTemplates.Intelligence.ID) != 0)
                {
                    player.ReadBook(5, 0);
                }
                else
                {
                    PrintSlow("You cannot read books.");
                }
            }

            else if (_input.KeyChar.ToString().ToUpper() == "B")
            {
                Stat strength = null;
                foreach (Stat s in player.PlayerStats)
                {
                    if (s.Category == StatTemplates.Strength.ID)
                    {
                        strength = s;
                    }
                }
                if (player.CheckForStatAmount(StatTemplates.Strength.ID) == 0)
                {
                    PrintSlow("You cannot use Steroids.");
                }
                else
                {
                    PrintSlow("You used §Steroidsß!\n");
                    player.Buff(strength, 5, 10, "Steroids");
                }
                Console.ReadKey();
            }
            else if (_input.KeyChar.ToString().ToUpper() == "A")
            {
                Console.WriteLine("");
                PrintSlow("You are standing in §" + player.Location.Name + "ß.");
                Console.WriteLine("");
                PrintSlow("Nearby are:");
                Console.ForegroundColor = ConsoleColor.Yellow;
                foreach (var s in player.Location.SubAreas)
                {
                    Console.WriteLine("a " + s.Name);
                }
                Console.ForegroundColor = ConsoleColor.White;
                Console.ReadLine();
                Console.WriteLine("");
            }
        }