public void UseSyringe(string item1, Player name) {//increases hitpower by 25 name.IncreasePlayerHitPower(25); Console.WriteLine("Your Hit Power is now " + name.PlayerHitPower + " points per hit"); //need to find it and return as an Item so can remove it Items Item2 = name.FindPlayerItem(item1, name); //need to remove from player items name.PlayerItems.Remove(Item2); }
public void UsePotion(string item1, Player name) {//increases health by 50 name.IncreasePlayerHealth(50); Console.WriteLine("Your health is now " + name.PlayerHealth); //need to find it and return as an Item so can remove it Items Item2 = name.FindPlayerItem(item1, name); //need to remove from player items name.PlayerItems.Remove(Item2); }
public void UseTransporter(string item1, Player name, Location location) { //changing locations like this doesn't trigger the search the room for an enemy function. it needs to. string LeavingLocation = location.LocationToString(location); //change Location into string Console.WriteLine("Please type the name of the location you would like to move to exactly as you see it below:"); name.TransporterMove(name, LeavingLocation); //list the locations available to me by name string NewLocation = Console.ReadLine(); if (NewLocation != "disused kitchen" && NewLocation != "old laboritory" && NewLocation != "medical room" && NewLocation != "sunken courtyard" && NewLocation != "dormitory") { Console.WriteLine("That location doesn't exist"); } else { switch (NewLocation) { case "disused kitchen": Location MoveTo = name.FindLocation("disused kitchen"); bool IsThereAnEnemy = MoveTo.IsThereAnEnemy(MoveTo); FightLogic.IfEnemyFound(name, location, MoveTo, IsThereAnEnemy); break; case "old laboritory": Location MoveTo1 = name.FindLocation("old laboritory"); bool IsThereAnEnemy1 = MoveTo1.IsThereAnEnemy(MoveTo1); FightLogic.IfEnemyFound(name, location, MoveTo1, IsThereAnEnemy1); break; case "medical room": Location MoveTo2 = name.FindLocation("medical room"); bool IsThereAnEnemy2 = MoveTo2.IsThereAnEnemy(MoveTo2); FightLogic.IfEnemyFound(name, location, MoveTo2, IsThereAnEnemy2); break; case "sunken courtyard": Location MoveTo3 = name.FindLocation("sunken courtyard"); bool IsThereAnEnemy3 = MoveTo3.IsThereAnEnemy(MoveTo3); FightLogic.IfEnemyFound(name, location, MoveTo3, IsThereAnEnemy3); break; case "dormitory": Location MoveTo4 = name.FindLocation("dormitory"); bool IsThereAnEnemy4 = MoveTo4.IsThereAnEnemy(MoveTo4); FightLogic.IfEnemyFound(name, location, MoveTo4, IsThereAnEnemy4); break; } Items Item2 = name.FindPlayerItem(item1, name); //need to remove from player items name.PlayerItems.Remove(Item2); } }
public void LetsFight(Player name, Enemy EnemyName, Location location) { Logic Logic = new Logic(); Game Game = new Game(); Actions Actions = new Actions(); Console.Write(name.GetPlayerName() + "'s Hit Power is " + name.PlayerHitPower + " per hit. "); Console.WriteLine(name.GetPlayerName() + "'s health is " + name.PlayerHealth); Console.Write(EnemyName.GetEnemyName() + " Hit Power is " + EnemyName.EnemyHitPower + " per hit. "); //CURRENT PROBLEM - THIS IS WHERE IT'S SAYING THERE ISN'T A ZOMBIE KING BUT IT WOULDN'T HAVE GOT HERE IF THERE WASN'T! Console.WriteLine(EnemyName.GetEnemyName() + " health is " + EnemyName.EnemyHealth); Console.WriteLine("The Zombie lunges at you, you dodge out of the way"); Game.FightPrompt(); while (true) { string FightAction = Console.ReadLine(); if (FightAction == "1") //View items. Tried to use switches here but it broke out back to the logic code after every action or not at all. { name.ViewPlayerItems(); Game.FightPrompt(); } if (FightAction == "2") //use items { name.ViewPlayerItems(); if (name.PlayerItems.Count >= 1) { Console.WriteLine("Please type the name of the Item would you like to use"); string Item1 = Console.ReadLine(); bool Item1Result = name.DoesPlayerHaveItem(Item1); // check player has item if (Item1Result == true) { Items ItemToUse = name.FindPlayerItem(Item1, name); if (ItemToUse.GetItemAction() == "This item does nothing") { Console.WriteLine("Unlucky, that item does absolutely nothing"); name.PlayerItems.Remove(ItemToUse); Game.PlayerPrompt(); } else { Actions.UseItem(Item1, name, location); Game.PlayerPrompt(); } } if (Item1Result == false) { Console.WriteLine("You have not picked up that item"); Game.FightPrompt(); } } else { Game.FightPrompt(); } } if (FightAction == "3") { if (EnemyName.GetEnemyName() == "Zombie") { while (EnemyName.EnemyHealth >= 1 && name.PlayerHealth >= 1) { EnemyName.DecreaseEnemyHealth(name.PlayerHitPower, EnemyName); Console.WriteLine(EnemyName.GetEnemyName() + " health is now " + EnemyName.EnemyHealth); if (EnemyName.EnemyHealth <= 0) { Console.WriteLine("You killed the " + EnemyName.GetEnemyName()); //put in a remove the enemey from it's original location here? or fight the zombie every time you go into the room? location.LocationEnemies.Remove(EnemyName); location.WhereAmI(location); break; } name.DecreasePlayerHealth(EnemyName.EnemyHitPower, name); Console.WriteLine(name.GetPlayerName() + "'s health is now " + name.PlayerHealth); if (name.PlayerHealth <= 0) { Console.WriteLine(name.GetPlayerName() + " got killed in a brutal way. Thanks for Playing"); break; } } break; } if (EnemyName.GetEnemyName() == "The Zombie King") { while (EnemyName.EnemyHealth >= 0 && name.PlayerHealth >= 0) { EnemyName.DecreaseEnemyHealth(name.PlayerHitPower, EnemyName); Console.WriteLine(EnemyName.GetEnemyName() + " health is now " + EnemyName.EnemyHealth); if (EnemyName.EnemyHealth <= 0) { Console.WriteLine("You killed the " + EnemyName.GetEnemyName() + " and have won the game. You run up the stairs and into the distance."); break; } name.DecreasePlayerHealth(EnemyName.EnemyHitPower, name); Console.WriteLine(name.GetPlayerName() + "'s health is now " + name.PlayerHealth); if (name.PlayerHealth <= 0) { Console.WriteLine(name.GetPlayerName() + " got killed in a brutal way. Thanks for Playing"); break; } } break; } } else { Console.WriteLine("Please enter a number between 1 and 3"); } } }
public void LocationLogic(Player name, Location location) { Location currentLocation = location; FightLogic FightLogic = new FightLogic(); Game Game = new Game(); TicTacToe TicTacToe = new TicTacToe(); Actions Actions = new Actions(); while (true) { string Action = Console.ReadLine(); switch (Action) { case "1": //look around Console.WriteLine("You can see the following items"); location.ViewLocationItems(location); Game.PlayerPrompt(); break; case "2": //search an item Console.WriteLine("Please type the name of the Item would you like to search exactly as you see it in the list"); string ItemSearch = Console.ReadLine(); Items ItemSearch2 = location.FindLocationItem(ItemSearch, location); if (ItemSearch2 == null) { } else { location.ItemDescription(ItemSearch); } Game.PlayerPrompt(); break; case "3": //pick up an item Console.WriteLine("Please type the name of the Item would you like to pick up exactly as you see it in the list"); string ItemKeep = Console.ReadLine(); Items ItemKeep2 = location.FindLocationItem(ItemKeep, location); if (ItemKeep2 != null) { name.PlayerPickUpItem(ItemKeep2, location, ItemKeep2.CanPickUp); } Game.PlayerPrompt(); break; case "4": //use an item name.ViewPlayerItems(); if (name.PlayerItems.Count >= 1) { Console.WriteLine("Please type the name of the Item would you like to use"); string Item1 = Console.ReadLine(); bool Item1Result = name.DoesPlayerHaveItem(Item1); // check player has item if (Item1Result) { Items ItemToUse = name.FindPlayerItem(Item1, name); if (ItemToUse.GetItemAction() == "This item does nothing") { Console.WriteLine("Unlucky, that item does absolutely nothing"); name.PlayerItems.Remove(ItemToUse); Game.PlayerPrompt(); } else { Actions.UseItem(Item1, name, location); Game.PlayerPrompt(); } } if (!Item1Result) { Console.WriteLine("You have not picked up that item"); Game.PlayerPrompt(); } } else { Game.PlayerPrompt(); } break; case "5": //view my items name.ViewPlayerItems(); Game.PlayerPrompt(); break; case "6": //change location name.ViewLocationOptions(location); //list possible locations as doors string LeavingLocation = location.LocationToString(location); string NewLocation = Console.ReadLine(); //ask for door to go through string NewLocation2 = location.DoorDirection(NewLocation, LeavingLocation); //convert door to location string if (NewLocation2 == null) { Console.WriteLine("That location does not exist, did you type it in the format 'Door 1'?"); Game.PlayerPrompt(); } else { Location NewLocation3 = name.FindLocation(NewLocation2); //convert location string into Location currentLocation = NewLocation3; //set currentLocation to the new location name. NewLocation3.WhereAmI(NewLocation3); //move to fight sequences here if there is an enemy in the new location. bool IsThereAnEnemy = NewLocation3.IsThereAnEnemy(NewLocation3); FightLogic.IfEnemyFound(name, location, NewLocation3, IsThereAnEnemy); } break; default: Console.WriteLine("Please enter a number between 1 and 6"); break; } } }