public static string[,] InventoryAdd(int amount, string item, string[,] inventory)
 {
     //Linear search for space
     for (int i = 0; i < inventory.Length + 1; i++)
     {
         //If space, add specified item
         if (inventory[i, 1] == "[EMPTY SLOT]")
         {
             inventory[i, 0] = Convert.ToString(amount);
             inventory[i, 1] = item;
             break;
         }
         //Else allow player to drop an item
         else if (i > inventory.Length)
         {
             Console.WriteLine("There's no place in your inventory");
             Console.WriteLine("Do you want to drop an item? (yes/no)");
             userResponse = Console.ReadLine();
             if (userResponse.ToLower() == "yes")
             {
                 SentryRPGTools.InventoryPrint(inventory);
                 Console.WriteLine("Choose an item to drop");
                 userResponse = Console.ReadLine();
                 for (int x = 0; x < inventory.Length + 1; x++)
                 {
                     if (Convert.ToInt32(userResponse) == x || userResponse.ToLower() == inventory[i, 1].ToLower())
                     {
                         Console.WriteLine("Are you sure you want to drop " + inventory[x, 0] + " " + inventory[x, 1] + "? (yes/no)");
                         userResponse = Console.ReadLine();
                         if (userResponse.ToLower() == "yes")
                         {
                             inventory[x, 0] = Convert.ToString(amount);
                             inventory[x, 1] = item;
                             Console.WriteLine("You picked up the " + item + ". It's now in inventory slot " + x);
                             break;
                         }
                         else if (userResponse.ToLower() == "no")
                         {
                             Console.WriteLine("You chose not pick up the " + item);
                             break;
                         }
                     }
                 }
             }
             else if (userResponse.ToLower() == "no")
             {
                 Console.WriteLine("You chose not pick up the " + item);
             }
         }
         break;
     }
     return(inventory);
 }
Example #2
0
        //Combat
        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");
                    }
                }
            }
        }
Example #3
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);
        }
Example #4
0
 public static void Main(string[] args)
 {
     Game.StartGame();
     Console.WriteLine("The Game has Shut Down. If your seeing this, it probably crashed.");
     SentryRPGTools.Quit();
 }