static void Main(string[] args)
Game NewDungeonGame = new Game();
NewDungeonGame.StartGame();
Monster Gnome = new Monster("Gnome", 8, 8, 8, 12, 0, 1);
Console.ForegroundColor = ConsoleColor.Blue;
private const int ExitCode = 0;
Console.WriteLine("________________________________________________________________________________________________________________________");
Console.SetCursorPosition(45, 2);
Console.WriteLine("Welcome to my text based Game");
Console.SetCursorPosition(10, 4);
Console.WriteLine("Lets explain whats gonna happen. You are going to enter a dungeon and have to choose the path.");
Console.SetCursorPosition(10, 5);
Console.WriteLine("Its based of DnD so every action will be decided by a roll of dice.");
Console.SetCursorPosition(10, 6);
for (int a = 1; a <= 7; a++)
Console.SetCursorPosition(0, a);
Console.WriteLine("||||");
Console.SetCursorPosition(116, a);
Console.WriteLine("||||");
Console.SetCursorPosition(0, 7);
Console.WriteLine("________________________________________________________________________________________________________________________");
Console.WriteLine("\nYou enter the dungeon\n");
Console.WriteLine("Please choose the direction you want to go. \n1. Left\n2. Right\n3. Center");
decision1 = Console.ReadLine().ToLower();
Console.WriteLine("You go left");
Console.WriteLine("You go right");
Console.WriteLine("You go center");
Console.WriteLine("This is not a valid path, choose again");
Console.WriteLine("\nYou defeated the dungeon and opened the Chest.\nCongratulations, you just won the game\n");
Environment.Exit(ExitCode);
Random rnd = new Random();
string[] pathOptions = { "The hallway is very dark but you hear something in front of you", "Path number 2", "Path number 3", "Path number 4", };
int randomPath = rnd.Next(pathOptions.Length);
string pathText = pathOptions[randomPath];
Console.WriteLine(pathText);
string[] monsterOptions = { "Gnome", "Iron Giant", "Dragon" };
int randomMonster = rnd.Next(monsterOptions.Length);
string monsterText = monsterOptions[randomPath];
Console.WriteLine(pathText);
public Creature(string _name, int _currentHP, int _maxHP, int _attack, int _armor, int _currentEXP, int _currentLVL)
currentEXP = _currentEXP;
currentLVL = _currentLVL;
public class Hero : Creature
public Hero(string _name, int _currentHP, int _maxHP, int _attack, int _armor, int _currentEXP, int _currentLVL)
: base(_name, _currentHP, _maxHP, _attack, _armor, _currentEXP, _currentLVL)
public void NameCharacter()
Console.WriteLine("What would you like your character's name to be?");
Console.SetCursorPosition(49, 9);
name = Console.ReadLine();
Console.WriteLine("\n\nGreat! Your character is now named " + name);
Console.WriteLine("\nTo win this wonderful game, you need to kill the Boss before you die");
Console.WriteLine("\nGood Luck!", "green");
Console.Write("Press a key to continue");
Hero Hero = new Hero(name, 20, 20, 12, 15, 0, 1);
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.WriteLine("________________________________________________________________________________________________________________________");
Console.SetCursorPosition(40, 2);
Console.WriteLine("Hero's name: {0}", name);
Console.SetCursorPosition(65, 2);
Console.WriteLine("Level: {0}", currentLVL);
Console.SetCursorPosition(40, 3);
Console.WriteLine("HP: {0}/{1}", currentHP, maxHP);
Console.SetCursorPosition(65, 3);
Console.WriteLine("Armor Class: {0}", armor);
Console.SetCursorPosition(40, 4);
Console.WriteLine("Attack Dice: {0}", attack);
Console.WriteLine("________________________________________________________________________________________________________________________");
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("Looks like you are dead!");
Console.WriteLine("Better luck next time!");
Random rndHealChance = new Random();
int healChances = rndHealChance.Next(1, Dice.dSix);
Console.WriteLine("Your healing failed.");
Random rndHealing = new Random();
int healRolled = rndHealing.Next(1, Dice.dTen);
Console.WriteLine("Your healing worked and you healed for {0}. Your current HP is now {1}", healRolled, currentHP);
public void AttackChoice()
Console.WriteLine("What do you want to do. \n1. Attack\n2. Heal\n3. Escape");
string attackChoice = Console.ReadLine().ToLower();
Console.WriteLine("You attack the enemy");
Console.WriteLine("You chose to heal");
Console.WriteLine("You try to escape, you pussy");
Console.WriteLine("This is not an option. Please choose again");
Console.WriteLine("You try to escape");
public void AttackHero(Monster target)
Random rnd = new Random();
int hitChancesHero = rnd.Next(1, Dice.dTwenty);
if (hitChancesHero == Dice.dTwenty)
Console.WriteLine("\nYou rolled a critial hit and killed this POS");
Console.WriteLine("That critical hit was strong enough to expelled a key from his pocket.");
Console.WriteLine("\nYou have {0} Coin and {1} Boss Key", Loot.coin, Loot.bossKey);
else if (hitChancesHero >= target.armor)
Console.WriteLine("\nYou attack the monster and hit him");
Console.WriteLine("Let's roll to see how much damage you done!");
Random rnd1 = new Random();
int hitDamage = rnd1.Next(1, attack + 1);
Console.WriteLine("You made {0} damage.", hitDamage);
target.currentHP -= hitDamage;
Console.WriteLine("\nThe {0} has {1}", target.name, target.currentHP);
Console.WriteLine("Sorry you missed!");
public class Monster : Creature
public Monster(string _name, int _currentHP, int _maxHP, int _attack, int _armor, int _currentEXP, int _currentLVL)
: base(_name, _currentHP, _maxHP, _attack, _armor, _currentEXP, _currentLVL)
public void MonsterTurn(Hero target)
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("\nEnemys turn!!!");
Console.WriteLine("Lets rolls to see if he hits you");
Random rnd = new Random();
int hitChancesEnemy = rnd.Next(1, Dice.dTwenty);
if (hitChancesEnemy == 20)
Console.WriteLine("Bad luck for you, the enemy just rolled a 20");
Console.WriteLine("Its a critical hit.... ");
target.currentHP -= target.currentHP;
Console.WriteLine("\nThe Damage is fatal and you are left to die");
Console.ForegroundColor = ConsoleColor.Blue;
else if (hitChancesEnemy >= target.armor)
Console.WriteLine("The Enemy did not missed and deals damage");
Random rnd2 = new Random();
int hitDamage = rnd2.Next(1, attack);
Console.WriteLine("The {0} is dealing {1}", name, hitDamage);
target.currentHP -= hitDamage;
Console.WriteLine("\nThe {0} has {1}", name, currentHP);
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("He missed!");
Console.WriteLine("\nThe {0} has {1}", name, currentHP);
Console.ForegroundColor = ConsoleColor.Blue;
public static int dFour = 5;
public static int dSix = 7;
public static int dEight = 9;
public static int dTen = 11;
public static int dTwelve = 7;
public static int dTwenty = 21;
public static int coin = 0;
public static int bossKey = 0;
public void LootManager()
Random rnd2 = new Random();
int num1 = rnd2.Next(1, Dice.dTwelve);
if (num1 <= 1 && num1 <= 4)
Console.WriteLine("You have {0} Coin and {1} Boss Key", coin, bossKey);
else if (num1 >= 5 && num1 <= 10)
Console.WriteLine("You have {0} Coin and {1} Boss Key", coin, bossKey);
else if (num1 >= 11 && num1 <= 16)
Console.WriteLine("You have {0} Coin and {1} Boss Key", coin, bossKey);
else if (num1 >= 17 && num1 <= 19)
Console.WriteLine("You get a Boss Key!");
Console.WriteLine("You have {0} Coin and {1} Boss Key", coin, bossKey);
Console.WriteLine("You get a Coin and a Boss Key!");
Console.WriteLine("You have {0} and {1}", coin, bossKey);