<commit_before>package com.textbasedrpgmaker.core.scenario;

import java.util.Scanner;

import com.textbasedrpgmaker.core.item.Inventory;
import com.textbasedrpgmaker.core.item.Item;

public abstract class Location implements ScenarioState {
	
	private Item item;
	private ScenarioState nextStep;

	public Location(){
	}
	
	public Location(Item item){
		this.item = item;
	}
	
	@Override
	public abstract void showDescription();

	@Override
	public abstract ScenarioState northLocation();
	
	@Override
	public abstract ScenarioState southLocation();
	
	@Override
	public abstract ScenarioState eastLocation();
	
	@Override
	public abstract ScenarioState westLocation();
	
	@Override
	public void behavior(){
		showDescription();
		showItem();
		showOptions();
	}
	
	@Override
	public void move(ScenarioState state){
		if (state.isLocked() && !Inventory.getItens().contains(state.unlockingItem())){
			System.out.println("O caminho está bloqueado!");
			nextStep = this;
		} else {
			System.out.println("Indo para outro cenário!");
			nextStep = state;
		}
	}
	
	@Override
	public ScenarioState getNextStep() {
		return nextStep;
	}
	
	public boolean hasItem() {
		if(Inventory.getItens().contains(this.item))
			return true;
		else
			return false;
	}

	@Override
	public ScenarioState getItem() {
		if(!hasItem()){
			Inventory.addItemToInventory(this.item);
			System.out.println("O item " + this.item.getName() + " foi adicionado ao inventário");
		} else {
			this.item = null;
		}
		return this;
	}

	@Override
	public void showItem() {
		if(item != null && !hasItem())
			System.out.println(item.getDescription());
	}
	
	private boolean canMove(ScenarioState scenario) {
		if(scenario == null) {
			System.out.println("Não posso mover daqui");
			return false;
		} else {
			move(scenario);
			return true;
		}
	}
	
	public abstract String optionA();
	public abstract String optionB();
	public abstract String optionC();
	public abstract String optionD();
	public abstract String optionItem();

	
	public void showMenu() {
		System.out.println("Escolha alguma opção: ");
		System.out.println("a) " + optionA());
		System.out.println("b) " + optionB());
		System.out.println("c) " + optionC());
		System.out.println("d) " + optionD());
		if(this.item != null && !hasItem())
			System.out.println("e) " + optionItem());
	}
	
	@Override
	public void showOptions() {
		boolean exit;
		@SuppressWarnings("resource")
		Scanner keyboard = new Scanner(System.in);
		String choice = "null";
		
		do {
			exit = true;
			showMenu();
//			System.out.println("a) Ir para o norte.");
//			System.out.println("b) Ir para o sul.");
//			System.out.println("c) Ir para o oeste.");
//			System.out.println("d) Ir para o leste.");
//			System.out.println("e) Pegar item.");
			
			choice = keyboard.nextLine();
			
			switch(choice) {
			case "a":
				exit = canMove(northLocation());
				break;
			case "b":
				exit = canMove(southLocation());
				break;
			case "c":
				exit = canMove(westLocation());
				break;
			case "d":
				exit = canMove(eastLocation());
				break;
			case "e":
				exit = false;
				if (this.item != null && !hasItem())
					this.getItem();
				else
					System.out.println("Não há nada para pegar");
				break;
			default:
				System.out.println("Escolha uma opção válida");
				exit = false;
				break;
		}
			
		} while(!exit);
		
	}

	@Override
	public Item unlockingItem() {
		return null;
	}

	@Override
	public boolean isLocked() {
		return false;
	}
}<commit_msg>Mudando visibildade de metodos da classe Location<commit_after>package com.textbasedrpgmaker.core.scenario;

import java.util.Scanner;

import com.textbasedrpgmaker.core.item.Inventory;
import com.textbasedrpgmaker.core.item.Item;

public abstract class Location implements ScenarioState {
	
	private Item item;
	private ScenarioState nextStep;

	public Location(){
	}
	
	public Location(Item item){
		this.item = item;
	}
	
	@Override
	public abstract void showDescription();

	@Override
	public abstract ScenarioState northLocation();
	
	@Override
	public abstract ScenarioState southLocation();
	
	@Override
	public abstract ScenarioState eastLocation();
	
	@Override
	public abstract ScenarioState westLocation();
	
	@Override
	public void behavior(){
		showDescription();
		showItem();
		showOptions();
	}
	
	@Override
	public void move(ScenarioState state){
		if (state.isLocked() && !Inventory.getItens().contains(state.unlockingItem())){
			System.out.println("O caminho está bloqueado!");
			nextStep = this;
		} else {
			System.out.println("Indo para outro cenário!");
			nextStep = state;
		}
	}
	
	@Override
	public ScenarioState getNextStep() {
		return nextStep;
	}
	
	private boolean hasItem() {
		if(Inventory.getItens().contains(this.item))
			return true;
		else
			return false;
	}

	@Override
	public ScenarioState getItem() {
		if(!hasItem()){
			Inventory.addItemToInventory(this.item);
			System.out.println("O item " + this.item.getName() + " foi adicionado ao inventário");
		} else {
			this.item = null;
		}
		return this;
	}

	@Override
	public void showItem() {
		if(item != null && !hasItem())
			System.out.println(item.getDescription());
	}
	
	private boolean canMove(ScenarioState scenario) {
		if(scenario == null) {
			System.out.println("Não posso mover daqui");
			return false;
		} else {
			move(scenario);
			return true;
		}
	}
	
	public abstract String optionA();
	public abstract String optionB();
	public abstract String optionC();
	public abstract String optionD();
	public abstract String optionItem();

	
	private void showMenu() {
		System.out.println("Escolha alguma opção: ");
		System.out.println("a) " + optionA());
		System.out.println("b) " + optionB());
		System.out.println("c) " + optionC());
		System.out.println("d) " + optionD());
		if(this.item != null && !hasItem())
			System.out.println("e) " + optionItem());
	}
	
	@Override
	public void showOptions() {
		boolean exit;
		@SuppressWarnings("resource")
		Scanner keyboard = new Scanner(System.in);
		String choice = "null";
		
		do {
			exit = true;
			showMenu();
//			System.out.println("a) Ir para o norte.");
//			System.out.println("b) Ir para o sul.");
//			System.out.println("c) Ir para o oeste.");
//			System.out.println("d) Ir para o leste.");
//			System.out.println("e) Pegar item.");
			
			choice = keyboard.nextLine();
			
			switch(choice) {
			case "a":
				exit = canMove(northLocation());
				break;
			case "b":
				exit = canMove(southLocation());
				break;
			case "c":
				exit = canMove(westLocation());
				break;
			case "d":
				exit = canMove(eastLocation());
				break;
			case "e":
				exit = false;
				if (this.item != null && !hasItem())
					this.getItem();
				else
					System.out.println("Não há nada para pegar");
				break;
			default:
				System.out.println("Escolha uma opção válida");
				exit = false;
				break;
		}
			
		} while(!exit);
		
	}

	@Override
	public Item unlockingItem() {
		return null;
	}

	@Override
	public boolean isLocked() {
		return false;
	}
}
{'fraction_non_alphanumeric': 0.14167616875712657, 'fraction_numerical': 0.0, 'mean_word_length': 3.5535366645035693, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2495965', 'n_tokens_mistral': 2654, 'n_tokens_neox': 2277, 'n_words': 560}