summaryrefslogtreecommitdiffstats
path: root/core/test/ch/asynk/tankontank
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-01 12:02:01 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-01 12:02:01 +0200
commitff1bbe4a991b14ed16313979f04010cdf026136a (patch)
treebb3396d8d3f2b48e9514a8946e47c0530a204763 /core/test/ch/asynk/tankontank
parent7651fc9b4feaafa1c094c41f17d149e676027a1c (diff)
downloadRustAndDust-ff1bbe4a991b14ed16313979f04010cdf026136a.zip
RustAndDust-ff1bbe4a991b14ed16313979f04010cdf026136a.tar.gz
test/.../Helpers: add FakePawn
Diffstat (limited to 'core/test/ch/asynk/tankontank')
-rw-r--r--core/test/ch/asynk/tankontank/Helpers.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/core/test/ch/asynk/tankontank/Helpers.java b/core/test/ch/asynk/tankontank/Helpers.java
index b3d98e6..2448c96 100644
--- a/core/test/ch/asynk/tankontank/Helpers.java
+++ b/core/test/ch/asynk/tankontank/Helpers.java
@@ -6,6 +6,22 @@ import ch.asynk.tankontank.engine.Pawn;
public class Helpers
{
+ public static class FakePawn extends Pawn
+ {
+ private int mvt;
+ public FakePawn (int mvt)
+ {
+ this.mvt = mvt;
+ }
+
+ public int getMovementPoints() { return mvt; }
+ public int getRoadMarchBonus() { return 1; }
+ public boolean isUnit() { return true; }
+ public boolean isEnemy(Pawn other) { return true; }
+ public int getAngleOfAttack() { return 0; }
+ public int getAttackRangeFrom(Tile tile) { return 3; }
+ }
+
public static class FakeTile extends Tile
{
public boolean offMap;
@@ -26,10 +42,10 @@ public class Helpers
return offMap;
}
public boolean blockLineOfSightFrom(Tile from) { return false; }
- public boolean atLeastOneMove(Pawn pawn) { return true; }
- public boolean road(Board.Orientation side) { return false; }
+ public boolean atLeastOneMove(Pawn pawn) { return true; }
+ public boolean road(Board.Orientation side) { return false; }
+ public boolean hasTargetsFor(Pawn pawn) { return false; }
public int costFrom(Pawn pawn, Board.Orientation side, boolean road) { return 1; }
- public boolean hasTargetsFor(Pawn pawn) { return false; }
}
public static class FakeBoard extends Board
@@ -59,7 +75,7 @@ public class Helpers
{
int colOffset = ((row + 1) / 2);
if ((col < colOffset) || (row < 0) || (row >= rows) || ((col - colOffset) >= cols))
- return new FakeTile(true);;
+ return new FakeTile(true);
int idx = ((col - colOffset)) + (row * cols);
return fakeTiles[idx];
}