diff options
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/Board.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/map/Map0Hex.java | 6 |
3 files changed, 8 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/Board.java b/core/src/ch/asynk/rustanddust/engine/Board.java index ba9e1a1..b934030 100644 --- a/core/src/ch/asynk/rustanddust/engine/Board.java +++ b/core/src/ch/asynk/rustanddust/engine/Board.java @@ -66,6 +66,7 @@ public abstract class Board implements Disposable, Animation protected SelectedTile selectedTile; abstract protected Config getConfig(); + abstract protected boolean isObjective(Tile tile); protected Board(int cols, int rows) { diff --git a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java index 2f8017c..bc51ab6 100644 --- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java +++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java @@ -152,6 +152,7 @@ public class PathBuilder implements Disposable int n = next.costFrom(pawn, o); boolean r = next.road(o); int f = (fitness + 1 + (r ? 0 : 1)); + if (board.isObjective(next)) f -= 2; int m = (mvtLeft - n); r &= roadMarch; diff --git a/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java b/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java index c1ab73a..0d28829 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java @@ -76,6 +76,12 @@ public abstract class Map0Hex extends Board implements ObjectiveSet.ObjectiveCb public void hexExitHide(Hex hex) { enableOverlayOn(hex, Hex.EXIT, false); } @Override + public boolean isObjective(Tile tile) + { + return objectives.containsKey(tile); + } + + @Override public void showObjective(Tile tile, Faction faction) { showObjective((Hex) tile, (Army) faction); |