<commit_before>package gameactions;

import model.area.TileCoordinate;
import model.entity.Entity;
import model.map.GameMap;
import model.map.ItemMap;
import utilities.Direction;

public class GameActionMovement extends GameAction {
	private Entity entity;
	private Direction direction;
	
	private GameMap terrain;
	private ItemMap itemMap;

	public GameActionMovement(Entity entity, GameMap terrain, ItemMap itemMap, Direction angle){

		this.entity = entity;
		this.terrain = terrain;
		this.direction = angle;
		this.itemMap = itemMap;
	}
	
	public void setTarget(Entity entity){
		this.entity = entity;
	}
	

	protected GameMap getTerrain(){
		return terrain;
	}
	
	protected void setAngle(Direction a){
		this.direction = a;
	}
	
	protected Entity getEntity(){
		return entity;
	}
	
	protected ItemMap getItemMap(){
		return itemMap;
	}
	
	protected boolean canMoveTo(TileCoordinate potentialSpot){
		return (getTerrain().isPassable(getEntity(), potentialSpot) && !getItemMap().isBlocking(potentialSpot));
	}
	
	protected Direction getDirection(){
		return direction;
	}
	
	@Override
	public void perform() {
		TileCoordinate potentialSpot = getEntity().nextLocation(direction);
		this.getItemMap().touch(entity, potentialSpot);
		if(this.canMoveTo(potentialSpot)){
			getEntity().move(direction);
		}
	}
}<commit_msg>GameActionMovement now sets direction on every attempt to move.<commit_after>package gameactions;

import model.area.TileCoordinate;
import model.entity.Entity;
import model.map.GameMap;
import model.map.ItemMap;
import utilities.Direction;

public class GameActionMovement extends GameAction {
	private Entity entity;
	private Direction direction;
	
	private GameMap terrain;
	private ItemMap itemMap;

	public GameActionMovement(Entity entity, GameMap terrain, ItemMap itemMap, Direction angle){

		this.entity = entity;
		this.terrain = terrain;
		this.direction = angle;
		this.itemMap = itemMap;
	}
	
	public void setTarget(Entity entity){
		this.entity = entity;
	}
	

	protected GameMap getTerrain(){
		return terrain;
	}
	
	protected void setAngle(Direction a){
		this.direction = a;
	}
	
	protected Entity getEntity(){
		return entity;
	}
	
	protected ItemMap getItemMap(){
		return itemMap;
	}
	
	protected boolean canMoveTo(TileCoordinate potentialSpot){
		return (getTerrain().isPassable(getEntity(), potentialSpot) && !getItemMap().isBlocking(potentialSpot));
	}
	
	protected Direction getDirection(){
		return direction;
	}
	
	@Override
	public void perform() {
		TileCoordinate potentialSpot = getEntity().nextLocation(direction);
		getEntity().setDirection(this.getDirection());
		this.getItemMap().touch(entity, potentialSpot);
		if(this.canMoveTo(potentialSpot)){
			getEntity().move(direction);
		}
	}
}
{'fraction_non_alphanumeric': 0.1005464480874317, 'fraction_numerical': 0.0, 'mean_word_length': 5.088691796008869, 'pattern_counts': {'":': 0, '<': 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': '1774058', 'n_tokens_mistral': 892, 'n_tokens_neox': 795, 'n_words': 203}