Example #1
0
        //#------------------------------The actual game--------------------------
        static int GameLoop(Player player, Slime slime, Ally ally)
        {
            ScreenWindows.DisplayTextBoxPlayer();
            Random random = new Random();
            int    end    = 2;

            Console.Clear();
            ScreenWindows.DisplayGameScreen();
            ScreenWindows.DisplayTextBoxPlayer();
            int  KingEncounter = 0;
            bool kingKilled    = false;

            int nothing = 0;

            while ((player.Health > 0) && !kingKilled)
            {
                Thread.Sleep(1000);
                Console.SetCursorPosition(27, 32);
                Console.Write("You walk down a cave corridor...");

                int slimechance = random.Next(1, 4);
                Console.SetCursorPosition(27, 33);
                Thread.Sleep(2000);
                if (slimechance == 1)
                {
                    Console.Write("A slime Attacks!");
                    Thread.Sleep(1000);



                    Slime.InitializeNewSlime(slime, ally);
                    ScreenWindows.DisplaySlime(slime);
                    BattleLoop(player, slime, ally);
                    nothing = 0;
                }
                if (slimechance == 2)
                {
                    Thread.Sleep(2000);
                    Slime.InitializeNewSlime(slime, ally);
                    Console.Write($"You have spotted a {slime.Color} slime minding its own buisness");
                    Thread.Sleep(1000);
                    ScreenWindows.DisplaySlime(slime);
                    SlimePassive(player, slime, ally);
                    nothing = 0;
                }

                else if (slimechance == 3)
                {
                    Console.Write("You got lucky and encountered no slimes");
                    Thread.Sleep(1000);
                    nothing++;
                }
                else
                {
                    Console.Write("Nothing happend and you move on");
                    nothing++;
                }

                if (nothing > 5)
                {
                    Console.WriteLine("A slime dropped onto your head and suprized you");
                    BattleLoop(player, slime, ally);
                    nothing = 0;
                }
                if (KingEncounter > 20)
                {
                    ScreenWindows.ClearPlayerTextBox();
                    Console.SetCursorPosition(27, 33);
                    Console.Write("You feel an intense presense up ahead");
                    for (int dot = 0; dot < 4; dot++)
                    {
                        Console.Write(".");
                        Thread.Sleep(1000);
                    }
                    Console.SetCursorPosition(27, 34);
                    Console.Write("You get a glimpse of a regal slime hiding behind");
                    Console.SetCursorPosition(27, 35);
                    Console.Write("a nearby pillar... you enter the room filled with");
                    Console.SetCursorPosition(27, 36);
                    Console.Write("a powerful presence.");

                    ScreenWindows.DisplayContinuePrompt(103, 38);
                    slime.KingSlime = true;
                    Slime.InitializeNewSlime(slime, ally);

                    BattleLoop(player, slime, ally);
                    kingKilled = true;
                    end        = 3;
                }
                KingEncounter++;
                Thread.Sleep(2500);
                ScreenWindows.ClearPlayerTextBox();
                Console.ForegroundColor = ConsoleColor.Gray;
                ScreenWindows.ClearSlime();
            }
            return(end);
        }
Example #2
0
        static void BattleLoop(Player player, Slime slime, Ally ally)
        {
            Random random = new Random();

            do
            {
                ScreenWindows.ClearPlayerTextBox();
                if (slime.KingSlime)
                {
                    ScreenWindows.DisplayKingSlime();
                }
                else
                {
                    ScreenWindows.DisplaySlime(slime);
                }
                ScreenWindows.SlimeAndChatColor(slime);

                Player(player, slime, ally);
                Thread.Sleep(1000);
                ScreenWindows.ClearPlayerTextBox();
                if (slime.Health > 0)
                {
                    SlimeATK(player, slime);
                }
            } while ((player.Health > 0) && (slime.Health > 0));



            ScreenWindows.ClearPlayerTextBox();
            Console.ForegroundColor = ConsoleColor.Yellow;
            #region Gold and Experience
            int goldDrop;
            int exp;
            if (slime.KingSlime)
            {
                goldDrop = random.Next(60, 100);
                exp      = random.Next(200, 500);
            }
            else if (slime.Color == "red")
            {
                goldDrop = random.Next(20, 30);
                exp      = random.Next(100, 150);
            }
            else if (slime.Color == "blue")
            {
                goldDrop = random.Next(10, 15);
                exp      = random.Next(60, 100);
            }
            else if (slime.Color == "green")
            {
                goldDrop = random.Next(4, 7);
                exp      = random.Next(20, 60);
            }
            else
            {
                goldDrop = random.Next(2, 5);
                exp      = random.Next(2, 30);
            }
            Console.SetCursorPosition(27, 33);
            Console.Write($"You have succeeded in battle and have recieved {goldDrop} Gold!");
            Console.SetCursorPosition(27, 34);
            Console.Write($"You gained {exp} Experience Points!");
            #endregion



            if (slime.HasCharm)
            {
                InitializeAlly(ally, slime, player);
                Console.SetCursorPosition(27, 34);
                Console.Write("You picked up a Slime charm... You put it around your neck.");
                Thread.Sleep(1000);
                Console.SetCursorPosition(27, 35);
                Console.Write("A little slime appears next to you and jumps on your head");
                Thread.Sleep(1000);
                switch (ally.Charm)
                {
                case Ally.Charms.REDCHARM:
                    Console.SetCursorPosition(27, 36);
                    Console.Write("It appears the slime is wielding its own sword");
                    Thread.Sleep(2500);
                    Console.SetCursorPosition(27, 37);
                    Console.WriteLine("The slime fights along side you!");
                    Thread.Sleep(1000);
                    break;

                case Ally.Charms.BLUECHARM:
                    Console.SetCursorPosition(27, 36);
                    Console.Write("The slime makes a small shield out of its own goo, ");
                    Thread.Sleep(2500);
                    Console.SetCursorPosition(27, 37);
                    Console.WriteLine("It seems to be trying to protect you...");
                    Thread.Sleep(1000);
                    break;

                case Ally.Charms.PINKCHARM:
                    Console.SetCursorPosition(27, 36);
                    Console.Write("You feel your injuries heal slightly");
                    Thread.Sleep(2500);
                    Console.SetCursorPosition(27, 37);
                    Console.WriteLine("You regained 5 health!");
                    Thread.Sleep(1000);
                    player.Health = player.Health + 5;
                    if (player.Health > player.MaxHealth)
                    {
                        player.Health = player.MaxHealth;
                    }
                    break;

                case Ally.Charms.GREENCHARM:
                    Console.SetCursorPosition(27, 36);
                    Console.Write("You start remembering more about your battle");
                    Thread.Sleep(2500);
                    Console.SetCursorPosition(27, 37);
                    Console.WriteLine("Experience boost!");
                    Thread.Sleep(1000);
                    break;

                default:
                    Console.SetCursorPosition(27, 36);
                    Console.Write("BROKEN ERROR ERROR ERROR ERROR");
                    Thread.Sleep(2500);
                    Console.SetCursorPosition(27, 37);
                    Console.WriteLine("SOME SHIT WENT DOWN NOW FIX OR WAIT A YEAR ");
                    Thread.Sleep(99999999);
                    break;
                }


                ScreenWindows.DisplayContinuePrompt(103, 38);
                ScreenWindows.ClearPlayerTextBox();
            }
            Console.ForegroundColor = ConsoleColor.Gray;
            player.Gold             = player.Gold + goldDrop;
            ScreenWindows.DisplayContinuePrompt(103, 38);
        }
Example #3
0
        /// <summary>
        ///
        /// Created by John Sabins
        /// Application name: Slime fighter
        ///
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            int windowHeight = 55;
            int windowWidth  = 133;

            Console.SetWindowSize(windowWidth, windowHeight);
            int playTheGame = 1;

            playTheGame = MainMenu(playTheGame);
            if (playTheGame == 1)
            {
                Slime  slime  = new Slime();
                Player player = new Player();
                Ally   ally   = new Ally();
                // programmer: John Sabins
                // Program: Slime Fighter
                Console.Clear();

                ScreenWindows.DisplayTextboxMain();
                Console.SetCursorPosition(38, 14);
                Console.CursorVisible = true;
                bool   nameSet    = false;
                string playername = "Bob";
                while (!nameSet)
                {
                    Console.Write("What is your name young slime fighter:");
                    playername = Console.ReadLine();
                    if (playername.Length < 1)
                    {
                        Console.SetCursorPosition(38, 15);
                        Console.Write("Please enter a name... ");
                    }
                    else if (playername.Length >= 2)
                    {
                        nameSet = true;
                    }
                    Console.SetCursorPosition(38, 14);
                }

                Console.CursorVisible = false;

                #region intro
                Thread.Sleep(1000);
                Console.Clear();
                ScreenWindows.DisplayTextboxMain();
                Console.SetCursorPosition(38, 10);
                Console.WriteLine($"Welcome, {playername}");
                Thread.Sleep(1000);
                Console.SetCursorPosition(38, 11);
                Console.WriteLine("to an endless cave that only has slimes.");
                Thread.Sleep(1000);
                Console.SetCursorPosition(38, 12);
                Console.WriteLine("Slimes are said to be one of the easiest enemies. ");
                Thread.Sleep(1000);
                Console.SetCursorPosition(38, 13);
                Console.WriteLine("Lets see if thats true.");
                Thread.Sleep(1000);
                Console.SetCursorPosition(38, 14);
                Console.WriteLine("Fight an onslaught of slimes to claim the Slime Crown.");
                Thread.Sleep(1000);
                Console.SetCursorPosition(38, 15);
                Console.WriteLine("A precious relic with immense healing capabilities.");
                Thread.Sleep(1000);
                #endregion

                ScreenWindows.DisplayContinuePrompt(90, 17);
                //----------------------Define player and attributes-----------


                InitializePlayer(player, playername);


                ScreenWindows.DisplayTextBoxPlayer();
                Console.SetCursorPosition(27, 32);
                Console.Write("You enter the cave and start walking down an endless corridor");
                Console.SetCursorPosition(27, 33);
                Console.Write("that you see no end to...");
                Thread.Sleep(2000);
                playTheGame = GameLoop(player, slime, ally);
            }

            if (playTheGame == 2)
            {
                Console.SetCursorPosition(55, 16); Console.WriteLine("Thanks for playing"); Thread.Sleep(2500);
            }
            else if (playTheGame == 3)
            {
                ScreenWindows.DisplayTextboxMain();
                Console.SetCursorPosition(59, 13);
                Console.Write("\\\\\\YOU WIN///");
                Console.SetCursorPosition(55, 14);
                Console.WriteLine("Thank you for playing");
                Console.ReadKey();
            }
        }