static void Main(string[] args) { Console.Title = "Dungeon of Tommorrow"; Console.WriteLine("WELCOME TO THE DUNGEON OF TOMORROOOWWW!!!"); //todo create player Weapon sword = new Weapon("Sword of Poop", 35, 45, 75, false); Player player = new Player("Neil", 80, 40, 75, Race.Elf, sword, 75); //todo create do While bool exit = false; do { //todo create a room Console.WriteLine(GetRoom()); //todo create monster Dragon d1 = new Dragon(); Dragon d2 = new Dragon("Undead Dragon", 25, 25, 25, 50, 20, 2, " its bones are melting away", true); Yeti y1 = new Yeti(); HeWhoShallNotBeNamed h1 = new HeWhoShallNotBeNamed(); Gargoyles g1 = new Gargoyles(); Shredder s1 = new Shredder(); Kraken k1 = new Kraken(); Frankenstein f1 = new Frankenstein(); CookieMonster c1 = new CookieMonster(); bool reload = false; Monster[] monsters = { d2, s1, d1, d1, y1, g1, g1, g1, g1, c1, c1, c1, c1, f1, f1, f1, k1, k1, h1, h1, y1, y1, d1, d1, d2, d1 }; Random rand = new Random(); Monster monster = monsters[rand.Next(monsters.Length)]; Console.WriteLine("\n in this room: " + monster.Name); do { //todo menu of choice #region MENU Console.WriteLine( "PLEASE CHOOSE AN ACTION:\n\n" + "\nA) Attack" + "\nR) RUN AWAY" + "\nC) Character Info" + "\nM) monster Info" + "\nX) Exit" + "\nEnter your choice: "); //todo catch the unser input string userChoice = Console.ReadLine().ToUpper(); //todo switch for user choice switch (userChoice) { case "A": // Console.WriteLine("Attack method goes here"); //todo handle if player wins //todo handle if player loses Combat.DoBattle(player, monster); if (monster.Life <= 0) { Console.WriteLine("\n you defrated a {0}", monster.Name); reload = true; } break; case "R": Console.WriteLine("RUN AWAY!!!"); //todo monster gers a free attack //todo load a new room Combat.DoAttack(monster, player); //free attack reload = true; break; case "C": Console.WriteLine("Character info"); //todo add players info to the screen Console.WriteLine(player); break; case "M": Console.WriteLine("monster info"); Console.WriteLine(monster); break; case "X": case "E": Console.WriteLine("ya ninny"); exit = true; break; default: Console.WriteLine("invalid choice. ya ninny!! try again"); break; }//end switch #endregion //todo:address players life if (player.Life <= 0) { Console.WriteLine("uhhh I got some bad news for you...you died\a"); exit = true; } } while (!reload && !exit); } while (!exit); }//end Main()
static void Main(string[] args) { Console.Title = "Dungeon of Secrets"; Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("][ ][ DUNGEON OF SECRETS ][ ][\n\n"); Console.ResetColor(); Console.WriteLine("Your journey begins...\n\n"); int score = 0; //Weapons Weapon sword = new Weapon(2, 8, "Broad Sword", 8, true); Weapon axe = new Weapon(3, 6, "Battle Axe", 10, true); Weapon mace = new Weapon(1, 10, "Bludgeoning Mace", 15, false); //Choose Weapon Console.WriteLine("As you make your way into the dark dungeon ahead, a glistening catches your eye.\n\n"); System.Threading.Thread.Sleep(4000); bool chosen = false; Weapon userWeapon = new Weapon(); do { Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("### Choose Your Weapon ###\n"); Console.ResetColor(); Console.WriteLine( "[S] Sword - It still looks sharp, but might require both hands to wield.\n" + "[A] Axe - This might do some damage, it will definitely require both hands to swing.\n" + "[M] Mace - A bit lighter, this could be used with one hand. Something just feels right about it.\n"); ConsoleKey weaponChoice = Console.ReadKey(true).Key; Console.Clear(); switch (weaponChoice) { case ConsoleKey.S: Console.WriteLine("It is heavy, but you're confident as you head further into the dungeon with your Broadsword...\n\n"); userWeapon = sword; chosen = true; break; case ConsoleKey.A: Console.WriteLine("After lifting the Battle Axe, a surge of courage flows through you as you turn towards the darkness...\n\n"); userWeapon = axe; chosen = true; break; case ConsoleKey.M: Console.WriteLine("Snatching up the bludgeoning Mace, you make your way deeper into the looming pit...\n\n"); userWeapon = mace; chosen = true; break; default: Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("Invalid weapon choice.\n"); Console.ResetColor(); break; } } while (!chosen); //Player Player player = new Player("Hero", 70, 2, 50, 50, Race.Human, userWeapon); System.Threading.Thread.Sleep(7000); Console.Clear(); bool exit = false; do { //Room Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine(GetRoom()); Console.ResetColor(); Console.WriteLine("Press any key to continue.\n"); Console.ReadKey(); Console.Clear(); //Monsters Skeleton skeleton = new Skeleton(); Vampire vampire = new Vampire("Vampire", 20, 20, 25, 10, 1, 10, "It's pale skin almost glows in the darkness. It moves silently."); Monster orc = new Monster("Orc", 10, 10, 20, 20, 1, 7, "A pig-like disgusting creature that smells of rotting flesh."); Monster rat = new Monster("Rat", 8, 8, 15, 10, 1, 5, "More than your average rat. It looks rabbid to say the least..."); Monster[] monsters = { skeleton, vampire, orc, rat }; Random random = new Random(); int randomMonster = random.Next(monsters.Length); Monster monster = monsters[randomMonster]; Console.WriteLine("A MONSTER APPEARS! : " + monster.Name + "\n"); bool reload = false; do { //User Menu Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.Write("### Please Choose an Action ###\n\n"); Console.ResetColor(); Console.Write( "[A] Atack\n" + "[R] Run Away\n" + "[P] Player Info\n" + "[M] Monster Info\n" + "[X] Exit \n\n" + "Monsters Defeated: {0}\n\n", score); ConsoleKey userChoice = Console.ReadKey(true).Key; Console.Clear(); //Action switch (userChoice) { case ConsoleKey.A: case ConsoleKey.Enter: //ease of use Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("### Attack ###\n"); Console.ResetColor(); Combat.DoBattle(player, monster); if (monster.Life <= 0) { //find health potion chance +10 life Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("You defeated {0}!!\n\n", monster.Name); Console.ResetColor(); //FF7 Fanfare Console.Beep(987, 53); Thread.Sleep(53); Console.Beep(987, 53); Thread.Sleep(53); Console.Beep(987, 53); Thread.Sleep(53); Console.Beep(987, 428); Console.Beep(784, 428); Console.Beep(880, 428); Console.Beep(987, 107); Thread.Sleep(214); Console.Beep(880, 107); Console.Beep(987, 857); reload = true; score++; } break; case ConsoleKey.R: Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("### Run Away ###\n"); Console.ResetColor(); Console.WriteLine($"{monster.Name} attacks you as you run away!\n"); System.Threading.Thread.Sleep(500); Combat.DoAttack(monster, player); System.Threading.Thread.Sleep(2500); reload = true; break; case ConsoleKey.P: case ConsoleKey.H: //hero Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("### Player Information ###\n"); Console.ResetColor(); Console.WriteLine(player); break; case ConsoleKey.M: Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("### Monster Information ###\n"); Console.ResetColor(); Console.WriteLine(monster); break; case ConsoleKey.X: case ConsoleKey.Q: //quit case ConsoleKey.E: //exit case ConsoleKey.Escape: //ease of use Console.WriteLine($"TOTAL MONSTERS DEFATED: {score}\n"); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("Thanks for playing!\n"); Console.ResetColor(); exit = true; break; default: Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("Unrecognized selection. Please try again.\n"); Console.ResetColor(); break; } //Player Life if (player.Life <= 0) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("YOU HAVE DIED.\n"); Console.ResetColor(); //console beep sad sound exit = true; } } while (!reload && !exit); } while (!exit); }//end Main
static void Main(string[] args) { Console.Title = "The Deathly Hallows"; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Welcome to the Wonderful World of Harry Potter!"); Console.ResetColor(); Console.WriteLine("You must explore and battle Death Eaters on your journey to discover\nThe Deathly Hallows and destroy Lord Voldemort's Horcruxes."); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Your adventure as Harry starts now...\n"); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("\"I solemnly swear that I am up to no good.\"\n"); Console.ResetColor(); #region Theme Song Console.Beep(493, 200); //B System.Threading.Thread.Sleep(125); Console.Beep(659, 300); //E System.Threading.Thread.Sleep(125); Console.Beep(783, 100); //G System.Threading.Thread.Sleep(125); Console.Beep(739, 200); //F# System.Threading.Thread.Sleep(125); Console.Beep(659, 400); //E System.Threading.Thread.Sleep(125); Console.Beep(987, 200); //B System.Threading.Thread.Sleep(125); Console.Beep(880, 600); //A System.Threading.Thread.Sleep(125); Console.Beep(739, 600); //F# System.Threading.Thread.Sleep(125); Console.Beep(659, 300); //E System.Threading.Thread.Sleep(125); Console.Beep(783, 100); //G System.Threading.Thread.Sleep(125); Console.Beep(739, 200); //F# System.Threading.Thread.Sleep(125); Console.Beep(622, 400); //D# System.Threading.Thread.Sleep(125); Console.Beep(698, 200); //F System.Threading.Thread.Sleep(125); Console.Beep(493, 600); //B System.Threading.Thread.Sleep(200); System.Threading.Thread.Sleep(200); Console.Beep(493, 200); //B System.Threading.Thread.Sleep(125); Console.Beep(659, 300); //E System.Threading.Thread.Sleep(125); Console.Beep(783, 100); //G System.Threading.Thread.Sleep(125); Console.Beep(739, 200); //F# System.Threading.Thread.Sleep(125); Console.Beep(659, 400); //E System.Threading.Thread.Sleep(125); Console.Beep(987, 200); //B System.Threading.Thread.Sleep(125); Console.Beep(1174, 400); //D System.Threading.Thread.Sleep(125); Console.Beep(1108, 200); //Db System.Threading.Thread.Sleep(125); Console.Beep(1046, 400); //C System.Threading.Thread.Sleep(125); Console.Beep(830, 200); //Ab System.Threading.Thread.Sleep(125); Console.Beep(1046, 300); //C System.Threading.Thread.Sleep(125); Console.Beep(987, 100); //B System.Threading.Thread.Sleep(125); Console.Beep(932, 200); //A# System.Threading.Thread.Sleep(125); Console.Beep(466, 400); //A# System.Threading.Thread.Sleep(125); Console.Beep(783, 200); //G System.Threading.Thread.Sleep(125); Console.Beep(659, 600); //E System.Threading.Thread.Sleep(200); System.Threading.Thread.Sleep(200); Console.Beep(783, 200); //G System.Threading.Thread.Sleep(125); Console.Beep(987, 400); //B System.Threading.Thread.Sleep(125); Console.Beep(783, 200); //G System.Threading.Thread.Sleep(125); Console.Beep(987, 400); //B System.Threading.Thread.Sleep(125); Console.Beep(783, 200); //G System.Threading.Thread.Sleep(125); Console.Beep(1046, 400); //C System.Threading.Thread.Sleep(125); Console.Beep(987, 200); //B System.Threading.Thread.Sleep(125); Console.Beep(932, 400); //A# System.Threading.Thread.Sleep(125); Console.Beep(739, 200); //F# System.Threading.Thread.Sleep(125); Console.Beep(783, 300); //G System.Threading.Thread.Sleep(125); Console.Beep(987, 100); //B System.Threading.Thread.Sleep(125); Console.Beep(932, 200); //A# System.Threading.Thread.Sleep(125); Console.Beep(466, 400); //A# System.Threading.Thread.Sleep(125); Console.Beep(493, 200); //B System.Threading.Thread.Sleep(125); Console.Beep(987, 600); //B System.Threading.Thread.Sleep(200); System.Threading.Thread.Sleep(200); Console.Beep(783, 200); //G System.Threading.Thread.Sleep(125); Console.Beep(987, 400); //B System.Threading.Thread.Sleep(125); Console.Beep(783, 200); //G System.Threading.Thread.Sleep(125); Console.Beep(987, 400); //B System.Threading.Thread.Sleep(125); Console.Beep(783, 200); //G System.Threading.Thread.Sleep(125); Console.Beep(1174, 400); //D System.Threading.Thread.Sleep(125); Console.Beep(1108, 200); //Db System.Threading.Thread.Sleep(125); Console.Beep(1046, 400); //C System.Threading.Thread.Sleep(125); Console.Beep(830, 200); //Ab System.Threading.Thread.Sleep(125); Console.Beep(1046, 300); //C System.Threading.Thread.Sleep(125); Console.Beep(987, 100); //B System.Threading.Thread.Sleep(125); Console.Beep(932, 200); //A# System.Threading.Thread.Sleep(125); Console.Beep(932, 400); //A# System.Threading.Thread.Sleep(125); Console.Beep(783, 200); //G System.Threading.Thread.Sleep(125); Console.Beep(659, 1200); //E System.Threading.Thread.Sleep(125); #endregion int score = 0; // 1. Create a weapon Weapon wand = World.ItemByID(World.ITEM_ID_WAND) as Weapon; //TODO 2. Create a player Player wizard = new Player("Harry Potter", 50, 5, 50, 50, 0, House.Gryffindor, wand); //3. Create a loop for the room and enemy #region Room & Enemy Loop bool exit = false; do { //4. Create a room //Console.WriteLine(GetRoom()); Location start = World.LocationByID(World.LOCATION_ID_HOME); Console.WriteLine(start.Description); //TODO 5. Create an enemy //Enemy enemy = new Enemy(1, "Rat", 20, 20, 5, 5, "Rat", 3, 1, 5); Random rand = new Random(); int randNbr = rand.Next(World.Enemies.Count); Enemy enemy = World.Enemies[randNbr]; Console.WriteLine("\nIn this room: " + enemy.Name + "\n"); //6. Create a loop for the menu #region Menu Loop bool reload = false; do { //7. Create a menu #region Menu Switch Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Please choose an action:"); Console.ResetColor(); Console.WriteLine("A) Attack\nR) Run Away\nW) Wizard Info\nD) Death Eater Info\nX) Exit"); Console.ResetColor(); //8. Catch the user choice ConsoleKey userChoice = Console.ReadKey(true).Key; //9. Clear the console Console.Clear(); //TODO 10. Build out the switch for user choice switch (userChoice) { case ConsoleKey.A: //TODO 11. Handle an attack sequence //if (wizard.PlayerHouse == House.Gryffindor) //{ // Combat.DoAttack(wizard, enemy); //} Combat.DoBattle(wizard, enemy); Console.WriteLine(); //12. Handle if the player wins if (enemy.Life <= 0) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("You defeated {0}!\n", enemy.Name); wizard.AddExperiencePoints(enemy.RewardExperiencePoints); Console.WriteLine("You earned {0} Experience Points!\n", enemy.RewardExperiencePoints); Console.ResetColor(); reload = true; score++; } break; case ConsoleKey.R: Console.WriteLine("RUN AWAY!!!"); //13. Handle Enemy getting a free attack Console.WriteLine($"{enemy.Name} attacks as you flee!"); Combat.DoAttack(enemy, wizard); //free attack Console.WriteLine(); //14. Handle exiting the inner loop and getting a new room reload = true; //exiting the inner loop and will get a new room and monster break; case ConsoleKey.W: //15. Print out player info Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Wizard Info"); Console.ResetColor(); Console.WriteLine(wizard); Console.WriteLine("Death Eaters Defeated: " + score + "\n"); break; case ConsoleKey.D: //16. Print out enemy info Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Death Eater Info"); Console.ResetColor(); Console.WriteLine(enemy); break; case ConsoleKey.X: case ConsoleKey.E: Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("\"Mischief Managed!\"\n"); Console.Beep(); Console.ResetColor(); //Handle exiting both loops exit = true; break; default: Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("\"Oh, honestly, don't you read?\" Try again.\n"); Console.ResetColor(); break; } #endregion //17. Check the player's life before continuing if (wizard.Life <= 0) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("\"After all, to the well-organized mind, death is but the next great adventure.\"\a"); Console.ResetColor(); exit = true; //break out of both loops } } while (!exit && !reload); #endregion } while (!exit); #endregion Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("You defeated " + score + " Death Eater" + ((score == 1) ? "." : "s.")); Console.ResetColor(); Console.WriteLine(); }
static void Main(string[] args) { Console.Title = "SAO DnD Project"; Console.WriteLine("Welcome to the castle floating in the sky... Aincrad"); int levelsBeat = 0; bool usedSwordSkill = false; bool usedHealing = false; Console.WriteLine("Please enter the name you wish to go by in the game"); string playerName = Console.ReadLine(); // 1. Create the player - need to learn custom classes // 2. Create a weapon Weapon LongSword = new Weapon(1, 8, "Long Sword", 10, false); Weapon GreatSword = new Weapon(6, 15, "Greatsword", 5, true); Weapon Dagger = new Weapon(1, 4, "Dagger", 25, false); Weapon MaceandShield = new Weapon(3, 10, "Mace and Shield", 15, true); Console.WriteLine("Choose a weapon type you would like to use on your quest to clear the game\nLongsword 1\nGreatsword 2\nDagger 3\nMace and Shield 4"); string weaponChoice = Console.ReadLine().ToUpper(); bool agile = false; Weapon chosenWeapon = null; bool hasChosenWeapon = false; do { { switch (weaponChoice) { case "1": case "LONGSWORD": case "L": chosenWeapon = LongSword; hasChosenWeapon = true; break; case "2": case "GREATSWORD": case "G": chosenWeapon = GreatSword; hasChosenWeapon = true; break; case "3": case "DAGGER": case "D": chosenWeapon = Dagger; agile = true; hasChosenWeapon = true; break; case "4": case "MACEANDSHIELD": case "M": chosenWeapon = MaceandShield; hasChosenWeapon = true; break; default: Console.WriteLine("Input not recognized. Please enter a correct response"); hasChosenWeapon = false; break; } } } while (hasChosenWeapon == false); Player player = new Player(playerName, 10, 15, 20, 20, chosenWeapon); int playerLevel = 1; if (chosenWeapon == LongSword) { player.HitChance = 50; player.Block = 15; player.Life = 15; player.MaxLife = 15; } if (chosenWeapon == GreatSword) { player.HitChance = 40; player.Block = 10; player.Life = 20; player.MaxLife = 20; } if (chosenWeapon == Dagger) { player.HitChance = 60; player.Block = 20; player.Life = 12; player.MaxLife = 12; } if (chosenWeapon == MaceandShield) { player.HitChance = 35; player.Block = 30; player.Life = 30; player.MaxLife = 30; } //3. Create a loop for the room and monster bool exit = false; do { // 4. Create a room Console.WriteLine(GetRoom()); // 5. Create a monster Skeleton r1 = new Skeleton(); //uses the default ctor which sets some default values Skeleton r2 = new Skeleton("Skeleton Hero", 30, 35, 18, 18, 3, 7, "A hero from a forgotten realm, risen from his grave."); Boar r3 = new Boar(); Boar r4 = new Boar("Dire Boar", 20, 35, 20, 20, 2, 8, "A boar transformed by it's incredible rage, truly a dangerous foe"); KoboldLord r5 = new KoboldLord(); //all of our child monsters are of type mosnster so we can store them in an array Monster[] monsters = { r1, r1, r2, r3, r3, r4, r5 }; //randomly select a monster Random rand = new Random(); int randNbr = rand.Next(monsters.Length); Monster monster = monsters[randNbr]; Console.WriteLine("\nIn this room you find " + monster.Name); #region Menu Loop //TODO 6 Create a loop for menu of options bool reload = false; do { #region Menu Switch //7. Create a menu of options Console.WriteLine("\nPlease choose an action:\nA) Attack\nS) Sword Skill \nR) Run Away\nP) Player Info\nM) Monster Info\nH) Heal\nX) Exit\n"); //8. cathc the the choice ConsoleKey userChoice = Console.ReadKey(true).Key; //9. Clear the console Console.Clear(); //10. Build switch for user choice switch (userChoice) { case ConsoleKey.A: //11 handlle attack sequence if (agile == true) { Combat.DoAttack(player, monster); } Combat.DoBattle(player, monster); //12 handle player win if (monster.Life <= 0) { //monster is dead //could put in item drop, xp, or life gain playerLevel += 1; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nWith the {0} Slain, you make your way 1 floor closer to the end.\n", monster.Name); Console.ResetColor(); player.Life = player.MaxLife; usedSwordSkill = false; usedHealing = false; reload = true; //breaks us out of the inner loop but no the outer, will allow the player to continue on their journey levelsBeat++; if (levelsBeat >= 1) { player.Life += 1; player.MaxLife += 1; player.Block += 1; player.HitChance += 1; } } break; case ConsoleKey.S: if (usedSwordSkill == true) { Console.WriteLine("You cannot use another sword skill during this combat."); } else { Console.WriteLine("You unleash a sword skill to do more damage"); player.EquippedWeapon.MinDamage += 10; player.EquippedWeapon.MaxDamage += 10; player.EquippedWeapon.BonusHitChance += 15; Combat.DoAttack(player, monster); player.EquippedWeapon.MinDamage -= 10; player.EquippedWeapon.MaxDamage -= 10; player.EquippedWeapon.BonusHitChance -= 15; usedSwordSkill = true; } if (monster.Life <= 0) { //monster is dead //could put in item drop, xp, or life gain playerLevel += 1; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nWith the {0} Slain, you make your way 1 floor closer to the end.\n", monster.Name); Console.ResetColor(); player.Life = player.MaxLife; usedSwordSkill = false; usedHealing = false; reload = true; //breaks us out of the inner loop but no the outer, will allow the player to continue on their journey levelsBeat++; if (levelsBeat >= 1) { player.Life += 1; player.MaxLife += 1; player.Block += 1; player.HitChance += 1; } } break; case ConsoleKey.R: Console.WriteLine("So it seems your cowardly instincts have prevailed, how unfortunate."); //todo handle the free attack Console.WriteLine($"{monster.Name} attempts to attack as you run"); Combat.DoAttack(monster, player); Console.WriteLine(); usedSwordSkill = false; usedHealing = false; //14 exit inner loop and get a new room reload = true; break; case ConsoleKey.P: // 15. print out player info Console.WriteLine("Player info"); Console.WriteLine(playerName); Console.WriteLine(player); Console.WriteLine("You are level " + playerLevel); Console.WriteLine("Floors Cleared: " + levelsBeat); break; case ConsoleKey.M: //todo print out monster info Console.WriteLine("monster info"); Console.WriteLine(monster); break; case ConsoleKey.H: if (usedHealing == true) { Console.WriteLine("You cannot use another Healing Crystal during this combat."); } else { player.Life = player.MaxLife; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("You take out a Healing Crystal and use it"); Console.ResetColor(); usedHealing = true; } break; case ConsoleKey.X: case ConsoleKey.E: Console.WriteLine("After unequipping your weapon, you slowly end up rotting away in the Town of Beginnings"); exit = true; break; default: Console.WriteLine("learn to type bruh"); break; } #endregion //todo 17 check life before continuing if (player.Life <= 0) { Console.WriteLine("As your Health Bar is Depleted your body disappears and your vision goes black\a"); exit = true; //break out of both loops } if (levelsBeat == 100) { Console.WriteLine("As you defeat the final enemy a giant Game Cleared sign appears before you and you open your eyes to see the real world\a"); exit = true; //break out of both loops } if (levelsBeat == 20 && levelsBeat == 40 && levelsBeat == 60 && levelsBeat == 80) { r1.Life += 5; r1.MaxLife += 5; r1.Block += 5; r1.HitChance += 5; r1.MinDamage += 2; r1.MaxDamage += 4; r2.Life += 5; r2.MaxLife += 5; r2.Block += 5; r2.HitChance += 5; r2.MinDamage += 2; r2.MaxDamage += 4; r3.Life += 3; r3.MaxLife += 3; r3.Block += 7; r3.HitChance += 3; r3.MinDamage += 3; r3.MaxDamage += 5; r4.Life += 4; r4.MaxLife += 4; r4.Block += 8; r4.HitChance += 4; r4.MinDamage += 3; r4.MaxDamage += 5; r5.Life += 5; r5.MaxLife += 5; r5.Block += 10; r5.HitChance += 5; r5.MinDamage += 1; r5.MaxDamage += 3; } if (levelsBeat == 25 && chosenWeapon == LongSword) { Console.WriteLine("On the 25th floor you find a Dark Steel Longsword and Equip it.\n"); player.EquippedWeapon.MinDamage += 3; player.EquippedWeapon.MaxDamage += 4; player.EquippedWeapon.BonusHitChance += 5; } if (levelsBeat == 50 && chosenWeapon == LongSword) { Console.WriteLine("On the 50th floor you find a Holy Steel Longsword and Equip it.\n"); player.EquippedWeapon.MinDamage += 4; player.EquippedWeapon.MaxDamage += 4; player.EquippedWeapon.BonusHitChance += 5; } if (levelsBeat == 75 && chosenWeapon == LongSword) { Console.WriteLine("On the 75th floor you find the Elucidator and Equip it.\n"); player.EquippedWeapon.MinDamage += 4; player.EquippedWeapon.MaxDamage += 4; player.EquippedWeapon.BonusHitChance += 5; } if (levelsBeat == 25 && chosenWeapon == GreatSword) { Console.WriteLine("On the 25th floor you find a Dark Steel Greatsword and Equip it.\n"); player.EquippedWeapon.MinDamage += 3; player.EquippedWeapon.MaxDamage += 4; player.EquippedWeapon.BonusHitChance += 5; } if (levelsBeat == 50 && chosenWeapon == GreatSword) { Console.WriteLine("On the 50th floor you find a Holy Steel Greatsword and Equip it.\n"); player.EquippedWeapon.MinDamage += 4; player.EquippedWeapon.MaxDamage += 4; player.EquippedWeapon.BonusHitChance += 5; } if (levelsBeat == 75 && chosenWeapon == GreatSword) { Console.WriteLine("On the 75th floor you find the Doomblade and Equip it.\n"); player.EquippedWeapon.MinDamage += 4; player.EquippedWeapon.MaxDamage += 4; player.EquippedWeapon.BonusHitChance += 5; } if (levelsBeat == 25 && chosenWeapon == Dagger) { Console.WriteLine("On the 25th floor you find a Dark Steel Dagger and Equip it.\n"); player.EquippedWeapon.MinDamage += 3; player.EquippedWeapon.MaxDamage += 4; player.EquippedWeapon.BonusHitChance += 5; } if (levelsBeat == 50 && chosenWeapon == LongSword) { Console.WriteLine("On the 50th floor you find a Holy Steel Dagger and Equip it.\n"); player.EquippedWeapon.MinDamage += 4; player.EquippedWeapon.MaxDamage += 4; player.EquippedWeapon.BonusHitChance += 5; } if (levelsBeat == 75 && chosenWeapon == LongSword) { Console.WriteLine("On the 75th floor you find the Assassin's Dirk and Equip it.\n"); player.EquippedWeapon.MinDamage += 4; player.EquippedWeapon.MaxDamage += 4; player.EquippedWeapon.BonusHitChance += 5; } if (levelsBeat == 25 && chosenWeapon == MaceandShield) { Console.WriteLine("On the 25th floor you find a Dark Steel Mace and Shield and Equip it.\n"); player.EquippedWeapon.MinDamage += 3; player.EquippedWeapon.MaxDamage += 4; player.EquippedWeapon.BonusHitChance += 5; } if (levelsBeat == 50 && chosenWeapon == MaceandShield) { Console.WriteLine("On the 50th floor you find a Holy Steel Mace and Shield and Equip it.\n"); player.EquippedWeapon.MinDamage += 4; player.EquippedWeapon.MaxDamage += 4; player.EquippedWeapon.BonusHitChance += 5; } if (levelsBeat == 75 && chosenWeapon == MaceandShield) { Console.WriteLine("On the 75th floor you find the Demon's Cudgel and Shield and Equip them.\n"); player.EquippedWeapon.MinDamage += 4; player.EquippedWeapon.MaxDamage += 4; player.EquippedWeapon.BonusHitChance += 5; } } while (!exit && !reload); #endregion } while (!exit); //while exit is false it will loop Console.WriteLine("You cleared " + levelsBeat + " floor" + (levelsBeat == 1 ? "." : "s.")); }
static void Main(string[] args) { #region Yahrnam Console.Title = "Dane's Dungeon"; Console.WriteLine("---------------------------------------You awake in a place called Yharnam---------------------------------------------"); Console.WriteLine(); Console.WriteLine("\nYharnam is an imposing and sprawling metropolis characterized by Gothic and Victorian architecture.\nYharnam's Victorian architecture is reminiscent of late 19th Century European cities including Paris, Edinburgh, \nCologne and London. \nThe town appears rather grim and decadent and has been ravaged by a mysterious plague, becoming infested with dangerous beasts and demented citizens. \nEverywhere you look, there is what seems to be a path. You follow one.."); Console.WriteLine(); int score = 0; #endregion #region Weapons Weapon axe = new Weapon(16, 1, "Hunter's Axe", 10, false);//Player has to have weapon so we have to make a weapon first. Weapon cleaver = new Weapon(20, 1, "Saw Cleaver", 10, false); Weapon bm = new Weapon(15, 3, "Blades of Mercy", 20, true); Weapon hm = new Weapon(23, 1, "Holy Moonlight Sword", 2, true); Weapon kirk = new Weapon(19, 2, "KirkHammer", 15, true); Weapon lhb = new Weapon(22, 1, "LudWigs Holy Blade", 10, true); Weapon[] Weapons = { axe, cleaver, bm, hm, kirk, lhb }; Random rand = new Random(); int randomNbr = rand.Next(Weapons.Length); Weapon radWeapon = Weapons[randomNbr]; #endregion #region Hunters Player player = new Player("Night Hunter", 70, 5, 40, 40, Race.Beast, radWeapon); #endregion #region //TODO 2. Create a do while bool exit = false; do { //room desc Console.WriteLine(RoomDesc()); #endregion #region Beasts //Since all monsters are children of monster, we could store them in a monster[]. Amygdala amg = new Amygdala(); MoonPresence mp = new MoonPresence(); BloodStarvedBeast bsb = new BloodStarvedBeast(); TheOneReborn ob = new TheOneReborn(); ClericBeast cb = new ClericBeast(); Monster[] Monsters = { amg, mp, bsb, ob, cb }; //Randomly selsct a monster Random rand1 = new Random(); int randomNbr1 = rand1.Next(Monsters.Length); Monster monster = Monsters[randomNbr1]; //show momster in the room Console.WriteLine("\nThe Beast in front of you: " + monster.Name); #endregion #region User Menu bool reload = false; do { Console.WriteLine("\nPlease choose an action: \n" + "A) Attack the beast\n" + "R) Run\n" + "H) Hunter Info\n" + "B) Beast Info\n" + "E) Exit\n"); ConsoleKey userChoice = Console.ReadKey().Key; //The above line captures a single keystroke of user input // as a character value and allows us to deal with that single // value instead of a string. Console.Clear(); switch (userChoice) { case ConsoleKey.A: //TODO Build out combat functionality Combat.DoBattle(player, monster); if (monster.Life <= 0) { //its dead, and player has won //You could add some logic here for the player to get items, get life //back, or something else Console.WriteLine("\nYou defeated {0}!!\n", monster.Name); score++; //increases the score reload = true; //get a new room } break; case ConsoleKey.R: Console.WriteLine("Smart move, but the beast isn't happy.."); Combat.DoAttack(monster, player); Console.WriteLine(); reload = true; break; case ConsoleKey.H: Console.WriteLine(player); Console.WriteLine("Beasts slaughtered: " + score); break; case ConsoleKey.B: Console.WriteLine(monster); break; case ConsoleKey.E: case ConsoleKey.X: Console.WriteLine("You have chosen to exit the game. You weren't going to survive anyways."); Console.WriteLine("You defeated {0} Beast{1}", score, ((score == 1)? "." : "s.")); exit = true; break; default: Console.WriteLine("Invalid Response. Please try again"); break; }//endswitch if (player.Life <= 0) { Console.WriteLine("You defeated {0} monster{1}", score, ((score == 1) ? "." : "s.")); exit = true; } } while (!exit && !reload); } while (!exit); Console.WriteLine("YOU DIED"); #endregion // * ***DOWHILE inside DOWHILE*** //A. Attack the monster //**If they win, they go out of 1 do while** //B. Run away //*****Fall out of 1 do while, but not the other*** //*****If you choose to run, they hit you in the back**** //C. Charcater info //D. Monster info //E. Exit // *******Fall out of both do whiles****** // * *******Extras******* //1. Collect gems //2. Leveling up //3. Healing //4. Collect weapons // */ }//main
static void Main(string[] args) { //This is the program that will control the flow of the overall program (the experience of the user). All classes will be build in separate files and referred to in this program to allow us to use instances of the objects. Console.Title = "Forest Walker"; SpeechSynthesizer speech = new SpeechSynthesizer(); speech.SetOutputToDefaultAudioDevice(); Console.WriteLine("\n-=-=-= Welcome to ForestWalker =-=-=-\n" + @" __ .d$$b .' TO$;\ / : TP._; / _.; :Tb| / / ;j$j _.-' d$$$$ .' .. d$$$$; / / P' d$$$$P. |\ / ' .d$$$P' |\^'l .' `T$P^''''' : ._.' _.' ; `-.- '.-'-' ._. _.-'.-'' `.-' _____ ._ .-' - (.g$$$$$$$b. .' '' ^^ T$$$P ^) .(: _ / -' /.' /:/; ._.'-'`-' ')/ /;/; `-.- '..--'' ' / / ; .-' ..--'' -' : ..--''--.- ' (\ .-(\ ..--'' `-\(\/;` _. : ;`- :\ ; AWWWWOOOOOO"); var wolfHowl = new System.Media.SoundPlayer(); wolfHowl.SoundLocation = @"C:\Users\Student\Documents\Visual Studio 2017\Projects\03_CSF2\CSF2\DungeonApp\Dungeon\Resources\wolfHowl01.wav"; wolfHowl.PlaySync(); speech.Speak("Welcome to Forest Walker."); Console.WriteLine("\tWhat is your name, Traveler?"); string playerName = Console.ReadLine(); Console.Clear(); //Keep a running total variable for the user's score int score = 0; int monstersKilled = 0; Console.WriteLine("\tWelcome, {0}. You are about to embark on a spiritual journey through the North American forest.\nAn animal can be chosen to aid you on your journey.", playerName); Console.WriteLine(); //TODO 1. Create a Weapon and a Player Weapon dagger = new Weapon(1, 8, "Rusty Dagger", 8, false, "Sword", false, 10, false); Weapon bow = new Weapon(1, 8, "Short Bow", 2, false, "Bow", true, 15, true); Weapon club = new Weapon(5, 8, "Crude Club", 9, false, "Club", false, 0, false); Player player = new Player(playerName, 70, 2, 60, 60, Race.Human, bow); //Console.WriteLine(sword); - Commented out after testing ToString() return //TODO create a loop for finding animal spirit guides (one land one air?) //TODO create companions to choose from Companion wolf = new Companion("Lobo", 12, 7, 65, 20, 40, 40, Animal.Wolf, null, "A ferocious wolf with a powerful attack."); Companion bear = new Companion("Ben", 7, 4, 60, 40, 85, 85, Animal.Bear, null, "A great bear with a large health pool."); Companion deer = new Companion("Elliot", 5, 1, 50, 30, 30, 30, Animal.Deer, null, "A swift deer, he can help you escape if things look rough."); Companion bison = new Companion("Strongheart", 6, 2, 60, 60, 100, 100, Animal.Bison, null, "A mighty bison, low attack but his health pool is massive."); Companion horse = new Companion("Beau", 4, 1, 30, 90, 50, 50, Animal.Horse, null, "A sturdy steed, he is fantastic at blocking enemy attacks."); Companion mouse = new Companion("Ralph", 0, 0, 0, 100, 5, 5, Animal.Mouse, null, "A tiny mouse with an uncanny ability to dodge attacks and distract the enemy."); Companion raccoon = new Companion("Eddie", 3, 2, 90, 10, 20, 20, Animal.Raccoon, null, "A cheeky raccoon with high accuracy and a low block chance."); Companion skunk = new Companion("Pepe", 4, 2, 55, 40, 20, 20, Animal.Skunk, null, "This skunk is not a powerhouse but he can sometimes stink the enemy into submission."); Companion[] companions = { wolf, bear, deer, bison, horse, mouse, raccoon, skunk }; int companionChoice; repeat : Console.Write("\tEight animals now appear before you. In the stillness, you sense a purposeful patience in their demeanor.\n Some of these animals you may have caught glimpses or signs of in your journey earlier. Others you have not\n seen or heard until now. They all can aid you in some way, but not all of them will necessarily follow you.\n That is why you must choose your companions wisely.\n\nDo you understand? Y/N:"); tryAgain : string response = Console.ReadLine().ToUpper(); if (response == "Y" || response == "YES") { } else if (response == "N" || response == "NO") { Console.WriteLine("Then I will repeat the instructions. Please read carefully."); System.Threading.Thread.Sleep(3000); Console.Clear(); goto repeat; } else { Console.Write("Invalid input. Did you understand the instructions? Y/N: "); goto tryAgain; } chooseAnimal : Console.WriteLine("Choose your companion:\n" + "1) Lobo - wolf\n" + "2) Ben - bear\n" + "3) Elliott - deer\n" + "4) Strongheart - bison\n" + "5) Beau - horse\n" + "6) Ralph - mouse\n" + "7) Eddie - raccoon\n" + "8) Pepe - skunk\n"); string userNum = Console.ReadLine(); if (userNum == "1" || userNum == "2" || userNum == "3" || userNum == "4" || userNum == "5" || userNum == "6" || userNum == "7" || userNum == "8") { Console.Clear(); companionChoice = int.Parse(userNum); companionChoice--; Character companion = companions[companionChoice]; Console.WriteLine(companion); confirmChoice : Console.Write($"\nAre you sure you want to choose {companion.Name} as your companion?\nY/N:"); string confirm = Console.ReadLine().ToUpper(); if (confirm == "Y" || confirm == "YES") { Console.Clear(); } else if (confirm == "N" || confirm == "NO") { Console.Clear(); goto chooseAnimal; } else { Console.Clear(); Console.WriteLine("I need a yes or no answer."); goto confirmChoice; } } else { Console.WriteLine("Improper input. Please enter a value 1-8 to choose your companion."); goto chooseAnimal; } //TODONE 2. Create a loop for the room and monster bool exit = false; do { //TODO 3. Call a new room Console.WriteLine(GetRoom()); //TODONE 4. Create a monster Dragon d1 = new Dragon(); Dragon d2 = new Dragon("Toothless", 25, 25, 40, 10, 1, 12, "This is one bad dragon!", true); Orc o1 = new Orc(); Orc o2 = new Orc("gruk", 30, 30, 45, 20, 5, 7, "This brutish Orc is uglier than your average Orc, which is saying something!", true); Specter s1 = new Specter(); Specter s2 = new Specter("Bloody Bob", 20, 20, 50, 30, 2, 9, "A bloodthirsty specter darts toward you in a blind rage.", true); //Since Rabbit and other child classes are children of monster, all can be placed into an array of Monster objects Monster[] monsters = { d1, d1, d2, o1, o1, o1, o1, o1, o2, o2, s1, s1, s2 }; //Randomly select a monster from the array Random rand = new Random(); int randomNumber = rand.Next(monsters.Length); Monster monster = monsters[randomNumber]; Console.WriteLine("A monster appears! " + monster.Name); //TODO 5. Create a loop for the menu bool reload = false; do { //TODONE 6. Create the menu #region MENU Console.WriteLine("\n\nPlease choose an Action:\n" + "A) Attack\n" + "R) Run Away\n" + "P) Player Info\n" + "M) Monster Info\n" + "C) Companion Info\n" + "X) Exit\n\n" + $"Score: {score}\n\n"); #endregion //TODONE 7. Get User Choice #region UserChoice ConsoleKey userChoice = Console.ReadKey(true).Key; #endregion //TODONE 8. Clear the console after we get input from the user Console.Clear(); //TODO need to make program work without statement below Companion companion = companions[companionChoice]; //TODO 9. Build out the switch for userChoice #region Game Experience - Switch switch (userChoice) { case ConsoleKey.A: Console.WriteLine("Attack\n"); //TODO 10. Build attack logic and place here Combat.DoBattle(player, companion, monster); if (monster.Life <= 0) { //it's dead - you could put some logic here to have player get items, get life back , or something similar due to defeating the monster. Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\nYou killed {0}! The spirit you freed from the monster restores some of your health.\n", monster.Name); Console.ResetColor(); player.Life += monster.MaxLife / 4; score += monster.MaxLife - (player.MaxLife - player.Life); monstersKilled++; reload = true; //get a new room and monster if (monstersKilled < 10) { } else { Console.WriteLine($"" + $"\tAs you deal the final blow to {monster.Name}, {companion.Name} seems to leap in\n triumph at your accomplishment. The monsters have been vanquished, and their tortured\n souls are now free. As you meet {companion.Name}'s eyes, a great sense of confidence\n and strength rises up within you. You know you made the right choice, and that the\n {companion.Animal} is truly your animal guide." + $"\n\n\tYou snap awake in your bed, and glance at the alarm clock on the nightstand.\n It's 3:33 a.m. The dream of the forest was so vivid, so incredibly real. You close your eyes, and still can clearly see the approving gaze\n of {companion.Name}. You\n realize that image will be burned into your memory, and any time you need help you'll\n be able to call upon the spirit of the {companion.Animal} to guide you in the waking world. You roll over and drift back to sleep, and as you drift away a calming sense\n of security washes over you. All is well.\n\n" + $"Final score: {score}\n" + $"Monsters killed: {monstersKilled}"); exit = true; reload = false; } } break; case ConsoleKey.R: Console.WriteLine("Run for your life!"); //TODO 11. Build run away logic Console.WriteLine($"{monster.Name} attacks you as you run!\n"); Combat.DoAttack(monster, player); //load a new room and monster reload = true; break; case ConsoleKey.P: Console.WriteLine("Player Info"); //TODONE 12. Add Player Info Console.WriteLine(player); break; case ConsoleKey.M: Console.WriteLine("Monster Info"); //TODONE 13. Add Monster Info Console.WriteLine(monster); break; case ConsoleKey.C: Console.WriteLine("Companion Info"); Console.WriteLine(companion); break; case ConsoleKey.X: case ConsoleKey.E: Console.WriteLine("The forest can break even the most battle-hardened. Strengthen your resolve before entering these woods again."); exit = true; break; default: Console.WriteLine("That input was not recognized. Please choose a valid option.\n"); break; } #endregion if (player.Life <= 0) { Console.WriteLine($"" + $"\tAs the light fades, you turn to lock eyes with {companion.Name}. He looks sad,\n but stoic as your life fades away. You both gave your best. Perhaps the\n {companion.Animal} was not your proper animal guide." + $"\n\n\tYou snap awake in your bed, and glance at the alarm clock on the nightstand.\n It's 3:33 a.m. The dream of the forest was so vivid, so incredibly real. You lift your\n shirt and check your body for the wounds that just claimed you, just to make sure\n you aren't still bleeding out. You're fine, of course. Even still, the image of{monster.Name}\n hovering over you, the look in {companion.Name}'s eyes as you drew\n your last breath... You can feel the image is going to stick with you for quite some\n time." + $"\n\nMaybe you'll be able to settle back down to sleep, and one day again become the Forest Walker.\n\n" + $"Final score: {score}\n" + $"Monsters killed: {monstersKilled}"); exit = true; } //TODO 14. Handle Player Life } while (!reload && !exit); } while (!exit);//while exit is NOT TRUE keep in the loop }//end Main()