diff options
Diffstat (limited to 'core/src/ch/asynk/tankontank/engine')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index 4227f53..3b5ef79 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -313,18 +313,33 @@ public abstract class Board implements Disposable } } - public void possibleMovesFrom(Pawn pawn, GridPoint2 coords, ArrayList<GridPoint2> moves) + public void buildPossibleMovesFrom(Pawn pawn, GridPoint2 coords, ArrayList<GridPoint2> moves) { List<SearchBoard.Node> nodes = searchBoard.possibleMovesFrom(pawn, coords.x, coords.y); nodesToPoints(nodes, moves); } - public void possibleTargetsFrom(Pawn pawn, GridPoint2 coords, ArrayList<GridPoint2> targets) + public void buildPossibleTargetsFrom(Pawn pawn, GridPoint2 coords, ArrayList<GridPoint2> targets) { List<SearchBoard.Node> nodes = searchBoard.possibleTargetsFrom(pawn, coords.x, coords.y); nodesToPoints(nodes, targets); } + public void buildMoveAssists(Pawn pawn, GridPoint2 coords, List<GridPoint2> assists) + { + assists.clear(); + buildNeighboursFor(coords); + for (int i = 0; i < 6; i++) { + GridPoint2 neighbour = neighbours[i]; + Tile t = getTileSafe(neighbour); + if (t != null) { + Pawn p = t.getTopPawn(); + if ((p != null) && (!pawn.isEnemy(p))) + assists.add(neighbour); + } + } + } + public void clearPointSet(Set<GridPoint2> points) { for (GridPoint2 point : points) |