Esempio n. 1
0
 private void DisplayBattle(List <string> currentInfo)
 {
     foreach (var happening in currentInfo)
     {
         TextUtils.AnimateText(happening, 10);
     }
 }
Esempio n. 2
0
        private void GameOver()
        {
            Console.Clear();
            Console.SetCursorPosition(30, 15);
            TextUtils.AnimateText("GAME OVER", 100);
            Console.WriteLine();
            Thread.Sleep(1000);
            Console.SetCursorPosition(30, 15);
            Console.WriteLine("Play again? Y/N");



            while (true)
            {
                ConsoleKeyInfo input = Console.ReadKey(true);

                if (input.Key == ConsoleKey.Y)
                {
                    Play();
                }
                else if (input.Key == ConsoleKey.N)
                {
                    Environment.Exit(0);
                }
            }
        }
Esempio n. 3
0
 private void GameOver()
 {
     Console.Clear();
     TextUtils.AnimateText($"Game over {player.Name} !", 70);
     Thread.Sleep(1000);
     Console.ReadKey();
     Play();
 }
Esempio n. 4
0
 private void GameWin()
 {
     Console.Clear();
     Console.ForegroundColor = ConsoleColor.Green;
     TextUtils.AnimateText($"You are the chosen defender of the realm great champion..!\nThe kingdom is finally at peace from the scary monsters. \nLong live {player.Name} the queen!", 100);
     Console.ReadKey(true);
     Console.ResetColor();
 }
Esempio n. 5
0
        private bool ChestEncounter(IAttackable monster)
        {
            var encounterResult = false;

            Console.WriteLine("\n\n\nIt's just a chest . . .");
            TextUtils.AnimateText($". . . . . . . . . .{Environment.NewLine}", 100);
            Console.ForegroundColor = ConsoleColor.Red;
            TextUtils.AnimateText($"or is it a Mimic?!", 500);
            player.Attack(monster);
            monster.Attack(player);
            Console.ResetColor();
            Console.ReadKey(true);

            if (monster.Health <= 0)
            {
                encounterResult = true;
            }

            return(encounterResult);
        }
Esempio n. 6
0
        public void Play()
        {
            CreatePlayer();
            CreateWorld();

            do
            {
                Console.Clear();
                DisplayWorld();
                DisplayStats();
                AskForMovement();
                EncounterRoom();
            } while (player.Health > 0 && Monster.NumberOfMonsters > 0);

            if (Monster.NumberOfMonsters == 0)
            {
                Console.Clear();
                Console.ForegroundColor = ConsoleColor.Green;
                TextUtils.AnimateText($"You are the chosen defender of the realm great champion..!\nThe kingdom is finally at peace from the scary monsters. \nLong live {player.Name} the queen!", 100);
                Console.ReadKey(true);
                Console.ResetColor();
            }
            GameOver();
        }
Esempio n. 7
0
        public void SetUpGame()
        {
            CreatePlayer();
            CreateWorld();
            InitialPrint();

            void InitialPrint()
            {
                Console.WriteLine();
                Console.Write("              ");
                TextUtils.AnimateText("Dungeons of Doom", 200);
                TextUtils.AnimateText("...", 600);
                Console.ReadKey();
            }

            void CreatePlayer()
            {
                player = new Player(50, 0, 0);
            }

            void CreateWorld()
            {
                world = new Room[WorldWidth, WorldHeight];

                for (int y = 0; y < world.GetLength(1); y++)
                {
                    for (int x = 0; x < world.GetLength(0); x++)
                    {
                        world[x, y] = new Room();

                        if (x != 0 && y != 0)
                        {
                            int randResult = RandomUtils.OneToCustomRnd(100);

                            if (randResult < 5)
                            {
                                world[x, y].Monster = new Skeleton(30);
                            }
                            else if (randResult < 10)
                            {
                                world[x, y].Monster = new Orc(50);
                            }
                            else if (randResult < 15)
                            {
                                world[x, y].Item = new Sword();
                            }
                            else if (randResult < 20)
                            {
                                world[x, y].Item = new Axe();
                            }
                            else if (randResult < 25)
                            {
                                world[x, y].Item = new Potion();
                            }
                            else if (randResult < 40)
                            {
                                world[x, y].Obstacle = new Obstacle();
                            }
                        }
                    }
                }
            }
        }