public override string GetOutput(Player player, GameStatusUpdate update) { // don't bother sending new output until a room is parsed. if (update != GameStatusUpdate.RoomParsed) { return(null); } string direction = exitData.GetMovementCommand(player); if (destinationRoom == null && startingRoom == null) { // no source or destination assigned, so we're not verifying the location. // Simply return the movement command and be done. IsDone = true; return(direction); } else if (startingRoom != null && player.RoomDetectionState == Parsing.RoomDetectionState.HaveMatch && player.LastSeenRoom.Match.RoomNumber == startingRoom) { // we're in the starting room, return the direction. sentCommand = true; return(direction); } if (destinationRoom != null && player.RoomDetectionState == Parsing.RoomDetectionState.HaveMatch && player.LastSeenRoom.Match.RoomNumber == destinationRoom) { // we're at the destination. IsDone = true; return(null); } return(null); }
public override string GetOutput(Player player, GameStatusUpdate update) { string direction = exitData.GetMovementCommand(player); if (update == GameStatusUpdate.RoomParsed && player.RoomDetectionState == Parsing.RoomDetectionState.HaveMatch && player.LastSeenRoom.Match.RoomNumber == startingRoom) { if (exitData.IsCurrentlyPassable(player.Model, player.LastSeenRoom)) { return(direction); } else { // barrier isn't passable, so commence with the suggested problem-solving method switch (requirements.Method) { case ExitMethod.UseItem: return(GetUseKey(player)); case ExitMethod.Bash: return(GetBash(player)); case ExitMethod.Pick: return(GetPick(player)); case ExitMethod.PickOrBash: if (player.Strength > player.Picklocks) { goto case ExitMethod.Bash; } else { goto case ExitMethod.Pick; } default: // should never get here, but hey, shit happens. throw new InvalidOperationException(); } } } else if (update == GameStatusUpdate.RoomParsed && player.RoomDetectionState == Parsing.RoomDetectionState.HaveMatch && player.LastSeenRoom.Match.RoomNumber == destinationRoom) { // we're at the destination. IsDone = true; return(null); } else if (update == GameStatusUpdate.BashFail) { return(GetBash(player)); } else if (update == GameStatusUpdate.BashSuccess) { return(direction); } else if (update == GameStatusUpdate.PickFail) { return(GetPick(player)); } else if (update == GameStatusUpdate.PickSuccess) { return(GetOpen(player)); } else if (update == GameStatusUpdate.DoorOpened) { return(direction); } return(null); }