@Override
	public T askChoice(boolean cancel) {
		String cancelString = "Cancel";
		String playerName = control.getPlayer().getName();

		if (cancel) {
			System.out.println(playerName + ", " + promptMessage + " Type \"" + cancelString + "\" to cancel.");
		} else {
			System.out.println(playerName + ", " + promptMessage);
		}

		String choice = "";
		T result = null;
		boolean repeat = true;
		while (repeat) {

			repeat = false;
			choice = TextIHM.scanner.nextLine();
			if (cancel && choice.equals(cancelString)) {
				result = null;
			} else if (inputClass == Integer.class) {
				try {
					result = inputClass.cast(Integer.parseInt(choice));
				} catch (NumberFormatException e) {
					System.out.println("Not a number. Try again.");
					repeat = true;
				}
			} else if (inputClass == String.class) {
				result = inputClass.cast(choice);
			}

			if (Game.IS_TEST) {
				System.out.println(choice);
			}
			System.out.println();
		}

		return result;
	}