diff options
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Tile.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Hex.java | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Tile.java b/core/src/ch/asynk/tankontank/engine/Tile.java index c366508..c5ca8b1 100644 --- a/core/src/ch/asynk/tankontank/engine/Tile.java +++ b/core/src/ch/asynk/tankontank/engine/Tile.java @@ -22,6 +22,7 @@ public abstract class Tile implements Drawable public abstract int costFrom(Pawn pawn, Board.Orientation side, boolean road); public abstract boolean hasTargetsFor(Pawn pawn); public abstract boolean isOffMap(); + public abstract boolean blockLineOfSightFrom(Tile tile); protected Tile() { diff --git a/core/src/ch/asynk/tankontank/game/Hex.java b/core/src/ch/asynk/tankontank/game/Hex.java index f7b1e23..4e07492 100644 --- a/core/src/ch/asynk/tankontank/game/Hex.java +++ b/core/src/ch/asynk/tankontank/game/Hex.java @@ -42,6 +42,18 @@ public class Hex extends Tile } @Override + public boolean blockLineOfSightFrom(Tile tile) + { + if ((terrain == Terrain.CLEAR) && !occupied()) + return false; + + if ((((Hex) tile).terrain == Terrain.HILLS) && (terrain == Terrain.CLEAR)) + return false; + + return true; + } + + @Override public boolean atLeastOneMove(Pawn pawn) { if (occupied() || (terrain == Terrain.BLOCKED) || (terrain == Terrain.OFFMAP)) |