public void PlayGame() { if (!IsGameOver() && !IsGameWinning()) { Console.WriteLine("What do you want to do?"); Console.Write(">"); string userInput = Console.ReadLine(); string[] input = userInput.Split(":"); List <NPC> _npc = _currentRoom.nPCs; switch (input[0]) { case "l": _currentRoom.ShowRoomDescription(_currentRoom); break; case "i": _player.ShowInventory(); break; case "c": _player.DisplayCommands(); break; case "p": _currentHealthpoints = _player.TakePotion(_currentHealthpoints); _player.healthpoints = _currentHealthpoints; break; case "t": for (int m = 0; m < _currentRoom.inventory.Count; m++) { if (input.Count() > 1 && _currentRoom.inventory[m] == input[1]) { _item = _currentRoom.inventory[m]; _player.TakeItem(_player, input[1]); _currentRoom.inventory.Remove(_item); } } _player.healthpoints = _currentHealthpoints; break; case "d": _player.dropItem(_player, input[1]); _currentRoom.inventory.Add(input[1]); break; case "u": _player.UseItem(_player, _currentRoom); break; case "a": _player.healthpoints = _currentHealthpoints; for (int m = 0; m < _currentRoom.nPCs.Count; m++) { if (input.Count() > 1 && _currentRoom.nPCs[m].name == input[1]) { _currentNPC = _currentRoom.nPCs[m]; _currentNPC = _player.AttackNPC(_currentNPC); if (_currentNPC.isAlive) { _currentHealthpoints = _currentNPC.AttackPlayer(_player); } else { _currentHealthpoints = _currentNPC.AttackPlayer(_player); } } } break; case "ask": for (int m = 0; m < _currentRoom.nPCs.Count; m++) { if (input.Count() > 1 && _currentRoom.nPCs[m].name == input[1]) { _currentNPC = _currentRoom.nPCs[m]; _currentNPC.GiveInformation(); } } break; case "n": case "s": case "e": case "w": try { { foreach (NPC npc in _currentRoom.nPCs) { if (npc.isAlive) { _currentHealthpoints = npc.AttackPlayer(_player); } } } } catch (Exception) { } foreach (Door _rightDoor in _currentRoom.doors) { if (_rightDoor.doorDirection == input[0]) { _door = _rightDoor; _makeAMove = _player.MakeAMove(_player, _door, _rooms, _currentRoom); } } if (_makeAMove) { _currentRoom = _door.LeadsTo(); _currentRoom.ShowRoomDescription(_currentRoom); } break; case "q": QuitGame(); break; case "save": SavedGame(); break; } } else if (IsGameOver()) { Console.WriteLine("You died, this game is over"); _game.QuitGame(); } else if (IsGameWinning()) { Console.WriteLine(_player.endGameAdventure); _game.QuitGame(); } else { Console.WriteLine("Your input was invalid, please try it again."); } _game.PlayGame(); }