Esempio n. 1
0
        public Area(int id, int type)
        {
            Objects  = new List <Object>();
            SubAreas = new List <SubArea>();

            ID   = id;
            Type = type;

            switch (Type)
            {
            case (int)AreaTypes.Field:
            {
                Name = "Field";
                break;
            }

            case (int)AreaTypes.Forest:
            {
                Name = "Forest of " + NameGenerator.TownNameGenerator();
                int _rng = RandomNumberGenerator.RandomInt(0, 100);
                if (_rng < 15)
                {
                    SubAreas.Add(new SubArea(0, (int)SubAreaTypes.Cave, this));
                }
                else if (_rng < 30)
                {
                    SubAreas.Add(new SubArea(1, (int)SubAreaTypes.Cabin, this));
                }
                break;
            }

            case (int)AreaTypes.Town:
            {
                Name = NameGenerator.TownNameGenerator();
                SubAreas.Add(new SubArea(0, (int)SubAreaTypes.PlayerHome, this));
                SubAreas.Add(new SubArea(1, (int)SubAreaTypes.GeneralStore, this));
                SubAreas.Add(new SubArea(2, (int)SubAreaTypes.PublicBuilding, this));
                SubAreas.Add(new SubArea(3, (int)SubAreaTypes.Church, this));

                for (int i = 4; i < 7; i++)
                {
                    int _rng = RandomNumberGenerator.RandomInt(0, 100);

                    if (_rng < 20)
                    {
                        SubAreas.Add(new SubArea(i, (int)SubAreaTypes.RundownHouse, this));
                    }
                    else if (_rng < 80)
                    {
                        SubAreas.Add(new SubArea(i, (int)SubAreaTypes.DecentHouse, this));
                    }
                    else
                    {
                        SubAreas.Add(new SubArea(i, (int)SubAreaTypes.FamilyHouse, this));
                    }
                }
                break;
            }

            case (int)AreaTypes.Highway:
            {
                Name = "Highway";
                if (RandomNumberGenerator.RandomInt(0, 100) > 74)
                {
                    SubAreas.Add(new SubArea(0, (int)SubAreaTypes.RestStop, this));
                }
                break;
            }

            case (int)AreaTypes.Road:
            {
                Name = "Road";
                if (RandomNumberGenerator.RandomInt(0, 100) > 84)
                {
                    SubAreas.Add(new SubArea(0, (int)SubAreaTypes.GasStation, this));
                }
                break;
            }

            case (int)AreaTypes.SpecialBuilding:
            {
                Name = NameGenerator.TownNameGenerator() + " Plains";
                int _rng = RandomNumberGenerator.RandomInt(0, 100);
                if (_rng < 33)
                {
                    SubAreas.Add(new SubArea(0, (int)SubAreaTypes.Mall, this));
                }
                else if (_rng < 66)
                {
                    SubAreas.Add(new SubArea(1, (int)SubAreaTypes.Mansion, this));
                }
                else
                {
                    SubAreas.Add(new SubArea(2, (int)SubAreaTypes.MilitaryBase, this));
                }
                break;
            }
            }
        }
Esempio n. 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("");
            }
        }