public static void Stats() { int len = 71; ConsoleColor color = ConsoleColor.Cyan; PrintUtils.GetHash(len, color); PrintUtils.CenterPadHash("STATS", len, color); PrintUtils.LeftPadHash($"You are {MainGame.player.name} the {MainGame.player.job.name}. ", len, color); PrintUtils.LeftPadHash($"You have {MainGame.player.hp} hp.", len, color); PrintUtils.LeftPadHash($"You have {MainGame.player.xp} xp and you are at level {Convert.ToInt32(MainGame.player.xp / 1000)}.", len, color); PrintUtils.LeftPadHash($"You have {MainGame.player.ap} strength.", len, color); PrintUtils.LeftPadHash($"You have ₴ {MainGame.player.money}", len, color); PrintUtils.LeftPadHash($"Your current weapon, the {MainGame.player.weapon.name} does {MainGame.player.weapon.ap} of damage.", len, color); String inventory = "Your Inventory contains: "; if (MainGame.player.inventory != null) { foreach (var item in MainGame.player.inventory) { inventory += item.name; } } PrintUtils.LeftPadHash(inventory, len, color); String armour = "You are wearing these pieces of armour: "; if (MainGame.player.armour != null) { foreach (var item in MainGame.player.armour) { armour += item.name; } } PrintUtils.LeftPadHash(armour, len, color); PrintUtils.GetHash(len, color); }
/// <summary> /// Returns a combination of GetHash and LeftPadHash /// </summary> /// <param name="text">String to left-align</param> /// <param name="length">Final width of box</param> /// <returns></returns> public static string LeftBoxHashReturn(string text, int length) { var finalString = PrintUtils.GetHashReturn(length); finalString += PrintUtils.LeftPadHashReturn(text, length); finalString += PrintUtils.GetHashReturn(length); return(finalString); }
public static void EndGame() { PrintUtils.GetHash(15); PrintUtils.CenterPadHash("GOODBYE!!", 15); PrintUtils.GetHash(15); Thread.Sleep(500); Environment.Exit(0); }
public static void TitleScreen() { int width = 28; PrintUtils.GetHash(width); PrintUtils.CenterPadHash("Welcome to Bordertale!", width); PrintUtils.CenterPadHash("- Play -", width); PrintUtils.CenterPadHash("- Resume -", width); PrintUtils.CenterPadHash("- Help -", width); PrintUtils.CenterPadHash("- Acknoledgements -", width); PrintUtils.CenterPadHash("- Quit -", width); PrintUtils.CenterPadHash("Copyright 2021 tejmen09", width); PrintUtils.GetHash(width); bool inLoop = true; while (inLoop) { string option = PrintUtils.Input().ToLower(); switch (option) { case "play": inLoop = false; MainGame.StartGame(); break; case "help": inLoop = false; HelpScreen(false); break; case "quit": inLoop = false; PrintUtils.GetHash(15); PrintUtils.CenterPadHash("GOODBYE!!", 15); PrintUtils.GetHash(15); Thread.Sleep(500); Environment.Exit(0); break; case "acknowledgements": inLoop = false; AcknowledgementsScreen(); break; case "resume": inLoop = false; MainGame.MainGameLoop(); break; default: Console.WriteLine("Please enter a valid command."); break; } } }
/// <summary> /// Combination of GetHash and LeftPadHash to create a box /// </summary> /// <param name="text">String to left-align</param> /// <param name="length">Final width of box</param> /// <param name="color">Foreground color to print</param> public static void LeftBoxHash(string text, int length, ConsoleColor color = ConsoleColor.Gray) { if (color != ConsoleColor.Gray && Console.ForegroundColor == ConsoleColor.Gray) { Console.ForegroundColor = color; } PrintUtils.GetHash(length, color); PrintUtils.LeftPadHash(text, length, color); PrintUtils.GetHash(length, color); Console.ResetColor(); }
public static void StartGame() { PrintUtils.SlowPrint("What is your name young traveller?"); player.name = PrintUtils.Input(); if (player.name == "dev") { player.name = "Developer"; player.job = new Job("Fighter", 120, 40); player.SetJob(); Map.PopulateLocation(); MainGameLoop(); } PrintUtils.SlowPrint($"What is will your role be {player.name}?"); Console.WriteLine("(You can be a Fighter, Wizard or healer)"); bool inLoop = true; while (inLoop) { string playerJob = PrintUtils.Input().ToLower(); switch (playerJob) { case "fighter": inLoop = false; player.job = new Job("Fighter", 120, 40); break; case "wizard": inLoop = false; player.job = new Job("Healer", 200, 20, 40); break; case "healer": inLoop = false; player.job = new Job("Wizard", 300, 20, 20); break; default: Console.WriteLine("Please enter a valid role."); break; } } player.SetJob(); Map.PopulateLocation(); PrintUtils.SlowPrint($"Welcome {player.name} the {player.job.name}."); PrintUtils.SlowPrint("Welcome to this fanatasy world!", 30); PrintUtils.SlowPrint("Just dont get lost...", 100); PrintUtils.SlowPrint("(Cough, Cough)", 20); PrintUtils.GetHash(28); PrintUtils.CenterPadHash("Let's Jump In!", 28); PrintUtils.GetHash(28); MainGameLoop(); }
private static void AcknowledgementsScreen() { PrintUtils.GetHash(31); PrintUtils.CenterPadHash("Acknowledgements", 31); PrintUtils.CenterPadHash("Beta Tested by:", 31); PrintUtils.LeftPadHash("• appcreatorguy ", 31); PrintUtils.LeftPadHash("• tejmen09 ", 31); PrintUtils.LeftPadHash("Helped By:", 31); PrintUtils.LeftPadHash("• appcreatorguy", 31); PrintUtils.LeftPadHash("• tejmen09", 31); PrintUtils.CenterPadHash(" Copyright 2019 Tejas Mengle ", 31); PrintUtils.GetHash(31); TitleScreen(); }
public static void Stats() { int len = 66; PrintUtils.GetHash(len); PrintUtils.CenterPadHash("STATS", len); PrintUtils.LeftPadHash($"You are {MainGame.player.name} the {MainGame.player.job.name}. ", len); PrintUtils.LeftPadHash($"You have {MainGame.player.hp} hp.", len); PrintUtils.LeftPadHash($"You have {MainGame.player.xp} xp and you are at level {Convert.ToInt32(MainGame.player.xp/1000)}.", len); PrintUtils.LeftPadHash($"You have {MainGame.player.ap} strength.", len); PrintUtils.LeftPadHash($"You have ₴ {MainGame.player.money}", len); // @todo add rest of stats screen // PrintUtils.LeftPadHash($"Your current weapon, the {} does {} of damage.", len); // PrintUtils.LeftPadHash($"Your Inventory contains: , end=", len); // PrintUtils.LeftPadHash($"You are wearing these pieces of armour: ', end=''", len); PrintUtils.GetHash(len); }
public static void HelpScreen(string command) { switch (command) { case "move": int len = 52; PrintUtils.GetHash(len, ConsoleColor.Magenta); PrintUtils.CenterPadHash("Movement Help", len, ConsoleColor.Magenta); PrintUtils.LeftPadHash("• Type 'move' and what direction you want to go", len, ConsoleColor.Magenta); PrintUtils.GetHash(len, ConsoleColor.Magenta); break; case "": default: Console.WriteLine($"'{command}' is not a valid command."); break; } }
public static void HelpScreen(bool inGame) { if (!inGame) { Console.Clear(); } int width = 31; PrintUtils.GetHash(width, ConsoleColor.DarkBlue); PrintUtils.CenterPadHash("Help", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash("• Type 'move' command to", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash(" move", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash("• Type your commands to do", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash(" them", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash("• Type 'look' to inspect", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash(" something", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash("• Type 'act' to do what you", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash(" can on your place", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash("• If you find a Dungeon,", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash(" please help to excavate it", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash("• Find more weapons hidden", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash(" in chests to kill monsters", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash("• Go to the store to buy", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash(" armour", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash("• Equip your armour for", width, ConsoleColor.DarkBlue); PrintUtils.LeftPadHash(" extra protection.", width, ConsoleColor.DarkBlue); PrintUtils.CenterPadHash("Copyright 2019 tejmen09", width, ConsoleColor.DarkBlue); PrintUtils.GetHash(width, ConsoleColor.DarkBlue); switch (inGame) { case true: MainGame.MainGameLoop(); break; default: TitleScreen(); break; } }
// Population of Locations public static void PopulateLocation() { a1.Populate( "Town Market", "This is your Local Marketplace", "There is a vague smell of meat, herbs and fresh produce.", null, b1, null, a2, "A Seller in the Market says: \"I used to go fishing at the beach, but now theres monsters nearby!\"", () => { if (MainGame.player.money == 0) { PrintUtils.SlowPrint("\"Go get money so you can buy stuff!\" shouts one of the merchants."); } else { Screens.ShopScreen(); } }); a2.Populate( "Town Entrance", "This is an entrance to your Town.", "The angel on the top symbolizes that your village is peaceful.", null, b2, a1, a3, "A old villager by the entrance says: \"Hello my dear child, where have you come from ?\"", () => { Console.WriteLine("The mayoral election are going on. Everyone is talking about it."); }); a3.Populate( "Town Square", "This is your Town Square.", "There is a wishing well in the middle.", null, b3, a2, a4, "A villager by the Well in the middle says: \"You should throw a gold coin in the well for good luck\"", () => { Console.WriteLine("I wish I could get good luck, but I don't have any money."); }); a4.Populate( "Town Hall", "This is where the mayor lives", "Mum said \"This Building has a prison for baddies!\"", null, b4, a3, null, "The Mayor comes out of the town hall. He says: \"Beware all, for there are monsters south of here!\"", () => { Console.WriteLine("There is a weird smell of rotten eggs inside. I'm not going inside!"); }); b1.Populate( "Chest", "This is an unlocked chest!", "The key is already in the Chest lock.", a1, c1, null, b2, action: () => { Console.WriteLine("You pick up the knife."); MainGame.player.Acquire(Helpers.ItemFactory.CreateItem("knife")); }); b2.Populate( "Home", "This is your home!", "Your home is the same - nothing has changed", a2, c2, b1, b3, "\"Good luck on your journey.\", said your Mom.", () => { PrintUtils.SlowPrint("You take a nap.", 100); MainGame.player.HpReset(); }); b3.Populate( "Forest", "This is an oak forest.", "This forest has a crossway so you can go any way you want", a3, c3, b2, b4, "\"I will give you a reward if you save the town from the monsters\", said an old man", () => { if (MainGame.player.xp == 0) { PrintUtils.SlowPrint("\"I will give you some money if you defeat the monsters south of here\" said an old man.", 100); // @todo add 'Defeat Monsters' Mission } else { PrintUtils.SlowPrint("I have given you some money.", 100); PrintUtils.SlowPrint("Now go away!", 75); // @todo Move Mission Completed Actions when Missions are created MainGame.player.Pay(40); MainGame.player.location.solved = true; } }); b4.Populate( "???", "This is an old Building.", "There is a button and a glowing circle on the floor.", a4, c4, b3, null, action: () => { MainGame.player.location.zoneName = "Teleporter"; MainGame.player.SetLocation(c1); MainGame.player.location.zoneName = "Teleporter"; }); c1.Populate( "???", "This is an old Building.", "There is a button and a glowing circle on the floor.", b1, d1, null, c2, action: () => { //Might make random? MainGame.player.location.zoneName = "Teleporter"; MainGame.player.SetLocation(b4); MainGame.player.location.zoneName = "Teleporter"; }); c2.Populate( "Forest", "This is an ash forest.", "This forest has a crossway so you can go any way you want.", b2, d2, c1, c3, action: () => { if (Map.c1.zoneName == "Teleporter") { // Move this too Console.WriteLine("\"Thank you for finding out what that place was! I'll give you a reward for doing that\", said a mysterious man, giving you some money."); MainGame.player.Pay(30); MainGame.player.location.solved = true; } else { Console.WriteLine("\"Can you please find out what is in the place to the left of us. I really want to go there, but I'm too scared!\", said a mysterious man."); // Add mission here } }); c3.Populate( "Forest", "This is an birch forest.", "This forest has a crossway so you can go any way you want.", b3, d3, c2, c4, action: () => { PrintUtils.SlowPrint("You take a nap", 100); MainGame.player.HpReset(); Thread.Sleep(1000); }); c4.Populate( "Dungeon", "This is a dangerous Dungeon.", "This Dungeon has dangers. Mum said to stay away from dangerous places.", b4, d4, c3, null, action: () => { CombatHandler.Combat(MobFactory.CreateMob("random"), MainGame.player); }); d1.Populate( "Beach", "This is a rocky beach", "This beach has lots of seaweed.", c1, null, null, d2, action: () => { Console.WriteLine("The beach is too rocky to do anything."); }); d2.Populate( "Beach", "This is a white, sandy Beach, with lots of children playing in the sand.", "This beach has lots of children playing on it.", c2, null, d1, d3, "\"my moomy sed dat da plase right of us is wery danegrus\" said one of the children", () => { PrintUtils.SlowPrint("This beach is so sandy that...", 100); PrintUtils.SlowPrint("you take a nap. ", 100); MainGame.player.HpReset(); }); d3.Populate( "Dungeon", "This is a dangerous Dungeon.", "This Dungeon has dangers. Mum said to stay away from dangerous places.", c3, null, d2, d4, action: () => { CombatHandler.Combat(MobFactory.CreateMob("random"), MainGame.player); }); d4.Populate( "End Portal", "This is where you go if you want to leave this world.", "This is a way to go to a whole new world.", c4, null, d3, null, action: () => { // @todo Add Second Map PrintUtils.SlowPrint("Thanks for Playing!"); MainGame.EndGame(); }); }
public static void Prompt() { Console.WriteLine(); PrintUtils.GetHash(31); Console.WriteLine("What would you like to do?"); Console.WriteLine("(You can 'move', 'quit', 'look', 'talk', 'equip', 'help', 'stats' or 'act' or 'mission')"); bool inLoop = true; while (inLoop) { string action = PrintUtils.Input().ToLower(); string[] words = action.Split(' '); switch (words[0]) { case "quit": inLoop = false; EndGame(); break; case "look": inLoop = false; player.Examine(); break; case "act": inLoop = false; player.Act(); break; case "talk": inLoop = false; player.Talk(); break; case "equip": inLoop = false; // @todo add Player.Equip() break; case "stats": inLoop = false; Screens.Stats(); break; case "help": inLoop = false; Screens.HelpScreen(true); break; case "mission": inLoop = false; // @todo add Player.Missions() break; case "money": inLoop = false; player.money = Convert.ToInt32(PrintUtils.Input("Money = ?")); Console.WriteLine(player.money); break; case "move": inLoop = false; if (words.Length <= 1) { string direction = words[1]; player.Move(direction); } else if (words.Length == 3 & words[1] == "tp") { string destination = words[2]; player.Move(true, destination); } break; default: Console.WriteLine("Unknown action, try again."); break; } } }
public static void TitleScreen() { int width = 28; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(" _______ _______ ______ ______ _______ ______ _______ _______ ___ _______ "); Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("| _ || || _ | | | | || _ | | || _ || | | |"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("| |_| || _ || | || | _ || ___|| | || |_ _|| |_| || | | ___|"); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("| || | | || |_||_ | | | || |___ | |_||_ | | | || | | |___ "); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("| _ | | |_| || __ || |_| || ___|| __ | | | | || |___ | ___|"); Console.ForegroundColor = ConsoleColor.DarkBlue; Console.WriteLine("| |_| || || | | || || |___ | | | | | | | _ || || |___ "); Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine("|_______||_______||___| |_||______| |_______||___| |_| |___| |__| |__||_______||_______|\n"); Console.ResetColor(); PrintUtils.GetHash(width, ConsoleColor.Yellow); PrintUtils.CenterPadHash("Welcome to Bordertale!", width, ConsoleColor.Yellow); PrintUtils.CenterPadHash("- Play -", width, ConsoleColor.Yellow); PrintUtils.CenterPadHash("- Resume -", width, ConsoleColor.Yellow); PrintUtils.CenterPadHash("- Help -", width, ConsoleColor.Yellow); PrintUtils.CenterPadHash("- Acknowledgements -", width, ConsoleColor.Yellow); PrintUtils.CenterPadHash("- Quit -", width, ConsoleColor.Yellow); PrintUtils.CenterPadHash("Copyright 2021 tejmen09", width, ConsoleColor.Yellow); PrintUtils.GetHash(width, ConsoleColor.Yellow); bool inLoop = true; while (inLoop) { string option = PrintUtils.Input().ToLower(); switch (option) { case "play": inLoop = false; MainGame.StartGame(); break; case "help": inLoop = false; HelpScreen(false); break; case "quit": inLoop = false; PrintUtils.GetHash(15, ConsoleColor.DarkYellow); PrintUtils.CenterPadHash("GOODBYE!!", 15, ConsoleColor.DarkYellow); PrintUtils.GetHash(15, ConsoleColor.DarkYellow); Thread.Sleep(500); Environment.Exit(0); break; case "acknowledgements": inLoop = false; AcknowledgementsScreen(); break; case "resume": inLoop = false; // TODO Add ResumeGame() Functionality, ideally from a json object stored through a file. break; default: Console.WriteLine("Please enter a valid command."); break; } } }
public static void ShopScreen() { PrintUtils.GetHash(103, ConsoleColor.Cyan); Console.ForegroundColor = ConsoleColor.Cyan; Console.Write(PrintUtils.CenterPadHashReturn("SHOP", 103)); Console.WriteLine($@" # # ████████████████ # ██████████████████████████ # # ██████ ██████ # ██ ▒▒██ # ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ # # ██ ▒▒██ ██ ▒▒██ # ██ ▒▒██ # ██▒▒ ▒▒██ # # ██ ▒▒██ ██ ▒▒██ # ██ ▒▒▒▒▒▒▒▒ ▒▒██ # ██▒▒ ▒▒██ # # ██ ▒▒██ ██ ▒▒██ # ██ ▒▒▒▒████▒▒ ▒▒██ # ██▒▒ ▒▒██ # # ██ ▒▒██ ██ ██ # ██ ▒▒██ ██ ▒▒██ # ██▒▒ ▒▒██ # #██ ▒▒▒▒██ ██▒▒ ▒▒██# ██ ▒▒██ ██ ▒▒██ # ██▒▒ ▒▒██ # #██▒▒▒▒▒▒██ ██▒▒▒▒▒▒██# ██ ▒▒██ ██ ▒▒██ # ██▒▒ ▒▒██ # #████████ ████████# ██▒▒▒▒██ ██▒▒▒▒██ # ██▒▒ ▒▒██ # # # ████████ ████████ # ██▒▒ ██ ▒▒██ # # [1]Boots ₴ 10 # [2]Leggings ₴ 20 # ██▒▒ ██████ ▒▒██ # ############################################################## ██▒▒ ██ ▒▒██ # # # ████ ████ # ██▒▒ ▒▒██ # # # ████ ▒▒██ ██ ████ # ██▒▒ ▒▒██ # # ████████████ # ██ ▒▒██ ██ ▒▒██ # ██▒▒ ▒▒██ # # ██ ▒▒██ # ██ ████ ▒▒██ # ██▒▒ ▒▒██ # # ██ ▒▒▒▒██ # ██▒▒ ▒▒▒▒██ # ██▒▒ ▒▒██ # # ██ ▒▒▒▒▒▒██ # ██ ▒▒▒▒██ # ██▒▒ ▒▒██ # # ██ ████████▒▒▒▒██ # ██▒▒ ▒▒▒▒██ # ██▒▒ ▒▒██ # # ██ ████████████▒▒██ # ██ ▒▒██ # ██▒▒ ▒▒██ # # ██ ████████████▒▒██ # ██ ▒▒▒▒██ # ██▒▒▒▒▒▒▒▒▒▒██ # # ████ ████ # ██▒▒ ▒▒▒▒▒▒██ # ██▒▒▒▒▒▒██ # # # ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒██ # ██▒▒██ # # # ██▒▒▒▒▒▒▒▒▒▒▒▒██ # ██ # # # ████████████ # # # # # # # [3]Helmet ₴ 30 # [4]Chestplate ₴ 40 # [5]Shield ₴ 35 #"); PrintUtils.GetHash(103); PrintUtils.CenterPadHash("Type the number of the you want to buy to purchase. Type back to go back.", 103); PrintUtils.CenterPadHash($"You have ₴{MainGame.player.money.ToString()}.", 103); PrintUtils.GetHash(103); bool inLoop = true; while (inLoop) { string cart = PrintUtils.Input().ToLower(); switch (cart) { case "1": inLoop = false; MainGame.player.Acquire(Helpers.ItemFactory.CreateItem("boots")); break; case "2": inLoop = false; MainGame.player.Acquire(Helpers.ItemFactory.CreateItem("leggings")); break; case "3": inLoop = false; MainGame.player.Acquire(Helpers.ItemFactory.CreateItem("helmet")); break; case "4": inLoop = false; MainGame.player.Acquire(Helpers.ItemFactory.CreateItem("chestplate")); break; case "5": inLoop = false; MainGame.player.Acquire(Helpers.ItemFactory.CreateItem("shield")); break; case "back": inLoop = false; MainGame.Prompt(); break; default: Console.WriteLine("Please enter a valid number."); break; } } }