Add utils functions
This commit is contained in:
parent
8415739d18
commit
2e99366e56
@ -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();
|
||||
|
||||
}
|
||||
|
@ -32,6 +32,11 @@ public class DeployShield extends AbstractAction {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getPoint() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Point> getValidPoint() {
|
||||
return null;
|
||||
|
@ -71,4 +71,8 @@ public abstract class DropObject extends AbstractAction {
|
||||
return direction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getPoint() {
|
||||
return point;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -29,6 +29,11 @@ public class Nothing extends AbstractAction {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getPoint() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Point> getValidPoint() {
|
||||
return null;
|
||||
|
@ -9,4 +9,8 @@ public class HumanPlayer extends AbstractPlayer {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Human";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user