public static void start_game() { Player.get_room().describe(); Text_Buffer.Add("\nEnemy is located at [ " + enemy._X_Position + ", " + enemy._Y_Position + " ]"); Text_Buffer.Add("\nYou are located at [ " + Player._Player._X_Position + ", " + Player._Player._Y_Position + " ]"); Text_Buffer.print(); }
public override void Stats() { string message = ("Current stats for " + _name + " of " + _class); string underline = ""; underline = underline.PadLeft(message.Length, '-'); Text_Buffer.Add(message + "\n" + underline); Text_Buffer.Add("Health:\t" + _health); Text_Buffer.Add("Weapon:\t" + _weapon); }
//show enemy stats public static void npc_stats() { string message = ("Current Enemy Staus:"); string underline = ""; underline = underline.PadLeft(message.Length, '-'); Text_Buffer.Add(message + "\n" + underline); Text_Buffer.Add("Health:\t" + _health); Text_Buffer.Add("Weapon:\t" + _weapon); }
public static void check_game_rules() { Console.Clear(); if (Player._Player._X_Position == Game_Manager.enemy._X_Position && Player._Player._Y_Position == Game_Manager.enemy._Y_Position) { Text_Buffer.Add("You have encountered an enemy!"); Game_Manager.enemy.Identify(); Text_Buffer.Add("\nEnemy Stats are:"); Game_Manager.enemy.NPC_Stats(); } }
public static void help_screen() { string message = "Available Commands:"; string underline = ""; underline = underline.PadLeft(75, '-'); Text_Buffer.Add(message + "\n" + underline); Text_Buffer.Add("~\tmove\t\t-\tto travel north, south, east, west\t~"); Text_Buffer.Add("~\tlook\t\t-\tto see your surroundings\t\t~"); Text_Buffer.Add("~\ttake\t\t-\tto add an item to your inventory\t~"); Text_Buffer.Add("~\tdrop\t\t-\tto drop an item from your inventory\t~"); Text_Buffer.Add("~\tstats\t\t-\tto see your current stats\t\t~"); Text_Buffer.Add("~\tinventory\t-\tto see what you are carrying\t\t~"); Text_Buffer.Add("~\thelp\t\t-\tto bring up the help menu\t\t~"); Text_Buffer.Add("~\tquit\t\t-\tto end the game\t\t\t\t~"); Text_Buffer.Add(underline); }
/* * to be used with an UPDATE PATTERN? * maybe put a random direction in and update position? */ public void npc_move(string direction) { //first we need to get the current room //the player is in so we can see where to move Room room = Non_PLayer.npc_get_room(); if (!room.has_exit(direction)) { Text_Buffer.Add("NPC can't go that way."); return; // return out of the method so another command can be given } room.remove_enemy(Game_Manager.enemy); ; switch (direction) { case Direction._north: Game_Manager.enemy._Y_Position--; //move up one on the grid room.add_enemy(Game_Manager.enemy); break; case Direction._south: Game_Manager.enemy._Y_Position++; //move down one on the grid room.add_enemy(Game_Manager.enemy); break; case Direction._east: Game_Manager.enemy._X_Position++; //move right one on the grid room.add_enemy(Game_Manager.enemy); break; case Direction._west: Game_Manager.enemy._X_Position--; //move left one on the grid room.add_enemy(Game_Manager.enemy); break; //no need for a default since the direction has //already been checked as valid or not. } //get the description of the current room. //Non_PLayer.npc_get_room().describe(); }
public static Non_PLayer Generate_NPC() { Non_PLayer npc = null; Array values = Enum.GetValues(typeof(NPC_Names)); Random random = new Random(); NPC_Names randomName = (NPC_Names)values.GetValue(random.Next(values.Length)); Array rValues = Enum.GetValues(typeof(NPC_Class)); Random cRandom = new Random(); NPC_Class randomClass = (NPC_Class)rValues.GetValue(cRandom.Next(rValues.Length)); Array wValues = Enum.GetValues(typeof(Player_Weapon)); Random wRandom = new Random(); Player_Weapon randomWeapon = (Player_Weapon)wValues.GetValue(wRandom.Next(wValues.Length)); switch (randomClass) { case NPC_Class.Egnor: npc = new Egnor(randomName, randomWeapon); break; case NPC_Class.Erstine: npc = new Erstine(randomName, randomWeapon); break; case NPC_Class.Tyrania: npc = new Erstine(randomName, randomWeapon); break; default: Text_Buffer.Add("No Player Detected..."); break; } return(npc); }
public static Player GeneratePlayer() { Player p = null; string n = string.Empty; bool correct = false; Text_Buffer.Add("\nPlease enter your name: "); Text_Buffer.prompt(); n = Console.ReadLine(); while (!correct) { string newName; Text_Buffer.Add("\nIf " + n + " is correct, press < enter >\n\n\tIf it's not, please re-enter your name now:"); Text_Buffer.prompt(); newName = Console.ReadLine(); if (newName == string.Empty) { Text_Buffer.Add("\nWhat a good, strong name, " + n + "!"); correct = true; } else { n = newName; } } Player_Class pc = 0; Text_Buffer.Add("\nThere are 3 races in this game."); Text_Buffer.Add("\tThey are:"); Text_Buffer.Add("\n\t1. Rankari"); Text_Buffer.Add("\t2. Nobellus"); Text_Buffer.Add("\t3. Ginoba"); Text_Buffer.Add("\nPlease choose one: "); Text_Buffer.prompt(); string t = Console.ReadLine(); correct = false; int i = 0; while (!correct) { if (t == "1" || t == "2" || t == "3") { i = int.Parse(t); correct = true; } else { Console.WriteLine("That is not a valid choice. Try again..."); t = Console.ReadLine(); } } switch (i) { case 1: pc = Player_Class.Rankari; correct = true; break; case 2: pc = Player_Class.Nobellus; correct = true; break; case 3: pc = Player_Class.Ginoba; correct = true; break; default: Text_Buffer.Add("No race selected!"); pc = Player_Class.INCOGNITO; Text_Buffer.print(); break; } Player_Weapon pw = 0; Text_Buffer.Add("\nThere are 4 weapons in this game."); Text_Buffer.Add("\tThey are:"); Text_Buffer.Add("\n\t1. Knife"); Text_Buffer.Add("\t2. Sword"); Text_Buffer.Add("\t3. Axe"); Text_Buffer.Add("\t4. Warhammer"); Text_Buffer.Add("\nPlease choose one: "); Text_Buffer.prompt(); string s = Console.ReadLine(); correct = false; int j = 0; while (!correct) { if (s == "1" || s == "2" || s == "3" || s == "4") { j = int.Parse(s); correct = true; } else { Console.WriteLine("That is not a valid choice. Try again..."); s = Console.ReadLine(); } } switch (j) { case 1: pw = Player_Weapon.Knife; break; case 2: pw = Player_Weapon.Sword; break; case 3: pw = Player_Weapon.Axe; break; case 4: pw = Player_Weapon.WarHammer; break; default: Text_Buffer.Add("No weapon selected!"); Text_Buffer.print(); break; } switch (pc) { case Player_Class.Rankari: p = new Rankari(n, pw); break; case Player_Class.Nobellus: p = new Nobellus(n, pw); break; case Player_Class.Ginoba: p = new Ginoba(n, pw); break; default: Text_Buffer.Add("No Player Detected..."); break; } return(p); }
public override void Identify() { Text_Buffer.Add("\nI am from the mountains of Tyrania"); }
public override void Identify() { Text_Buffer.Add("\nI am from Egnor and will outsmart you!"); }
public override void BattleCry() { Text_Buffer.Add("\nI am Nobellus, and I fight for what is just."); }
public override void BattleCry() { Text_Buffer.Add("\nI am Ginoba, the wisest of them all."); }
public static void process_enemy(string input) { Game_Manager.enemy.npc_move(input); Text_Buffer.Add("\nEnemy is located at [ " + Game_Manager.enemy._X_Position + ", " + Game_Manager.enemy._Y_Position + " ]"); }
// determine what action to take based // on the user input public static void process(string input) { // get the first half and trim it to one easy to read command string command = Game_Utilities.extract_command(input.Trim().Trim().ToLower()); // get the second half and trim it to one easy to read command string action = Game_Utilities.extract_action(input.Trim().Trim().ToLower()); string direction = Game_Manager.enemy.npc_direction(); // now take action based on the input given: /* * user commands are: * ~ move - moves the player * ~ look - describes the current area * ~ take - takes an object from the area * ~ stats - displays the Player's current stats * ~ drop - drops an object from the area * ~ inventory - lists the player's inventory items * ~ help - displays the list of user commands * ~ quit - exits the game */ switch (command) { case "move": Player.move(action); Text_Buffer.Add("\nYou are located at [ " + Player._Player._X_Position + ", " + Player._Player._Y_Position + " ]"); break; case "battlecry": Player._Player.BattleCry(); break; case "look": Player.get_room().describe(); break; case "take": Player.pickup_item(action); break; case "drop": Player.drop_item(action); break; case "stats": Player.stats(); break; case "inventory": Player.print_inventory(); break; case "help": help_screen(); break; case "quit": Program.quit = true; return; } process_enemy(direction); Game_Manager.check_game_rules(); Text_Buffer.print(); }
public override void Identify() { Text_Buffer.Add("\nI hail from the land of Erstine.");; }
public override void NPC_Stats() { Text_Buffer.Add("Health:\t" + _health); Text_Buffer.Add("Weapon:\t" + _weapon); }
public override void BattleCry() { Text_Buffer.Add("\nI am Rankari! Hear me ROAR!"); }