public override string Use(GarageRoom room) { if (BeenUsed) { return($"Sorry, {LongName} has already been used. And he's not happy about your continued advances."); } else { BeenUsed = true; if (room.WaterLevel > 6 && room.DoesItemExistInRoom("echidna")) { room.RoomContents.Add(room.GetHiddenRoomContentsByName("garagedooropener")); room.RoomContentsAsStringList.Add("Garage Door Opener"); room.CurrentScene = room.GarageScenes.ScenesDictionary["Water07_EchidnaAttacksShark"]; return("The echidna gives you a li'l kiss on the cheek then dives underwater and attacks the shark! The echidna is eating the shark! He eats a large hole in the shark's belly revealing a... garage door opener? "); } else { BeenUsed = false; return(ItemActionMessages["use"]); } } }
public override string Use(GarageRoom room) { if (BeenUsed) { return($"Sorry, {LongName} has already been used."); } else { BeenUsed = true; Item echidna = room.GetHiddenRoomContentsByName("echidna"); room.RoomContents.Add(echidna); room.RoomContentsAsStringList.Add("Echidna"); if (room.WaterLevel == 0) { room.CurrentScene = room.GarageScenes.ScenesDictionary["Water00_EchidnaNotButton"]; } else if (room.WaterLevel > 0) { string scn = "Water0" + room.WaterLevel + "_EchidnaAndButton"; room.CurrentScene = room.GarageScenes.ScenesDictionary[scn]; } if (room.GetRoomContentsByName("honeybear").BeenUsed) { return(ItemActionMessages["use"] + "\nThe echidna scampers to slurp up the ants. The happy echidna is now your buddy."); } else { return(ItemActionMessages["use"]); } } }
/// <summary> /// Executes the command provided by the user. But first... /// Increments water-level if button has been pressed /// Determines which scene should be shown based on state of the room and /// Updates the Screen /// </summary> /// <returns>the command prompt for next user entry</returns> public string ExecuteCommand(GarageRoom currentRoom) { // Water level tracks the number of moves made if (room.GetRoomContentsByName("button").BeenUsed) { room.WaterLevel++; } if (room.WaterLevel > 0 && room.WaterLevel < 7) { // If waterlevel is at a certain height (6) then shark gets added to the room contents if (room.WaterLevel == 6) { room.RoomContents.Add(room.GetHiddenRoomContentsByName("shark")); room.RoomContentsAsStringList.Add("Shark"); } if (room.DoesItemExistInRoom("echidna")) { string scn = "Water0" + room.WaterLevel + "_EchidnaAndButton"; room.CurrentScene = room.GarageScenes.ScenesDictionary[scn]; } else if (!room.DoesItemExistInRoom("echidna")) { string scn = "Water0" + room.WaterLevel + "_NoEchidna"; room.CurrentScene = room.GarageScenes.ScenesDictionary[scn]; } } else if (room.WaterLevel >= 7) { game.WinLoseLogic(InputVerb, InputNoun); } // provides default message if item is not in room if (!room.DoesItemExistInRoom(InputNoun) && InputNoun != "") { if (InputNoun == "water") { view = new View(room.CurrentScene, room.RoomContentsAsStringList, Display.Wrap($"The WATER tastes like partially digested ants, like echidna poop.", 60)); } else { view = new View(room.CurrentScene, room.RoomContentsAsStringList, Display.Wrap($"I'm sorry, {InputNoun.ToUpper()} is not available in the room!", 60)); } return(view.UpdateScreenAndGetInput()); } switch (InputVerb) { case "intro": view = new View(room.CurrentScene, room.RoomContentsAsStringList, Display.Wrap(room.IntroMessage, 60)); return(view.UpdateScreenAndGetInput()); case "inspect": case "examine": view = new View(room.CurrentScene, room.RoomContentsAsStringList, Display.Wrap(room.GetRoomContentsByName(InputNoun).Examine(), 60)); return(view.UpdateScreenAndGetInput()); case "take": case "use": case "push": case "touch": string UseItemSceneUpdate = room.GetRoomContentsByName(InputNoun).Use(room); if (!room.ExitClosed) { game.GameState = GameState.Over; } view = new View(room.CurrentScene, room.RoomContentsAsStringList, Display.Wrap(UseItemSceneUpdate, 60)); return(view.UpdateScreenAndGetInput()); case "help": view = new View(room.CurrentScene, room.RoomContentsAsStringList, Display.Wrap("Try different actions with the items in the room. For example: EXAMINE BUTTON.", 60)); return(view.UpdateScreenAndGetInput()); default: view = new View(room.CurrentScene, room.RoomContentsAsStringList, Display.Wrap("Command not found. Type 'help' for a list of commands.", 60)); return(view.UpdateScreenAndGetInput()); } }