<commit_before>package wge3.game.ai;

import static com.badlogic.gdx.math.MathUtils.PI;
import static com.badlogic.gdx.math.MathUtils.PI2;
import static com.badlogic.gdx.math.MathUtils.atan2;
import static java.lang.Math.abs;
import wge3.entity.character.Creature;
import static wge3.game.PlayState.mStream;
import static wge3.game.ai.TurnTask.getDiff;
import wge3.world.Tile;

public final class MoveTask extends AITask {
    
    private Creature executor;
    private Tile dest;
    private TurnTask subTask;

    public MoveTask(Creature executor, Tile dest) {
        this.executor = executor;
        this.dest = dest;
        
        int destX = dest.getX() * Tile.size + Tile.size/2;
        int destY = dest.getY() * Tile.size + Tile.size/2;
        float dx = destX - executor.getX();
        float dy = destY - executor.getY();
        float angle = atan2(dy, dx);
        if (angle < 0) angle += PI2; /* angle = [0, PI2[ */
        subTask = new TurnTask(executor, angle);
    }

    @Override
    public boolean isFinished() {
        return executor.getTile().equals(dest);
    }

    @Override
    public void execute() {
        if (!subTask.isFinished()) subTask.execute();
        else if (!this.isFinished()) {

            int destX = dest.getX() * Tile.size + Tile.size/2;
            int destY = dest.getY() * Tile.size + Tile.size/2;
            float dx = destX - executor.getX();
            float dy = destY - executor.getY();
            float angle = atan2(dy, dx);
            if (angle < 0) angle += PI2; /* angle = [0, PI2[ */
            
            if (abs(getDiff(executor.getDirection(), angle)) > PI/48) {
                subTask = new TurnTask(executor, angle);
            } else {
                executor.goForward();
            }
        }
    }
}<commit_msg>MoveTask: Added getter and setter for Destination tile.<commit_after>package wge3.game.ai;

import static com.badlogic.gdx.math.MathUtils.PI;
import static com.badlogic.gdx.math.MathUtils.PI2;
import static com.badlogic.gdx.math.MathUtils.atan2;
import static java.lang.Math.abs;
import wge3.entity.character.Creature;
import static wge3.game.ai.TurnTask.getDiff;
import wge3.world.Tile;

public final class MoveTask extends AITask {
    
    private Creature executor;
    private Tile dest;
    private TurnTask subTask;

    public MoveTask(Creature executor, Tile dest) {
        this.executor = executor;
        this.dest = dest;
        
        int destX = dest.getX() * Tile.size + Tile.size/2;
        int destY = dest.getY() * Tile.size + Tile.size/2;
        float dx = destX - executor.getX();
        float dy = destY - executor.getY();
        float angle = atan2(dy, dx);
        if (angle < 0) angle += PI2; /* angle = [0, PI2[ */
        subTask = new TurnTask(executor, angle);
    }

    @Override
    public boolean isFinished() {
        return executor.getTile().equals(dest);
    }

    @Override
    public void execute() {
        if (!subTask.isFinished()) subTask.execute();
        else if (!this.isFinished()) {

            int destX = dest.getX() * Tile.size + Tile.size/2;
            int destY = dest.getY() * Tile.size + Tile.size/2;
            float dx = destX - executor.getX();
            float dy = destY - executor.getY();
            float angle = atan2(dy, dx);
            if (angle < 0) angle += PI2; /* angle = [0, PI2[ */
            
            if (abs(getDiff(executor.getDirection(), angle)) > PI/48) {
                subTask = new TurnTask(executor, angle);
            } else {
                executor.goForward();
            }
        }
    }

    public Tile getDestination() {
        return dest;
    }

    public void setDestination(Tile dest) {
        this.dest = dest;
    }
}
{'fraction_non_alphanumeric': 0.12389853137516689, 'fraction_numerical': 0.012016021361815754, 'mean_word_length': 2.0907590759075907, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '4873587', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1207, 'n_words': 291}