예제 #1
0
        public static void StartGame()
        {
            String title = @"

 _____ _                 _      
/  ___(_)               | |     
\ `--. _ _ __ ___  _ __ | | ___ 
 `--. \ | '_ ` _ \| '_ \| |/ _ \
/\__/ / | | | | | | |_) | |  __/
\____/|_|_| |_| |_| .__/|_|\___|
                  | |           
                  |_|           
  ___      _                 _                  
 / _ \    | |               | |                 
/ /_\ \ __| |_   _____ _ __ | |_ _   _ _ __ ___ 
|  _  |/ _` \ \ / / _ \ '_ \| __| | | | '__/ _ \
| | | | (_| |\ V /  __/ | | | |_| |_| | | |  __/
\_| |_/\__,_| \_/ \___|_| |_|\__|\__,_|_|  \___|";

            //Inventory stuff
            const int inventorySlots = 8;

            string[,] inventory = new string[inventorySlots, inventorySlots];
            SentryRPGTools.InventoryInit(inventorySlots, inventory);

            Console.ForegroundColor = ConsoleColor.Red;
            //this is the code for the title big man
            Console.WriteLine(title);
            Console.ResetColor();
            Console.WriteLine("By SamuraiWeebR");
            Console.WriteLine("This is A Very Basic Game.");
            Console.WriteLine("DISCLAIMER: This is game is really simple. i doubt you will enjoy it. \n do you accept the fact that this game could be quick or crap?");
            string userResponse = Console.ReadLine();

            //eula to tell someone to f**k off if they gonna judge
            if (userResponse.ToLower() == "yes")
            {
                Console.WriteLine("Then enjoy the experience.");
            }
            else if (userResponse.ToLower() == "no")
            {
                Console.WriteLine("Then Go Away.");
                Environment.Exit(5);
            }
            else if (userResponse.ToLower() == "maybe")
            {
                Console.WriteLine("Make your mind up you f*****g wanker");
            }
            else
            {
                Console.WriteLine("That doesn't look right. Answer must be yes/no");
                if (userResponse.ToLower() == "yes")
                {
                    Console.WriteLine("Then enjoy the experience.");
                }
                else if (userResponse.ToLower() == "no")
                {
                    Console.WriteLine("Then Go Away.");
                    SentryRPGTools.Quit();
                }
            }
            //here comes the fun part
            Console.WriteLine("What is your name?");
            string characterName = Console.ReadLine();

            Console.WriteLine("Your Name is " + characterName + "!");
            Console.WriteLine("What is your age?");
            int characterAge = Convert.ToInt32(Console.ReadLine());

            if (characterAge < 18)
            {
                Console.WriteLine("You can't be UnderAge!");
                return;
            }
            else if (characterAge > 18)
            {
                Console.WriteLine("Your Age is " + characterAge + "!");
            }
            //game starts now.
            Console.BackgroundColor = ConsoleColor.DarkBlue;
            Console.ForegroundColor = ConsoleColor.Cyan;
            double eArmorToughness = 0.1;
            double cAttackDamage   = 10.50 - eArmorToughness;
            double playerHP        = 20.00;

            Console.WriteLine("You Enter the Temple, It's Walls shining a blue hue. 'my first quest' you thought, as you entered. what do you do?");
            string userAction = Console.ReadLine();

            if (userAction == "walk" || userAction == "run")
            {
                Console.WriteLine("you move deeper into the temple, when suddenly, a goblin appears! what will you do?");
            }
            userAction      = Console.ReadLine();
            eArmorToughness = 2.5;

            SentryRPGTools.Combat("Goblin", 20, 5, playerHP, cAttackDamage);
        }
        //Combat

        //Just supply an enemy name, enemy health, enemy attack, character health and character attack
        public static void Combat(string eName, double eHealth, double eBaseAttack, double cHealth, double cBaseAttack)
        {
            if (firstPhase)
            {
                cAttackRatio = cHealth / eHealth;
                eAttackRatio = eHealth / cHealth;

                Console.Clear();
                Console.WriteLine("You've entered combat");
                Console.WriteLine("You're fighting a " + eName + " with " + eHealth + " HP");
                Thread.Sleep(1000);

                Console.Clear();
                Console.WriteLine("Your enemy has " + eHealth + " HP whileist you have " + cHealth + " HP");
                Console.WriteLine("What do you wish to do?");

                userResponse = Console.ReadLine();
                if (userResponse == "Attack" || userResponse == "attack")
                {
                    eHealth = eHealth - cBaseAttack;
                    Console.WriteLine("You attack " + eName + " for " + cBaseAttack + " damage to the " + eName + " now has " + eHealth + "HP left");
                    if (eHealth > 0)
                    {
                        cHealth = cHealth - eBaseAttack;
                        Console.WriteLine(eName + " attacks you for " + eBaseAttack + " damage. You have " + cHealth + " HP left");
                    }
                    if (cHealth > 0 || eHealth > 0)
                    {
                        if (eHealth < 0)
                        {
                            Console.WriteLine("You stand victorious");
                        }
                        else if (cHealth > 0)
                        {
                            firstPhase = false;
                            SentryRPGTools.Combat(eName, eHealth, eBaseAttack, cHealth, cBaseAttack);
                        }
                    }
                    else
                    {
                        Thread.Sleep(1000);
                        Console.WriteLine("You are a f*****g looser, you died to " + eName);
                        Console.WriteLine("If you want to retry you'll have to restart the game manually cuz we're too stupid to program that");
                    }
                }
            }
            else if (!firstPhase)
            {
                Console.Clear();
                Console.WriteLine("Your enemy has " + eHealth + " HP whileist you have " + cHealth + " HP");
                Console.WriteLine("What do you wish to do?");

                userResponse = Console.ReadLine();
                if (userResponse == "Attack" || userResponse == "attack")
                {
                    //Character attack calculation
                    double cAttack = cBaseAttack * ((cHealth / eHealth) / cAttackRatio);
                    eHealth = eHealth - cAttack;
                    Console.WriteLine("You attack " + eName + " for " + cAttack + " damage to the " + eName + " now has " + eHealth + "HP left");
                    if (eHealth > 0)
                    {
                        //Enemy attack calculation
                        double eAttack = eBaseAttack * ((eHealth / cHealth) / eAttackRatio);
                        cHealth = cHealth - eAttack;
                        Console.WriteLine(eName + " attacks you for " + eAttack + " damage. You have " + cHealth + " HP left");
                    }
                    if (cHealth > 0 || eHealth > 0)
                    {
                        if (eHealth < 0)
                        {
                            Console.WriteLine("You stand victorious");
                        }
                        else if (cHealth > 0)
                        {
                            firstPhase = false;
                            SentryRPGTools.Combat(eName, eHealth, eBaseAttack, cHealth, cBaseAttack);
                        }
                    }
                    else
                    {
                        Thread.Sleep(1000);
                        Console.WriteLine("You are a f*****g looser, you died to " + eName);
                        Console.WriteLine("If you want to retry you'll have to restart the game manually cuz we're too stupid to program that");
                    }
                }
            }
        }