Exemple #1
0
        private void CheckStats()
        {
            _player.DisplayEquipment();

            string[] types = Enum.GetNames(typeof(ItemType));

            ConsoleExtras.ColorLine("Change Equipment:\n\r 1. Back" +
                                    $"\n\r {string.Join("\n\r ", types.Select((type, index) => $"{index+2}. {type}"))}");

            int option = ConsoleExtras.GetIntInput(types.Length + 2);

            if (option == 1)
            {
                return;
            }

            var itemType = (ItemType)(option - 2);

            ConsoleExtras.ColorLine($"\nYour inventory of {itemType}s:\n\r 1. Back" +
                                    $"\n\r {string.Join("\n\r ", _inventory[itemType].Select((item, index) => $"{index + 2}. {item}"))}");

            option = ConsoleExtras.GetIntInput(_inventory[itemType].Count + 2);
            if (option == 1)
            {
                CheckStats();
                return;
            }

            SwapEquipment(itemType, option - 2);
            _player.ApplyItemStats();
        }
        private static void GetStatInfo(IMonster monster, out int health, out int defence, out int power, out int speed)
        {
            ConsoleExtras.ColorLine($"Enter a value between {monster.Min.health} and {monster.Max.health} for health");
            health = ConsoleExtras.GetIntInput();

            ConsoleExtras.ColorLine($"Enter a value between {monster.Min.defence} and {monster.Max.defence} for defence");
            defence = ConsoleExtras.GetIntInput();

            ConsoleExtras.ColorLine($"Enter a value between {monster.Min.power} and {monster.Max.power} for power");
            power = ConsoleExtras.GetIntInput();

            ConsoleExtras.ColorLine($"Enter a value between {monster.Min.speed} and {monster.Max.speed} for speed");
            speed = ConsoleExtras.GetIntInput();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            ConsoleExtras.ColorLine("What would you like to do?\n1. Test Monsters\n2. Start Simulation");
            bool @continue;

            switch (ConsoleExtras.GetIntInput())
            {
            case 1:
            {
                ConsoleExtras.ColorLine("How many tests per monster? (1-100)");
                int amount = Math.Min(Math.Max(1, ConsoleExtras.GetIntInput()), 100);
                Console.Clear();
                new BalanceTester(amount).TestMonsters();
                Console.WriteLine();
                @continue = true;
                break;
            }

            case 2:
            {
                var engine = new Engine();
                engine.Start();

                Console.Clear();

                while (engine.Continue)
                {
                    engine.Update();
                }

                ConsoleExtras.ColorLine("Want to play again?");
                @continue = ConsoleExtras.GetBoolInput();
                Console.Clear();
                break;
            }

            default:
                ConsoleExtras.ColorLine("INVALID OPTION", ConsoleColor.Red);
                @continue = true;
                break;
            }

            if (@continue)
            {
                Main(null);
            }
        }
        static void Main(string[] args)
        {
            IMonster player = InstantiatePlayer();
            IMonster enemy  = InstantiateEnemy(player.Race);

            Console.Clear();

            for (int i = 0; player.IsAlive && enemy.IsAlive; i++)
            {
                ConsoleExtras.ColorLine("Select Option:\n\r1. Fight\n\r2. Check Stats");

                switch (ConsoleExtras.GetIntInput())
                {
                case 1:
                    Attack(i, player, enemy);
                    break;

                case 2:
                    ConsoleExtras.ColorLine($"\nYour monster's stats:\t{player}", ConsoleColor.Cyan);
                    ConsoleExtras.ColorLine($"Enemy's stats:\t{enemy}\n", ConsoleColor.Red);
                    break;

                default:
                    ConsoleExtras.ColorLine("Invalid Selection", ConsoleColor.Red);
                    break;
                }

                Console.WriteLine();
            }

            if (player.IsAlive)
            {
                ConsoleExtras.ColorLine("YOU WIN!", ConsoleColor.Cyan);
            }
            else
            {
                ConsoleExtras.ColorLine("YOU LOSE", ConsoleColor.Red);
            }

            ConsoleExtras.ColorLine("Want to play again?");
            if (ConsoleExtras.GetBoolInput())
            {
                Console.Clear();
                Main(null);
            }
        }
Exemple #5
0
        public void Update()
        {
            _round++;
            ConsoleExtras.ColorLine("Select Option:\n\r1. Fight\n\r2. Check Stats\n\r3. Check Equipment\n\r4. Quit");

            switch (ConsoleExtras.GetIntInput(5))
            {
            case 1:
                ConsoleExtras.ColorLine($"\nRound {_round}, Wave {_wave}:");
                Attack(_player, _enemy);
                break;

            case 2:
                ConsoleExtras.ColorLine($"\nYour stats:\n{_player}", ConsoleColor.Cyan);
                ConsoleExtras.ColorLine($"Enemy's stats:\n{_enemy}\n", ConsoleColor.Red);
                break;

            case 3:
                CheckStats();
                break;

            case 4:
                Continue = false;
                return;
            }

            if (!_enemy.IsAlive)
            {
                ConsoleExtras.ColorLine("New Enemy has appeared!", ConsoleColor.DarkRed);
                _enemy = InstantiateEnemy(_player.Race, _random.Next(_player.Level - 1, _player.Level + 1));
                _round = 0;
                _wave++;
            }

            if (!_player.IsAlive)
            {
                Continue = false;
            }

            Console.WriteLine();
        }