// -------- Gold Loot Program Randomizer arrays ---------- public void GoldLoot(Player player, SwitchBoard switchBoard, Obstacles obstacles, MonsterObstacle monsterObstacle, Reward reward, BattleSwitchBoard battleSwitchBoard, EnemyEncounters enemyEncounters, BattleEngine battleEngine, SoundFx soundFx) { Random Randomizer = new Random(); int[] GoldPieces = { 3, 6, 9, 12, 15, 18, 21 }; //player.PlayerStats(); int GoldIndex = Randomizer.Next(0, GoldPieces.Length); // randomly picks a number between chosen range Array Console.Write("You Get " + GoldPieces[GoldIndex] + " Gold pieces as reward "); Thread.Sleep(500); soundFx.LootSound(); player.PlayerGold += GoldPieces[GoldIndex]; Console.WriteLine("Your Current Gold is now: " + player.PlayerGold); Console.ForegroundColor = ConsoleColor.Gray; switchBoard.TwoPaths(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); }
/* -------------------------- Main Code ------------------------------- */ static void Main(string[] args) { Player player = new Player(); TextMethods textMethods = new TextMethods(); SwitchBoard switchBoard = new SwitchBoard(); Reward reward = new Reward(); Obstacles obstacles = new Obstacles(); BattleEngine battleEngine = new BattleEngine(); BattleSwitchBoard battleSwitchBoard = new BattleSwitchBoard(); MonsterObstacle monsterObstacle = new MonsterObstacle(); EnemyEncounters enemyEncounters = new EnemyEncounters(); SoundFx soundFx = new SoundFx(); //GameTitle textMethods.GameTitle(); //Game start song soundFx.IntroMusic(); player.PlayerStats(); Console.WriteLine("your stats are: "); Console.WriteLine("Health: " + player.PlayerHP); Console.WriteLine("Damage: " + player.PlayerDMG); Console.WriteLine("Your Gold is: " + player.PlayerGold); //StartGameText Method Console.WriteLine(textMethods.StartGameText()); Console.WriteLine(""); bool gameloop = true; while (gameloop) { //TwoPaths Function switchBoard.TwoPaths(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); //Continue On Method Console.WriteLine(textMethods.ContinueOn()); } }
/***************** Attack Switc ********************/ public void MonsterAttackSwitch(EnemyEncounters enemyEncounters, BattleEngine battleEngine, Player player, Reward reward, Obstacles obstacles, MonsterObstacle monsterObstacle, SwitchBoard switchBoard, BattleSwitchBoard battleSwitchBoard, SoundFx soundFx)//Parametere til at føre data vidre { Console.WriteLine("The Monster Looks at you with a mean gaze"); Console.WriteLine("monster got hp: " + enemyEncounters.MonsterHP); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\nAttack? \nRunaway"); Console.ForegroundColor = ConsoleColor.Gray; string userResponse = Console.ReadLine(); switch (userResponse.ToLower()) { case "attack": case "atk": case "attk": case "atck": case "a": Console.WriteLine("\nYou attack"); battleEngine.BattleEngine_Monster(enemyEncounters, player, reward, obstacles, switchBoard, monsterObstacle, battleSwitchBoard, battleEngine, soundFx); break; case "runaway": case "run": case "r": Console.WriteLine("You Run away"); soundFx.RunAwaySound(); Console.WriteLine("But You wont get far"); Console.WriteLine(""); switchBoard.TwoPaths(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); break; default: Console.WriteLine("Sorry didn't understand that"); MonsterAttackSwitch(enemyEncounters, battleEngine, player, reward, obstacles, monsterObstacle, switchBoard, battleSwitchBoard, soundFx); break; } }
/****** TwoPaths Switch ******/ public void TwoPaths(MonsterObstacle monsterObstacle, SwitchBoard switchBoard, Obstacles obstacles, Player player, Reward reward, BattleSwitchBoard battleSwitchBoard, EnemyEncounters enemyEncounters, BattleEngine battleEngine, SoundFx soundFx) { Console.WriteLine("\nAs you look down the Winter forrest walkway. \nHidden in the middle of the thick trees and snow. You notice two paths that you can choose from"); Console.WriteLine("\nDo you take the path to the right? \nOr The Path to the left? \nCheck your stats \nMaybe you wanna turnback and end your adventuring days right there?"); Console.WriteLine("\nMake your Choice: "); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Left? \nRight? \nView your stats(stats)? \nTurnback?"); Console.ForegroundColor = ConsoleColor.Gray; string userResponse = Console.ReadLine(); switch (userResponse.ToLower()) { case "left": case "l": Console.WriteLine("\nA True Hero always Turn Right first \nbut then again who ever said you are a Hero... \nyou take the left path"); obstacles.AnObstacle(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); break; case "right": case "r": Console.WriteLine("\nYou take the right path \nYou walk proudly for a few minutes when suddently."); obstacles.AnObstacle(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); break; case "view stats": case "stats": case "s": Console.ForegroundColor = ConsoleColor.Cyan; //PlayerStats Console.WriteLine("Current Stats"); Console.WriteLine("Your Hp amount is: " + player.PlayerHP); Console.WriteLine("Your DMG capability is: " + player.PlayerDMG + "(base 1D6)"); Console.WriteLine("Your gold: " + player.PlayerGold); Console.ForegroundColor = ConsoleColor.Gray; break; case "turnback": case "back": case "b": case "t": Console.WriteLine("\nYou Decide that this is enough adventuring in this forsaken winter cold for today. \nSo you turn back and End the game"); Environment.Exit(0); break; default: Console.WriteLine("I'm sorry, I didn't understand that!"); TwoPaths(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); break; } }
/****** Battle Engine der skal styrer alle fights ******/ public void BattleEngine_Monster(EnemyEncounters enemyEncounters, Player player, Reward reward, Obstacles obstacles, SwitchBoard switchBoard, MonsterObstacle monsterObstacle, BattleSwitchBoard battleSwitchBoard, BattleEngine battleEngine, SoundFx soundFx)//Parametere til at føre data vidre { bool IsrunningPlayer = true; while (IsrunningPlayer) { bool IsrunningMonster = true; Console.WriteLine("monster got hp: " + enemyEncounters.MonsterHP); soundFx.AttackSound(); Console.Write("You do " + player.PlayerDMG + " amount of dmg"); Console.WriteLine(); if (enemyEncounters.MonsterHP < player.PlayerDMG) // Lower than varibel { Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("\nThe Monster lies Bleeding violently at your feet "); soundFx.EnemyKillSound(); reward.GoldLoot(player, switchBoard, obstacles, monsterObstacle, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); Console.ForegroundColor = ConsoleColor.Gray; IsrunningPlayer = false; } if (enemyEncounters.MonsterHP == player.PlayerDMG) // Equal varibel { Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("\nThe Monster dies "); soundFx.EnemyKillSound(); reward.GoldLoot(player, switchBoard, obstacles, monsterObstacle, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); Console.ForegroundColor = ConsoleColor.Gray; IsrunningPlayer = false; } else if (enemyEncounters.MonsterHP > player.PlayerDMG) // higher than varibel { enemyEncounters.MonsterHP -= player.PlayerDMG; Console.WriteLine("Monster has " + enemyEncounters.MonsterHP + " Hp left"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("You didnt kill it. \nMonster fights back"); Console.ReadLine(); Console.ForegroundColor = ConsoleColor.Gray; //Monster Fights Back while (IsrunningMonster) { soundFx.EnemyAttackSound(); Console.Write("Monster do " + enemyEncounters.MonsterDMG + " amount of dmg"); Console.WriteLine(); if (player.PlayerHP < enemyEncounters.MonsterDMG) // Lower than varibel { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\nYou are Defeated \nand lie Bleeding violently at its feet "); IsrunningPlayer = false; IsrunningMonster = false; Console.ForegroundColor = ConsoleColor.Gray; Environment.Exit(0); // lukker console } else if (player.PlayerHP == enemyEncounters.MonsterDMG) // Equal varibel { Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("\nYou are Defeated "); IsrunningPlayer = false; IsrunningMonster = false; Console.ForegroundColor = ConsoleColor.Gray; Environment.Exit(0); } else if (player.PlayerHP > enemyEncounters.MonsterDMG) { player.PlayerHP -= enemyEncounters.MonsterDMG; Console.WriteLine("You have " + player.PlayerHP + " Hp left"); Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("It didnt kill you. \nFight back"); Console.ForegroundColor = ConsoleColor.Gray; Console.ReadLine(); IsrunningMonster = false; } } } } }
/****** Encounter randomizer hvad møder playeren næste ******/ public void AnObstacle(MonsterObstacle monsterObstacle, SwitchBoard switchBoard, Obstacles obstacles, Player player, Reward reward, BattleSwitchBoard battleSwitchBoard, EnemyEncounters enemyEncounters, BattleEngine battleEngine, SoundFx soundFx) { Npc npc = new Npc(); Random random = new Random(); int randomNumber = random.Next(1, 5); if (randomNumber == 1) { soundFx.EncounterSound(); monsterObstacle.MonsterEncounter(enemyEncounters, battleEngine, player, reward, obstacles, battleSwitchBoard, switchBoard, monsterObstacle, soundFx); } else if (randomNumber == 2) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("Nothing happens... \nBut you do feel a nice cool breeze \ncoming from down the road"); Console.ForegroundColor = ConsoleColor.Gray; } else if (randomNumber == 3) { npc.NpcEncounter(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); } else if (randomNumber == 4) { Console.WriteLine("You meet a wandering Merchant"); } }
public void dialogueOptions2(MonsterObstacle monsterObstacle, SwitchBoard switchBoard, Obstacles obstacles, Player player, Reward reward, BattleSwitchBoard battleSwitchBoard, EnemyEncounters enemyEncounters, BattleEngine battleEngine, SoundFx soundFx) { Console.WriteLine("\nWhat do you say? "); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("1. Thank you for the warning Friend... \n2. Hmph I dont need care im invinsible"); Console.ForegroundColor = ConsoleColor.Gray; string playerResponse = Console.ReadLine(); switch (playerResponse.ToLower()) { case "1": Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("He Smiles politely \nalways nice to help a fellow traveler"); Console.ForegroundColor = ConsoleColor.Gray; break; case "2": Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("He smirk at your response. \nShaking his head as he walks away"); Console.ForegroundColor = ConsoleColor.Gray; break; default: Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("You do nothing and continue onwards"); Console.ForegroundColor = ConsoleColor.Gray; break; } switchBoard.TwoPaths(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); }
/****** Npc encounters for dialogue muligheder ******/ public void NpcEncounter(MonsterObstacle monsterObstacle, SwitchBoard switchBoard, Obstacles obstacles, Player player, Reward reward, BattleSwitchBoard battleSwitchBoard, EnemyEncounters enemyEncounters, BattleEngine battleEngine, SoundFx soundFx) { Random random = new Random(); int randomNumber = random.Next(1, 5); switch (randomNumber) { case 1: Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("\n'Hello' the person said"); Console.WriteLine("Be wary on the Road here adventurer. \nSeveral nasty looking Xmas creatures are seen roaming around"); Console.ForegroundColor = ConsoleColor.Gray; dialogueOptions1(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); break; case 2: Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("\n'Hi' the person said"); Console.WriteLine("Take care on the road friend. \nThe Road is slippery in this weather \nand Santas little helpers are messing around"); Console.ForegroundColor = ConsoleColor.Gray; dialogueOptions2(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); break; case 3: Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("\n'Sup' the person said"); Console.WriteLine("Carefull not to slip in the corpse of that gnome back there as i did"); Console.ForegroundColor = ConsoleColor.Gray; dialogueOptions3(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); break; case 4: //Healer som jule gave selvfølgelig med 24 som amount heal i forhold til tema Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("\nMerry Xmas!"); Console.WriteLine("Here have a present from me to you in these Xmas times"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("HP has been restored and boosted. You gained 24 HP!"); player.PlayerHP += 24; Console.ForegroundColor = ConsoleColor.Gray; switchBoard.TwoPaths(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); break; default: Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("\nIdk what the f**k just happened"); Console.WriteLine("He says with a very confused look on his face"); Console.WriteLine("He doesn't seem to notice you as he walks past you..."); Console.ForegroundColor = ConsoleColor.Gray; switchBoard.TwoPaths(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); break; } }
/*****************Dialogue Options******************/ public void dialogueOptions1(MonsterObstacle monsterObstacle, SwitchBoard switchBoard, Obstacles obstacles, Player player, Reward reward, BattleSwitchBoard battleSwitchBoard, EnemyEncounters enemyEncounters, BattleEngine battleEngine, SoundFx soundFx) { Console.WriteLine("\nWhat do you say? "); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("1. Thank you friend \n2. Mind your own business"); Console.ForegroundColor = ConsoleColor.Gray; string playerResponse = Console.ReadLine(); switch (playerResponse.ToLower()) { case "1": Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("He Smiles politely at your response \nand move on with his journey"); Console.ForegroundColor = ConsoleColor.Gray; break; case "2": Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("He grunts at your response. \nClearly dissatisfied with your attitude"); Console.ForegroundColor = ConsoleColor.Gray; break; default: Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("You do nothing and continue onwards"); Console.ForegroundColor = ConsoleColor.Gray; break; } switchBoard.TwoPaths(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); }
public void dialogueOptions3(MonsterObstacle monsterObstacle, SwitchBoard switchBoard, Obstacles obstacles, Player player, Reward reward, BattleSwitchBoard battleSwitchBoard, EnemyEncounters enemyEncounters, BattleEngine battleEngine, SoundFx soundFx) { Console.WriteLine("\nWhat do you say?"); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("1. Thank you. Hope you are okay \n2. HA HA HA you Fool"); Console.ForegroundColor = ConsoleColor.Gray; string playerResponse = Console.ReadLine(); switch (playerResponse.ToLower()) { case "1": Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("'who me? yeah just wanted to give \nyou a headsup thats all' \nHe says as he walks on"); Console.ForegroundColor = ConsoleColor.Gray; break; case "2": Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("He clench his fist at you for a second. \nBut realize you are not worth the effort "); Console.ForegroundColor = ConsoleColor.Gray; break; default: Console.ForegroundColor = ConsoleColor.DarkGray; Console.WriteLine("You do nothing and continue onwards"); Console.ForegroundColor = ConsoleColor.Gray; break; } switchBoard.TwoPaths(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); }
/****** Array randomizer af Monster liste ******/ public void MonsterEncounter(EnemyEncounters enemyEncounters, BattleEngine battleEngine, Player player, Reward reward, Obstacles obstacles, BattleSwitchBoard battleSwitchBoard, SwitchBoard switchBoard, MonsterObstacle monsterObstacle, SoundFx soundFx) { var RandomMonster = new Random(); //Randomizer bool isrunning = true; string[] MonsterList = { "AdultReindeer ", "XmasGnome ", "XmasElf " }; //Monster Array list while (isrunning) { int i = RandomMonster.Next(0, 3); string Youmeet = MonsterList[i]; if (Youmeet == "AdultReindeer ") { Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("\nYou Encounter an Adult Reindeer"); enemyEncounters.AdultReindeer(); Console.WriteLine("HP: " + enemyEncounters.MonsterHP); Console.WriteLine("DMG Value: " + enemyEncounters.MonsterDMG); Console.ForegroundColor = ConsoleColor.Gray; battleSwitchBoard.MonsterAttackSwitch(enemyEncounters, battleEngine, player, reward, obstacles, monsterObstacle, switchBoard, battleSwitchBoard, soundFx); } else if (Youmeet == "XmasGnome ") { Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("\nYou encounter a Xmas Gnome"); enemyEncounters.XmasGnome(); Console.WriteLine("HP: " + enemyEncounters.MonsterHP); Console.WriteLine("DMG Value: " + enemyEncounters.MonsterDMG); Console.ForegroundColor = ConsoleColor.Gray; battleSwitchBoard.MonsterAttackSwitch(enemyEncounters, battleEngine, player, reward, obstacles, monsterObstacle, switchBoard, battleSwitchBoard, soundFx); } else if (Youmeet == "XmasElf ") { Console.ForegroundColor = ConsoleColor.DarkYellow; enemyEncounters.AdultReindeer(); Console.WriteLine("\nYou encounter a Xmas Elf"); enemyEncounters.XmasGnome(); Console.WriteLine("HP: " + enemyEncounters.MonsterHP); Console.WriteLine("DMG Value: " + enemyEncounters.MonsterDMG); Console.ForegroundColor = ConsoleColor.Gray; battleSwitchBoard.MonsterAttackSwitch(enemyEncounters, battleEngine, player, reward, obstacles, monsterObstacle, switchBoard, battleSwitchBoard, soundFx); } else { isrunning = false; } Console.ReadLine(); switchBoard.TwoPaths(monsterObstacle, switchBoard, obstacles, player, reward, battleSwitchBoard, enemyEncounters, battleEngine, soundFx); } }