Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Grad
- {
- class MainClass
- {
- //Int
- public static int hpp = 100;
- public static int gold = 50;
- public static int goldground = 0;
- public static int ggamountv = 0;
- public static int sword = 0;
- public static int swordground = 0;
- public static int potions = 3;
- public static int potionground = 0;
- public static int inbattle = 0;
- public static int monstercheck;
- //Strings
- public static String name = "N/A";
- public static String command = "N/A";
- public static String monster = "N/A";
- //Objects
- public static Random ggamount = new Random();
- public static Random inbattleq = new Random();
- public static Random goldgroundq = new Random();
- public static void Main(string[] args)
- {
- Console.Write("Pardon me, what’s your name? ");
- name = Console.ReadLine();
- Console.WriteLine("\n Ahh, welcome " + name + ".");
- Console.WriteLine("Welcome to the world of Grad. In this game you loot, and fight your way out.");
- Console.WriteLine("Good luck.");
- System.Threading.Thread.Sleep(6000);
- Console.Clear();
- while (true)
- {
- Console.Title = "Grad! Player:[" + name + "] HP:[" + hpp + "] Gold:[" + gold + "] Sword:[" + sword + "] Potions:[" + potions + "]";
- inbattle = inbattleq.Next(0, 2);
- Console.Write("Command: ");
- command = Console.ReadLine();
- if (command == "attack")
- {
- if (sword == 1 && inbattle == 0)
- {
- Console.WriteLine("You swing your sword in the air like an idiot.");
- }
- if (inbattle == 1 && sword == 1)
- {
- ReturnMonster();
- Console.WriteLine("A " + monster + " attacked!");
- }
- if (sword == 0)
- {
- Console.WriteLine("You do not have a sword.");
- }
- }
- if (command == "exit")
- {
- Console.WriteLine("May your journey bring good fortune...");
- System.Threading.Thread.Sleep(1500);
- Environment.Exit(1);
- }
- if (command == "help")
- {
- Console.WriteLine("Your commands are:");
- Console.WriteLine("attack, exit, potion, shop, pickup");
- if (sword == 0)
- {
- Console.WriteLine("You do not have a sword. You should buy one or you will die painfully.");
- }
- }
- if (command == "drop")
- {
- if (sword == 0)
- {
- Console.WriteLine("You do not have a sword.");
- }
- else
- {
- Console.WriteLine("You are stupid to drop your sword. But, whatever you wish.");
- sword = 0;
- swordground = 1;
- }
- }
- if (command == "pickup")
- {
- goldground = goldgroundq.Next(0, 2);
- if (swordground == 1)
- {
- sword = 1;
- swordground = 0;
- }
- else if (goldground == 1)
- {
- Console.WriteLine("You picked up some gold!");
- gold = gold + ggamount.Next(1, 21);
- goldground = 0;
- }
- else if (potionground == 1)
- {
- potions = potions + 1;
- potionground = 0;
- }
- else
- {
- Console.WriteLine("There is nothing to pickup.");
- }
- }
- if (command == "potion")
- {
- hpp += 10;
- potions--;
- }
- if (command == "shop")
- {
- //This is temporary and will be edited.
- Console.WriteLine("A sword is 20 gold. A potion is 10 gold.");
- command = Console.ReadLine();
- if (command == "sword")
- {
- if (gold > 19)
- {
- Console.WriteLine("You purchased a sword.");
- sword = 1;
- gold -= 20;
- }
- }
- if (command == "potion")
- {
- if (gold > 9)
- {
- Console.WriteLine("You purchased a potion.");
- potions += 1;
- gold -= 10;
- }
- else
- {
- Console.WriteLine("You do not have enough Gold for that.");
- }
- }
- }
- }
- }
- // Function to get a random monster to encounter.
- public static void ReturnMonster()
- {
- Random r = new Random();
- monstercheck = r.Next(0, 4);
- if (monstercheck == 1)
- {
- monster = "Pikachu";
- }
- if (monstercheck == 2)
- {
- monster = "Derp";
- }
- if (monstercheck == 3)
- {
- monster = "Dick";
- }
- if (monstercheck == 0)
- {
- monster = "Pikatit";
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment