summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-06-09 09:41:03 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-06-09 09:41:03 +0200
commitab78e9ec8ec7250c12bc12da5d9f292ceb497bbb (patch)
tree72717ee70d94019f03663633f79af10580fb28a3 /test
parenta917b915de64a9647d5e792a81cc0765e4b5a177 (diff)
downloadgdx-boardgame-ab78e9ec8ec7250c12bc12da5d9f292ceb497bbb.zip
gdx-boardgame-ab78e9ec8ec7250c12bc12da5d9f292ceb497bbb.tar.gz
HexScreen : test roadMarch
Diffstat (limited to 'test')
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/HexScreen.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/test/src/ch/asynk/gdx/boardgame/test/HexScreen.java b/test/src/ch/asynk/gdx/boardgame/test/HexScreen.java
index e60ebe2..3774856 100644
--- a/test/src/ch/asynk/gdx/boardgame/test/HexScreen.java
+++ b/test/src/ch/asynk/gdx/boardgame/test/HexScreen.java
@@ -34,12 +34,18 @@ class Unit extends Piece
super(texture);
this.hardTarget = hardTarget;
if (hardTarget) {
- this.mp = 3;
- } else {
this.mp = 2;
+ } else {
+ this.mp = 1;
}
}
+ @Override public int roadMarchBonus()
+ {
+ if (hardTarget) return 2;
+ return 0;
+ }
+
@Override public int getAvailableMP()
{
return mp;
@@ -50,7 +56,7 @@ class Unit extends Piece
Terrain dst = ((Hex)to).terrain;
if (dst == Terrain.HILL) return 3;
if (!hardTarget) return 1;
- if (orientation.belongsTo(((Hex)from).roads)) return 1;
+ if (((Hex)from).hasRoad(orientation)) return 1;
if (dst.difficult()) return 2;
return 1;
}
@@ -126,6 +132,11 @@ class Hex extends Tile
this.roads = getRoad(k);
}
+ @Override public boolean hasRoad(Orientation orientation)
+ {
+ return orientation.belongsTo(roads);
+ }
+
@Override public boolean blockLos(final Tile from, final Tile to, float d, float dt)
{
int h = terrain.elevation + terrain.height;