Add utils functions

This commit is contained in:
Katchan 2021-12-08 18:52:12 +01:00
parent 8415739d18
commit 2e99366e56
6 changed files with 25 additions and 0 deletions

View File

@ -22,6 +22,7 @@ public interface Action {
* Used by {@link Move}, {@link Shot} and {@link DropObject} to list all direction when the action is possible
* @return a list a point where the action is possible (not block by a wall per example)
*/
Point getPoint();
List<Point> getValidPoint();
}

View File

@ -32,6 +32,11 @@ public class DeployShield extends AbstractAction {
return true;
}
@Override
public Point getPoint() {
return null;
}
@Override
public List<Point> getValidPoint() {
return null;

View File

@ -71,4 +71,8 @@ public abstract class DropObject extends AbstractAction {
return direction;
}
@Override
public Point getPoint() {
return point;
}
}

View File

@ -60,6 +60,7 @@ public class Move extends AbstractAction {
* We add a point to the list where there is nothing on the board.
* @see Action#getValidPoint()
*/
@Override
public List<Point> getValidPoint() {
List<Point> listMoves = new ArrayList<>();
@ -81,6 +82,11 @@ public class Move extends AbstractAction {
return listMoves;
}
@Override
public Point getPoint() {
return point;
}
public Direction getDirection() {
return direction;
}

View File

@ -29,6 +29,11 @@ public class Nothing extends AbstractAction {
return true;
}
@Override
public Point getPoint() {
return null;
}
@Override
public List<Point> getValidPoint() {
return null;

View File

@ -9,4 +9,8 @@ public class HumanPlayer extends AbstractPlayer {
}
@Override
public String toString() {
return "Human";
}
}