summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/ch/asynk/tankontank/engine/Pawn.java7
-rw-r--r--core/src/ch/asynk/tankontank/engine/SearchBoard.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java19
3 files changed, 15 insertions, 13 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java
index 8c31578..aa6e666 100644
--- a/core/src/ch/asynk/tankontank/engine/Pawn.java
+++ b/core/src/ch/asynk/tankontank/engine/Pawn.java
@@ -27,7 +27,7 @@ public abstract class Pawn implements Drawable, Disposable
int distance;
Pawn target;
boolean isClear;
- boolean isFlankAttack;
+ boolean isFlank;
}
private static final float MOVE_TIME = 0.4f;
@@ -84,6 +84,11 @@ public abstract class Pawn implements Drawable, Disposable
image.dispose();
}
+ public boolean isFlankAttack()
+ {
+ return (attack.isClear && attack.isFlank);
+ }
+
public Vector3 getPosition()
{
return position;
diff --git a/core/src/ch/asynk/tankontank/engine/SearchBoard.java b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
index c39cb0d..3fe77a3 100644
--- a/core/src/ch/asynk/tankontank/engine/SearchBoard.java
+++ b/core/src/ch/asynk/tankontank/engine/SearchBoard.java
@@ -365,7 +365,7 @@ public class SearchBoard
}
pawn.attack.isClear = true;
- pawn.attack.isFlankAttack = isFlankAttack(target.getFlankSides(), los);
+ pawn.attack.isFlank = isFlankAttack(target.getFlankSides(), los);
return true;
}
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index 7f9e7ae..2519ab0 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -183,33 +183,30 @@ public abstract class Map extends Board
public int buildPossibleMoves(Pawn pawn, GridPoint2 hex)
{
- buildPossibleMovesFrom(pawn, hex, possibleMoves);
- return possibleMoves.size();
+ return buildPossibleMovesFrom(pawn, hex, possibleMoves);
}
public int buildPossibleTargets(Pawn pawn, GridPoint2 hex)
{
- buildPossibleTargetsFrom(pawn, hex, possibleTargets);
- return possibleTargets.size();
+ return buildPossibleTargetsFrom(pawn, hex, possibleTargets);
}
public int buildMoveAssists(Pawn pawn, GridPoint2 hex)
{
- if (pawn.isHq()) {
- buildMoveAssists(pawn, hex, moveAssists);
- } else {
+ if (!pawn.isHq()) {
moveAssists.clear();
+ return 0;
}
- return moveAssists.size();
+ return buildMoveAssists(pawn, hex, moveAssists);
}
- public int buildAttackAssists(Pawn pawn, GridPoint2 hex, Iterator<Pawn> units)
+ public int buildAttack(Pawn pawn, Pawn target, GridPoint2 hex, Iterator<Pawn> units)
{
- buildAttackAssists(pawn, hex, units, attackAssists);
+ int s = buildAttack(pawn, target, hex, units, attackAssists);
activatedPawns.add(pawn);
for (GridPoint2 p : attackAssists)
activablePawns.add(getTopPawnAt(p));
- return attackAssists.size();
+ return s;
}
public boolean toggleAttackAssist(Pawn pawn)