Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace GameRPG
- {
- class Program
- {
- static void Main(string[] args)
- {
- // Player starts with pre-determined level, xp, hp, attack, defence, magic, coins
- // The goal of the game is to pass through all rooms in the dungeon, collecting items and defeating enemies until you defeat the final boss, or die trying
- //** Player increases level if he reaches 100 xp, xp is gained by killing monsters. For each level hp++, attack++, magic++, coins++
- //** If xp == 100, level++
- //** Attack is increased by gaining weapons and increasing level
- //** Defence is gained by gaining armour
- //** Coins are increased by gaining level, defeating monsters, finding it in chests
- //** The dungeon has 30 rooms in total
- //** Room type can be monster room, shop room, regeneration room, chest room, final boss room
- //** Monster types can be zombie, ghost, orc, minotaur
- //** Regeneration room regenerates player health back to 100
- //** Shop room gives chance to buy health potion, magic book, weapon or armour
- //** Armour types = leather armour, iron armour, steel armour
- //** Weapon types = knife, wooden spear, axe, sword
- //** Chest room always gives reward which can be health potion, weapon, armour, spell book or coins
- //** If player health <= 0, player dies
- int playerLevel = 1;
- int playerXp = 0;
- int playerHp = 100;
- int playerAttack = 25;
- int playerDefence = 10;
- int playerMagic = 5;
- int playerCoins = 0;
- string playerWeapon = "None";
- string playerArmour = "None";
- string playerName = "";
- string roomType = "";
- string monsterType = "";
- int monsterHp = 0;
- int monsterAttack = 0;
- int magicToPassMonster = 0;
- bool gameOver = false;
- bool gameIsWon = false;
- Random random = new Random();
- for (int i = 2000; i >= 100; i -= 200)
- {
- Console.Beep(i, 100);
- }
- Console.WriteLine("Welcome to my dungeon!");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("Many have entered and tried to complete it, but few have succeeded!");
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine("Are you brave enough to enter?");
- System.Threading.Thread.Sleep(2000);
- Console.Write("Yes / No : ");
- string choiceEnter = Console.ReadLine();
- Console.Clear();
- if (choiceEnter == "No" || choiceEnter == "no" || choiceEnter == "NO")
- {
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("Ha-ha-ha...Come back when you are brave enough!");
- Console.WriteLine("");
- string stringGameOver = "GAME OVER!";
- for (int i = 0; i < stringGameOver.Length; i++)
- {
- System.Threading.Thread.Sleep(1000);
- char letter = stringGameOver[i];
- Console.Write(letter);
- }
- System.Threading.Thread.Sleep(2000);
- }
- else if (choiceEnter == "Yes" || choiceEnter == "yes" || choiceEnter == "YES")
- {
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("Congratulations for deciding to enter my dungeon!");
- System.Threading.Thread.Sleep(2000);
- Console.Write("Your name is: ");
- playerName = Console.ReadLine();
- Console.Clear();
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"This will be the ultimate test for you {playerName}!");
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine("Once you enter the first room there will be only two possible scenarios...");
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine("... success or death!");
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine($"Good luck {playerName}!...You will need a lot of it!");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- for (int room = 1; room <= 30; room++)
- {
- if (room == 30)
- {
- roomType = "Final boss room";
- }
- else if (room == 8 || room == 16 || room == 26)
- {
- roomType = "Shop room";
- }
- else if (room == 12 || room == 25)
- {
- roomType = "Regeneration room";
- }
- else
- {
- int randRoomType = random.Next(1, 5);
- switch (randRoomType)
- {
- case 1:
- case 2:
- case 3:
- roomType = "Monster room";
- break;
- case 4:
- roomType = "Chest room";
- break;
- }
- }
- if (roomType == "Monster room")
- {
- int randMonsterType = random.Next(1, 5);
- Console.WriteLine($"Level:({playerLevel}) XP:({playerXp}) HP:({playerHp}) Attack:({playerAttack}) Defence:({playerDefence}) Magic:({playerMagic}) Coins:({playerCoins})");
- Console.WriteLine("");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"ROOM - {room}, {roomType}!");
- Console.WriteLine("");
- Console.WriteLine("");
- Console.WriteLine("");
- switch (randMonsterType)
- {
- case 1:
- monsterType = "Zombie";
- monsterHp = 20;
- monsterAttack = 8;
- magicToPassMonster = 2;
- break;
- case 2:
- monsterType = "Ghost";
- monsterHp = 25;
- monsterAttack = 14;
- magicToPassMonster = 3;
- break;
- case 3:
- monsterType = "Orc";
- monsterHp = 40;
- monsterAttack = 18;
- magicToPassMonster = 4;
- break;
- case 4:
- monsterType = "Minotaur";
- monsterHp = 50;
- monsterAttack = 24;
- magicToPassMonster = 5;
- break;
- }
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"You have met a {monsterType}! Your action is:");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"1 - Fight the {monsterType}!");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"2 - Try to use magic and confuse the {monsterType}!");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"3 - Attempt to run from the {monsterType}!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.Write("You choose to: ");
- int actionChoice = int.Parse(Console.ReadLine());
- Console.Clear();
- switch (actionChoice)
- {
- case 1:
- bool monsterDead = false;
- bool playerDead = false;
- Console.WriteLine($"Level:({playerLevel}) XP:({playerXp}) HP:({playerHp}) Attack:({playerAttack}) Defence:({playerDefence}) Magic:({playerMagic}) Coins:({playerCoins})");
- Console.WriteLine("");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"You have entered in a fight with the {monsterType}");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- while (!monsterDead && !playerDead)
- {
- monsterHp -= playerAttack;
- playerHp -= (monsterAttack - playerDefence);
- if (playerHp <= 0)
- {
- playerDead = true;
- }
- else if (monsterHp <= 0)
- {
- monsterDead = true;
- }
- if (playerDead == true)
- {
- gameOver = true;
- Console.WriteLine($"You have been killed by {monsterType}!");
- Console.WriteLine("");
- Console.WriteLine("");
- Console.WriteLine("");
- string stringGameOver = "GAME OVER!";
- for (int i = 0; i < stringGameOver.Length; i++)
- {
- System.Threading.Thread.Sleep(1000);
- char letter = stringGameOver[i];
- Console.Write(letter);
- }
- }
- else if (monsterDead == true)
- {
- int xpEarned = random.Next(15, 51);
- playerXp += xpEarned;
- int coinsEarned = random.Next(50, 101);
- playerCoins += coinsEarned;
- if (playerXp >= 100)
- {
- playerLevel++;
- playerXp = playerXp - 100;
- playerHp += 5;
- playerCoins += 50;
- if (playerLevel % 2 == 0)
- {
- playerAttack += 1;
- playerMagic += 1;
- }
- }
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have killed the {monsterType}!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"You have earned {xpEarned} XP!");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"You have earned {coinsEarned} coins!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"Entering next room...");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- }
- }
- break;
- case 2:
- if (playerMagic >= magicToPassMonster)
- {
- Console.WriteLine($"Level:({playerLevel}) XP:({playerXp}) HP:({playerHp}) Attack:({playerAttack}) Defence:({playerDefence}) Magic:({playerMagic}) Coins:({playerCoins})");
- Console.WriteLine("");
- Console.WriteLine("");
- playerMagic -= magicToPassMonster;
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have successfully used magic to trick the {monsterType}!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"Entering next room...");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- }
- else
- {
- Console.WriteLine($"Level:({playerLevel}) XP:({playerXp}) HP:({playerHp}) Attack:({playerAttack}) Defence:({playerDefence}) Magic:({playerMagic}) Coins:({playerCoins})");
- Console.WriteLine("");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You do not have enough magic to get past the {monsterType}!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("After the unsuccessful attempt to use magic you decide to:");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"1 - Fight the {monsterType}!");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"2 - Attempt to run from the {monsterType}!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.Write("You choose to: ");
- actionChoice = int.Parse(Console.ReadLine());
- switch (actionChoice)
- {
- case 1:
- monsterDead = false;
- playerDead = false;
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"You have entered in a fight with the {monsterType}");
- System.Threading.Thread.Sleep(2000);
- while (!monsterDead && !playerDead)
- {
- monsterHp -= playerAttack;
- playerHp -= (monsterAttack - playerDefence);
- if (playerHp <= 0)
- {
- playerDead = true;
- }
- else if (monsterHp <= 0)
- {
- monsterDead = true;
- }
- if (playerDead == true)
- {
- gameOver = true;
- Console.WriteLine($"You have been killed by {monsterType}!");
- Console.WriteLine("");
- Console.WriteLine("");
- Console.WriteLine("");
- string stringGameOver = "GAME OVER!";
- for (int i = 0; i < stringGameOver.Length; i++)
- {
- System.Threading.Thread.Sleep(1000);
- char letter = stringGameOver[i];
- Console.Write(letter);
- }
- }
- else if (monsterDead == true)
- {
- int xpEarned = random.Next(15, 51);
- playerXp += xpEarned;
- int coinsEarned = random.Next(50, 101);
- playerCoins += coinsEarned;
- if (playerXp >= 100)
- {
- playerLevel++;
- playerXp = playerXp - 100;
- playerHp += 5;
- playerCoins += 50;
- if (playerLevel % 2 == 0)
- {
- playerAttack += 1;
- playerMagic += 1;
- }
- }
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have killed the {monsterType}!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"You have earned {xpEarned} XP!");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"You have earned {coinsEarned} coins!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"Entering next room...");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- }
- }
- break;
- case 2:
- int chanceRun = random.Next(1, 5);
- switch (chanceRun)
- {
- case 1:
- case 2:
- case 3:
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"Your attempt to run from the {monsterType} was not successful!");
- monsterDead = false;
- playerDead = false;
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have entered in a fight with the {monsterType}");
- System.Threading.Thread.Sleep(2000);
- while (!monsterDead && !playerDead)
- {
- monsterHp -= playerAttack;
- playerHp -= (monsterAttack - playerDefence);
- if (playerHp <= 0)
- {
- playerDead = true;
- }
- else if (monsterHp <= 0)
- {
- monsterDead = true;
- }
- if (playerDead == true)
- {
- gameOver = true;
- Console.WriteLine($"You have been killed by {monsterType}!");
- Console.WriteLine("");
- Console.WriteLine("");
- Console.WriteLine("");
- string stringGameOver = "GAME OVER!";
- for (int i = 0; i < stringGameOver.Length; i++)
- {
- System.Threading.Thread.Sleep(1000);
- char letter = stringGameOver[i];
- Console.Write(letter);
- }
- }
- else if (monsterDead == true)
- {
- int xpEarned = random.Next(15, 51);
- playerXp += xpEarned;
- int coinsEarned = random.Next(50, 101);
- playerCoins += coinsEarned;
- if (playerXp >= 100)
- {
- playerLevel++;
- playerXp = playerXp - 100;
- playerHp += 5;
- playerCoins += 50;
- if (playerLevel % 2 == 0)
- {
- playerAttack += 1;
- playerMagic += 1;
- }
- }
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have killed the {monsterType}!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"You have earned {xpEarned} XP!");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"You have earned {coinsEarned} coins!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"Entering next room...");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- }
- }
- break;
- case 4:
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have successfully escaped from the {monsterType}!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("Entering next room...");
- Console.Clear();
- break;
- }
- break;
- }
- }
- break;
- case 3:
- int chance = random.Next(1, 5);
- switch (chance)
- {
- case 1:
- case 2:
- case 3:
- Console.WriteLine($"Level:({playerLevel}) XP:({playerXp}) HP:({playerHp}) Attack:({playerAttack}) Defence:({playerDefence}) Magic:({playerMagic}) Coins:({playerCoins})");
- Console.WriteLine("");
- Console.WriteLine("");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"Your attempt to run from the {monsterType} was not successful!");
- System.Threading.Thread.Sleep(2000);
- monsterDead = false;
- playerDead = false;
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have entered in a fight with the {monsterType}");
- System.Threading.Thread.Sleep(2000);
- while (!monsterDead && !playerDead)
- {
- monsterHp -= playerAttack;
- playerHp -= (monsterAttack - playerDefence);
- if (playerHp <= 0)
- {
- playerDead = true;
- }
- else if (monsterHp <= 0)
- {
- monsterDead = true;
- }
- if (playerDead == true)
- {
- gameOver = true;
- Console.WriteLine($"You have been killed by {monsterType}!");
- Console.WriteLine("");
- Console.WriteLine("");
- Console.WriteLine("");
- string stringGameOver = "GAME OVER!";
- for (int i = 0; i < stringGameOver.Length; i++)
- {
- System.Threading.Thread.Sleep(1000);
- char letter = stringGameOver[i];
- Console.Write(letter);
- }
- }
- else if (monsterDead == true)
- {
- int xpEarned = random.Next(15, 51);
- playerXp += xpEarned;
- int coinsEarned = random.Next(50, 101);
- playerCoins += coinsEarned;
- if (playerXp >= 100)
- {
- playerLevel++;
- playerXp = playerXp - 100;
- playerHp += 5;
- playerCoins += 50;
- if (playerLevel % 2 == 0)
- {
- playerAttack += 1;
- playerMagic += 1;
- }
- }
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have killed the {monsterType}!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"You have earned {xpEarned} XP!");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"You have earned {coinsEarned} coins!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"Entering next room...");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- }
- }
- break;
- case 4:
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have successfully escaped from the {monsterType}!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("Entering next room...");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- break;
- }
- break;
- }
- if (gameOver == true)
- {
- break;
- }
- }
- if (gameOver == true)
- {
- break;
- }
- else if (roomType == "Chest room")
- {
- int chestType = random.Next(1, 6);
- Console.WriteLine($"Level:({playerLevel}) XP:({playerXp}) HP:({playerHp}) Attack:({playerAttack}) Defence:({playerDefence}) Magic:({playerMagic}) Coins:({playerCoins})");
- Console.WriteLine("");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"ROOM - {room}, {roomType}!");
- Console.WriteLine("");
- Console.WriteLine("");
- Console.WriteLine("");
- string reward = "";
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have found a chest!");
- switch (chestType)
- {
- case 1:
- reward = "coins";
- int coinsGained = random.Next(50, 151);
- playerCoins += coinsGained;
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have been rewarded with {coinsGained} {reward}!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine("Entering next room...");
- System.Threading.Thread.Sleep(3000);
- Console.Clear();
- break;
- case 2:
- reward = "healing potion";
- playerHp += 20;
- if (playerHp > 100)
- {
- playerHp = 100;
- }
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have been rewarded with {reward} (+20 HP)!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine("Entering next room...");
- System.Threading.Thread.Sleep(3000);
- Console.Clear();
- break;
- case 3:
- reward = "magic book";
- playerMagic += 5;
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have been rewarded with {reward} (+5 magic)!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine("Entering next room...");
- System.Threading.Thread.Sleep(3000);
- Console.Clear();
- break;
- case 4:
- string armourType = "";
- int randomArmour = random.Next(1, 7);
- switch (randomArmour)
- {
- case 1:
- case 2:
- armourType = "Leather armour";
- if (playerArmour == "None")
- {
- playerArmour = armourType;
- playerDefence += 2;
- }
- break;
- case 3:
- case 4:
- armourType = "Rusty armour";
- if (playerArmour == "None" || playerArmour == "Leather armour")
- {
- playerArmour = armourType;
- playerDefence += 4;
- }
- break;
- case 5:
- armourType = "Iron armour";
- if (playerArmour == "None" || playerArmour == "Leather armour" || playerArmour == "Rusty armour")
- {
- playerArmour = armourType;
- playerDefence += 6;
- }
- break;
- case 6:
- armourType = "Steel armour";
- if (playerArmour == "None" || playerArmour == "Leather armour" || playerArmour == "Rusty armour" || playerArmour == "Iron armour")
- {
- playerArmour = armourType;
- playerDefence += 8;
- }
- break;
- }
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have been rewarded with {armourType} (Defence++)!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine("Entering next room...");
- System.Threading.Thread.Sleep(3000);
- Console.Clear();
- break;
- case 5:
- string weaponType = "";
- int randomWeapon = random.Next(1, 7);
- switch (randomWeapon)
- {
- case 1:
- case 2:
- weaponType = "Knife";
- if (playerWeapon == "None")
- {
- playerWeapon = weaponType;
- playerAttack += 2;
- }
- break;
- case 3:
- case 4:
- weaponType = "Spear";
- if (playerWeapon == "None" || playerWeapon == "Knife")
- {
- playerWeapon = weaponType;
- playerAttack += 4;
- }
- break;
- case 5:
- weaponType = "Axe";
- if (playerWeapon == "None" || playerWeapon == "Knife" || playerWeapon == "Spear")
- {
- playerWeapon = weaponType;
- playerAttack += 6;
- }
- break;
- case 6:
- weaponType = "Sword";
- if (playerWeapon == "None" || playerWeapon == "Knife" || playerWeapon == "Spear" || playerWeapon == "Axe")
- {
- playerWeapon = weaponType;
- playerAttack += 8;
- }
- break;
- }
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"You have been rewarded with {weaponType} (Attack++)!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine("Entering next room...");
- System.Threading.Thread.Sleep(3000);
- Console.Clear();
- break;
- }
- }
- else if (roomType == "Regeneration room")
- {
- Console.WriteLine($"Level:({playerLevel}) XP:({playerXp}) HP:({playerHp}) Attack:({playerAttack}) Defence:({playerDefence}) Magic:({playerMagic}) Coins:({playerCoins})");
- Console.WriteLine("");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"ROOM - {room}, {roomType}!");
- Console.WriteLine("");
- Console.WriteLine("");
- Console.WriteLine("");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("Congratulations, you have entered a regeneration room!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("Your health has been fully restored!");
- playerHp = 100;
- System.Threading.Thread.Sleep(1000);
- Console.Clear();
- }
- else if (roomType == "Shop room")
- {
- bool exitShop = false;
- int productPrice = 0;
- while (!exitShop)
- {
- Console.WriteLine($"Level:({playerLevel}) XP:({playerXp}) HP:({playerHp}) Attack:({playerAttack}) Defence:({playerDefence}) Magic:({playerMagic}) Coins:({playerCoins})");
- Console.WriteLine("");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"ROOM - {room}, {roomType}!");
- Console.WriteLine("");
- Console.WriteLine("");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have entered the shop!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("The shop can offer:");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("1 - Healing potions (80 coins)");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("2 - Magic books (200 coins)");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("3 - Armours (select to view)");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("4 - Weapons (select to view)");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("5 - Exit shop");
- System.Threading.Thread.Sleep(1000);
- Console.Write("You decide to buy: ");
- int shopChoice = int.Parse(Console.ReadLine());
- switch (shopChoice)
- {
- case 1:
- productPrice = 80;
- if (playerCoins >= productPrice)
- {
- playerHp += 20;
- if (playerHp > 100)
- {
- playerHp = 100;
- }
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have bought a healing potion!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have slightly recovered your health!");
- playerCoins -= productPrice;
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("You do not have enough coins to buy this!");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- }
- break;
- case 2:
- productPrice = 200;
- if (playerCoins >= productPrice)
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have bought a magic book!");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("Your magic abilities have increased!");
- playerCoins -= productPrice;
- Console.Clear();
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You do not have enough coins to buy this!");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- }
- break;
- case 3:
- string armourType = "";
- int price = 0;
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("The shop can offer this armour types:");
- Console.WriteLine("1 - Leather armour (200 coins)");
- Console.WriteLine("2 - Rusty armour (400 coins)");
- Console.WriteLine("3 - Iron armour (600 coins)");
- Console.WriteLine("4 - Steel armour (800 coins)");
- Console.WriteLine("5 - Go back");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.Write("Your choice is: ");
- int choice = int.Parse(Console.ReadLine());
- switch (choice)
- {
- case 1:
- price = 200;
- armourType = "Leather armour";
- if (playerCoins >= price)
- {
- if (playerArmour == "None")
- {
- playerArmour = armourType;
- playerDefence += 2;
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"Congratulations, you have bought {armourType}!");
- playerCoins -= price;
- }
- else if (playerArmour == "Leather armour")
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You already have this armour!");
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have a better armour equipped already!");
- }
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- break;
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You do not have enough coins to buy this!");
- Console.Clear();
- }
- break;
- case 2:
- price = 400;
- if (playerCoins >= price)
- {
- if (playerArmour == "None" || playerArmour == "Leather armour")
- {
- playerArmour = armourType;
- Console.WriteLine("");
- playerDefence += 4;
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"Congratulations, you have bought {armourType}!");
- playerCoins -= price;
- }
- else if (playerArmour == "Rusty armour")
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You already have this armour!");
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have a better armour equipped already!");
- }
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- break;
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You do not have enough coins to buy this!");
- Console.Clear();
- }
- break;
- case 3:
- price = 600;
- if (playerCoins >= price)
- {
- if (playerArmour == "None" || playerArmour == "Leather armour" || playerArmour == "Rusty armour")
- {
- playerArmour = armourType;
- Console.WriteLine("");
- playerDefence += 6;
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"Congratulations, you have bought {armourType}!");
- playerCoins -= price;
- }
- else if (playerArmour == "Iron armour")
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You already have this armour!");
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have a better armour equipped already!");
- }
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- break;
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You do not have enough coins to buy this!");
- Console.Clear();
- }
- break;
- case 4:
- price = 800;
- if (playerCoins >= price)
- {
- if (playerArmour == "None" || playerArmour == "Leather armour" || playerArmour == "Rusty armour" || playerArmour == "Iron armour")
- {
- playerArmour = armourType;
- Console.WriteLine("");
- playerDefence += 8;
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"Congratulations, you have bought {armourType}!");
- playerCoins -= price;
- }
- else if (playerArmour == "Steel armour")
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You already have this armour!");
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have a better armour equipped already!");
- }
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- break;
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You do not have enough coins to buy this!");
- Console.Clear();
- }
- break;
- case 5:
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("Going back to shop...");
- System.Threading.Thread.Sleep(2000);
- exitShop = true;
- Console.Clear();
- break;
- }
- break;
- case 4:
- int weaponPrice = 0;
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("The shop can offer this weapon types:");
- Console.WriteLine("1 - Knife (200 coins)");
- Console.WriteLine("2 - Spear (400 coins)");
- Console.WriteLine("3 - Axe (600 coins)");
- Console.WriteLine("4 - Sword (800 coins)");
- Console.WriteLine("5 - Go back");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.Write("Your choice is: ");
- int weaponChoice = int.Parse(Console.ReadLine());
- string weaponType = "";
- switch (weaponChoice)
- {
- case 1:
- weaponPrice = 200;
- weaponType = "Knife";
- if (playerCoins >= weaponPrice)
- {
- if (playerWeapon == "None")
- {
- Console.WriteLine("");
- playerWeapon = "Knife";
- playerAttack += 2;
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"Congratulations, you have bought {weaponType}!");
- playerCoins -= weaponPrice;
- }
- else if (playerWeapon == "Knife")
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You already have this weapon!");
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have a better weapon equipped already!");
- }
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- break;
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You do not have enough coins to buy this!");
- Console.Clear();
- }
- break;
- case 2:
- weaponPrice = 400;
- weaponType = "Spear";
- if (playerCoins >= weaponPrice)
- {
- if (playerWeapon == "None" || playerWeapon == "Knife")
- {
- Console.WriteLine("");
- playerWeapon = "Spear";
- playerAttack += 4;
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"Congratulations, you have bought {weaponType}!");
- playerCoins -= weaponPrice;
- }
- else if (playerWeapon == "Spear")
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You already have this weapon!");
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have a better weapon equipped already!");
- }
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- break;
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You do not have enough coins to buy this!");
- Console.Clear();
- }
- break;
- case 3:
- weaponPrice = 600;
- weaponType = "Axe";
- if (playerCoins >= weaponPrice)
- {
- if (playerWeapon == "None" || playerWeapon == "Knife" || playerWeapon == "Spear")
- {
- Console.WriteLine("");
- playerWeapon = "Axe";
- playerAttack += 6;
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"Congratulations, you have bought {weaponType}!");
- playerCoins -= weaponPrice;
- }
- else if (playerWeapon == "Axe")
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You already have this weapon!");
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have a better weapon equipped already!");
- }
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- break;
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You do not have enough coins to buy this!");
- Console.Clear();
- }
- break;
- case 4:
- weaponPrice = 800;
- weaponType = "Sword";
- if (playerCoins >= weaponPrice)
- {
- if (playerWeapon == "None" || playerWeapon == "Knife" || playerWeapon == "Spear" || playerWeapon == "Axe")
- {
- Console.WriteLine("");
- playerWeapon = "Sword";
- playerAttack += 8;
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"Congratulations, you have bought {weaponType}!");
- playerCoins -= weaponPrice;
- }
- else if (playerWeapon == "Sword")
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You already have this weapon!");
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You have a better weapon equipped already!");
- }
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- break;
- }
- else
- {
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("You do not have enough coins to buy this!");
- Console.Clear();
- }
- break;
- case 5:
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("Going back to shop...");
- Console.Clear();
- break;
- }
- break;
- case 5:
- exitShop = true;
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("Leaving the shop...");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- break;
- }
- }
- }
- else if (roomType == "Final boss room")
- {
- int bossHp = 150;
- int bossAttack = 30;
- Console.WriteLine($"Level:({playerLevel}) XP:({playerXp}) HP:({playerHp}) Attack:({playerAttack}) Defence:({playerDefence}) Magic:({playerMagic}) Coins:({playerCoins})");
- Console.WriteLine("");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"ROOM - {room}, {roomType}!");
- Console.WriteLine("");
- Console.WriteLine("");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("Congratulations for reaching this far...");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("...You are about to enter the final room in the dungeon, but the hardest one too!");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("Ready or not the final boss comes!");
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine($"*** Welcome {playerName}, i have expected you! ***");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine("*** You don't look like a threat to me so i will make it easier for you... ***");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine("*** ...We will play a game of rock-paper-scissors. ***");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(3000);
- Console.WriteLine("** If you win i will remove my armour and weapons so your chances are not zero... ***");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(3000);
- Console.Clear();
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("1 - Rock");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("2 - Paper");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine("3 - Scissors");
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("");
- Console.Write("You choose: ");
- string choice = Console.ReadLine();
- string bossChoice = "";
- int bossRandom = random.Next(1, 4);
- switch (bossRandom)
- {
- case 1:
- bossChoice = "Rock";
- break;
- case 2:
- bossChoice = "Paper";
- break;
- case 3:
- bossChoice = "Scissors";
- break;
- }
- Console.WriteLine($"Boss has chosen: {bossChoice}");
- Console.WriteLine("");
- if ((choice == "Rock" && bossChoice == "Scissors") || (choice == "Paper" && bossChoice == "Rock") || (choice == "Scissors" && bossChoice == "Paper"))
- {
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("You have won! The boss drops his armour and weapons!");
- bossHp -= 50;
- }
- else if ((choice == "Rock" && bossChoice == "Paper") || (choice == "Paper" && bossChoice == "Scissors") || (choice == "Scissors" && bossChoice == "Rock"))
- {
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("You have lost! The boss keeps his equipment on!");
- }
- System.Threading.Thread.Sleep(2000);
- Console.Clear();
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine("*** Prepare for battle little human! ***");
- bool playerDead = false;
- bool bossDead = false;
- while (!playerDead && !bossDead)
- {
- bossHp -= playerAttack;
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"Boss health -{playerAttack}");
- if (bossHp <= 0)
- {
- bossDead = true;
- continue;
- }
- playerHp -= bossAttack;
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- Console.WriteLine($"Player health -{bossAttack}");
- if (playerHp <= 0)
- {
- playerDead = true;
- continue;
- }
- }
- Console.Clear();
- if (bossDead)
- {
- gameIsWon = true;
- string game = "GAME IS WON!";
- System.Threading.Thread.Sleep(2000);
- Console.WriteLine($"Congratulations {playerName}! You have killed the final boss and completed the dungeon");
- Console.WriteLine("");
- System.Threading.Thread.Sleep(1000);
- for (int i = 0; i < game.Length; i++)
- {
- char letter = game[i];
- System.Threading.Thread.Sleep(1000);
- Console.Write(letter);
- }
- break;
- }
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment