public static void Combat(bool random, string name, int power, int health) { string n = ""; int p = 0; int h = 0; int difficulty = MainGame.currentPlayer.health / 2; if (random) { string[] enemyNames = { "Raider", "Maurador", "Wolf" }; int[] enemyPowers = { 1, 2, 4 }; int[] enemyHealths = { 2, 4, 6 }; n = enemyNames[rnd.Next(0, 3)]; p = enemyPowers[rnd.Next(0, 3)]; h = enemyHealths[rnd.Next(0, 3)]; } else { n = name; p = power; h = health; } while (h > 0) { Console.Clear(); Console.WriteLine("Enemy Name: " + n); Console.WriteLine("Attack Power: " + p + " | " + "Health: " + h + "\n"); Console.WriteLine("==========================="); Console.WriteLine("|| ATTACK (A) DEFEND (D) || "); Console.WriteLine("|| RUN (R) HEAL(H) ||"); Console.WriteLine("===========================\n"); Console.WriteLine("Potions: " + MainGame.currentPlayer.potions + " Health: " + MainGame.currentPlayer.health); if (MainGame.currentPlayer.health <= 0) { PlayerDeath(); } else { string playerInput = Console.ReadLine(); if (playerInput.ToUpper() == "A" || playerInput.ToUpper() == "ATTACK") { Console.WriteLine(MainGame.currentPlayer.name + " darts forward and attacks the " + n); int damage = p - MainGame.currentPlayer.armorValue; if (damage < 0) { damage = 0; } int attack = rnd.Next(0, MainGame.currentPlayer.weaponValue) + rnd.Next(1, 4); MainGame.currentPlayer.health -= damage; h -= attack; Console.WriteLine("You lost " + damage + " health and dealt " + attack + " damage"); if (MainGame.currentPlayer.armorValue > damage) { int armorLost = MainGame.currentPlayer.armorValue - p; Console.WriteLine("You lost " + armorLost + " points of armor"); MainGame.currentPlayer.armorValue -= p; } } else if (playerInput.ToUpper() == "D" || playerInput.ToUpper() == "DEFEND") { Console.WriteLine("You brace for an attack as the " + n + " makes a move against you"); int damage = (p / 4) - MainGame.currentPlayer.armorValue; if (damage < 0) { damage = 0; } int attack = rnd.Next(0, MainGame.currentPlayer.weaponValue) / 2; MainGame.currentPlayer.health -= damage; h -= attack; Console.WriteLine("You lost " + damage + " health and dealt " + attack + " damage"); } else if (playerInput.ToUpper() == "R" || playerInput.ToUpper() == "RUN") { Console.WriteLine("You make an attempt to escape the battle"); if (rnd.Next(0, 2) == 0) { Console.WriteLine("\n as you sprint away you trip and fall, letting " + n + " catch up to you.\n The battle continues."); int damage = (p * 2) - MainGame.currentPlayer.armorValue; if (damage < 0) { damage = 0; } MainGame.currentPlayer.health -= damage; Console.WriteLine("\nYou lost " + damage + " health and failed to escape."); if (MainGame.currentPlayer.health <= 0) { PlayerDeath(); } //Console.ReadKey(); } else { Escape(); } } else if (playerInput.ToUpper() == "H" || playerInput.ToUpper() == "HEAL") { if (MainGame.currentPlayer.potions == 0) { Console.WriteLine("\nYou check your knapsack but find 0 potions.\n" + n + "leaps forward and attacks you while you're distracted"); int damage = p - MainGame.currentPlayer.armorValue; if (damage < 0) { damage = 0; } MainGame.currentPlayer.health -= damage; Console.WriteLine("\nYou lost " + damage + " health and failed to heal."); } else { MainGame.currentPlayer.health = MainGame.currentPlayer.health + rnd.Next(1, 6); MainGame.currentPlayer.potions = MainGame.currentPlayer.potions - 1; Console.WriteLine("\nYour health is now at: " + MainGame.currentPlayer.health); } Console.ReadKey(); } } Console.ReadKey(); } if (h <= 0) { if (MainGame.currentPlayer.health <= 0) { PlayerDeath(); } else { Console.WriteLine("\nYou defeated the " + n); int randomCoin = rnd.Next(1, 11); Player.coins += randomCoin; Console.WriteLine("You found " + randomCoin + " coins!"); Console.ReadKey(); MainGame.Shop(); } } }
public static void Escape() { Console.WriteLine("\nYou escape successfully!"); Console.ReadKey(); MainGame.Shop(); }
public static void plainsAdventure(bool encounter) { bool input = true; if (encounter) { Console.Clear(); Console.WriteLine("You begin travelling through a large plains area"); string[] randomContext = { "camp", "watchtower", "field" }; string r = randomContext[rnd.Next(0, 3)]; Console.WriteLine("While traveling through this expanse of land, you see a " + r + " in the distance\n"); Console.ReadKey(); while (input) { Console.WriteLine("Continue searching?(Y/N)"); string playerInput = Console.ReadLine(); Console.Clear(); if (playerInput.ToUpper() == "Y") { input = false; Console.WriteLine("\nYou decide to investigate the " + r + ", only to find out it was an elaborate trap! You are ambushed."); Console.ReadKey(); Encounter.Combat(true, "", 0, 0); } else if (playerInput.ToUpper() == "N") { input = false; bool transitionCheck = true; if (transitionCheck) { Console.WriteLine("You hastily make your way though the plains"); Console.WriteLine("Would you like to CONTINUE exploring or head to the SHOP?"); if (playerInput.ToUpper() == "CONTINUE") { transitionCheck = false; Exploration.Explore(true, "", 0); } else if (playerInput.ToUpper() == "SHOP") { transitionCheck = false; MainGame.Shop(); } } } } } else { Console.Clear(); Console.WriteLine("You begin travelling through a large plains area"); string[] randomContext = { "camp", "watchtower", "field" }; string r = randomContext[rnd.Next(0, 3)]; Console.WriteLine("While traveling through this expanse of land, you see a " + r + " in the distance\n"); Console.ReadKey(); while (input) { Console.WriteLine("Continue searching?(Y/N)"); string playerInput = Console.ReadLine(); Console.Clear(); if (playerInput.ToUpper() == "Y") { input = false; Console.WriteLine("In the " + r + " you find a chest full of loot!"); int randomCoin = rnd.Next(10, 21); Player.coins += randomCoin; Console.WriteLine("You found " + randomCoin + " coins in the chest!"); Console.ReadKey(); //restock shop TheShop.potions = 5; TheShop.shield = 1; MainGame.Shop(); } else if (playerInput.ToUpper() == "N") { input = false; Console.WriteLine("You make your way through the plains, returning to the shop"); Console.ReadKey(); MainGame.Shop(); } } } }
public static void dungeonAdventure(bool encounter) { bool input = true; if (encounter) { Console.Clear(); Console.WriteLine("You enter a dark and ominous dungeon"); string[] randomContext = { "temple", "prison", "mineshaft" }; string r = randomContext[rnd.Next(0, 3)]; Console.WriteLine("From the looks of it, it appears this dungeon was used as a " + r + " long before you discovered it\n"); Console.ReadKey(); while (input) { Console.WriteLine("Continue searching?(Y/N)"); string playerInput = Console.ReadLine(); Console.Clear(); if (playerInput.ToUpper() == "Y") { //input = false; Console.WriteLine("\nWhile looking for valuables you alert yourself to whomever dwells in this " + r); Console.ReadKey(); Encounter.Combat(true, "", 0, 0); } else if (playerInput.ToUpper() == "N") { //input = false; bool transitionCheck = true; if (transitionCheck) { Console.WriteLine("You exit the dungeon"); Console.WriteLine("Would you like to CONTINUE exploring or head to the SHOP?"); if (playerInput.ToUpper() == "CONTINUE") { transitionCheck = false; Exploration.Explore(true, "", 0); } else if (playerInput.ToUpper() == "SHOP") { transitionCheck = false; MainGame.Shop(); } } } } } else { Console.Clear(); Console.WriteLine("You enter a dark and ominous dungeon"); string[] randomContext = { "temple", "prison", "mineshaft" }; string r = randomContext[rnd.Next(0, 3)]; Console.WriteLine("From the looks of it, it appears this dungeon was used as a " + r + " long before you discovered it\n"); Console.ReadKey(); while (input) { Console.WriteLine("Continue searching?(Y/N)"); string playerInput = Console.ReadLine(); Console.Clear(); if (playerInput.ToUpper() == "Y") { input = false; Console.WriteLine("While exploring the ruins of what remaind of this " + r + " you came across a chest"); int randomCoin = rnd.Next(10, 21); Player.coins += randomCoin; Console.WriteLine("You found " + randomCoin + " coins in the chest!"); Console.ReadKey(); //restock shop TheShop.potions = 5; TheShop.shield = 1; MainGame.Shop(); } else if (playerInput.ToUpper() == "N") { input = false; Console.WriteLine("You exit the dungeon, making your way back to a shop"); Console.ReadKey(); MainGame.Shop(); } } } }
public static void villageAdventure(bool encounter) { bool input = true; if (encounter) { Console.Clear(); Console.WriteLine("A village catches your eye in the distance. You decide to head over and attempt to explore it"); string[] randomContext = { "farming community", "raider stronghold", "ruin" }; string r = randomContext[rnd.Next(0, 3)]; Console.WriteLine("Upon closer investigation, you discover that this village is a " + r + "\n"); Console.ReadKey(); while (input) { Console.WriteLine("Continue searching?(Y/N)"); string playerInput = Console.ReadLine(); Console.Clear(); if (playerInput.ToUpper() == "Y") { input = false; Console.WriteLine("\nAs you continue to search this " + r + " its inhabitants leap out and attack"); Console.ReadKey(); Encounter.Combat(true, "", 0, 0); } else if (playerInput.ToUpper() == "N") { input = false; bool transitionCheck = true; if (transitionCheck) { Console.WriteLine("You exit the dungeon"); Console.WriteLine("Would you like to CONTINUE exploring or head to the SHOP?"); if (playerInput.ToUpper() == "CONTINUE") { transitionCheck = false; Exploration.Explore(true, "", 0); } else if (playerInput.ToUpper() == "SHOP") { transitionCheck = false; MainGame.Shop(); } } } } } else { Console.Clear(); Console.WriteLine("A village catches your eye in the distance. You decide to head over and attempt to explore it"); string[] randomContext = { "farming community", "raider stronghold", "ruin" }; string r = randomContext[rnd.Next(0, 3)]; Console.WriteLine("Upon closer investigation, you discover that this village is a " + r + "\n"); Console.ReadKey(); while (input) { Console.WriteLine("Continue searching?(Y/N)"); string playerInput = Console.ReadLine(); Console.Clear(); if (playerInput.ToUpper() == "Y") { input = false; Console.WriteLine("While exploring the village some inhabitants approach you"); int randomCoin = rnd.Next(10, 21); Player.coins += randomCoin; Console.WriteLine("They give you " + randomCoin + " coins!"); Console.WriteLine("\nInhabitant: Most people come here to attack, we're glad you came with friendly intentions! " + "Thank you " + MainGame.currentPlayer.name + "."); string attackInput = Console.ReadLine(); if (attackInput.ToUpper() == "ATTACK") { Encounter.Combat(false, "Villager", 1, 6); } else { // Console.ReadKey(); //restock shop TheShop.potions = 5; TheShop.shield = 1; MainGame.Shop(); } } else if (playerInput.ToUpper() == "N") { input = false; bool transitionCheck = true; if (transitionCheck) { Console.WriteLine("You depart from the village"); Console.WriteLine("Would you like to CONTINUE exploring or head to the SHOP?"); if (playerInput.ToUpper() == "CONTINUE") { transitionCheck = false; Exploration.Explore(true, "", 0); } else if (playerInput.ToUpper() == "SHOP") { transitionCheck = false; MainGame.Shop(); } } } } } }