diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-21 19:46:54 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-21 19:46:54 +0100 |
commit | 7f1b60094b5d351c58194feabad1fef903d1d3be (patch) | |
tree | baca50d5b34573c498ee48d73789462d14f79ecd | |
parent | b8d524c48af7b38eaec7d2547844c8b76b7009d6 (diff) | |
download | RustAndDust-7f1b60094b5d351c58194feabad1fef903d1d3be.zip RustAndDust-7f1b60094b5d351c58194feabad1fef903d1d3be.tar.gz |
Map0Hex: isObjective(Tile) -> isObjectiveFor(Tile,Pawn) : says no if already owned
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/Board.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/PathBuilder.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/map/Map0Hex.java | 8 |
3 files changed, 8 insertions, 4 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/Board.java b/core/src/ch/asynk/rustanddust/engine/Board.java index b934030..83dbd86 100644 --- a/core/src/ch/asynk/rustanddust/engine/Board.java +++ b/core/src/ch/asynk/rustanddust/engine/Board.java @@ -66,7 +66,7 @@ public abstract class Board implements Disposable, Animation protected SelectedTile selectedTile; abstract protected Config getConfig(); - abstract protected boolean isObjective(Tile tile); + abstract protected boolean isObjectiveFor(Tile tile, Pawn pawn); 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 bc51ab6..bebb045 100644 --- a/core/src/ch/asynk/rustanddust/engine/PathBuilder.java +++ b/core/src/ch/asynk/rustanddust/engine/PathBuilder.java @@ -152,7 +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; + if (board.isObjectiveFor(next, pawn)) 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 0d28829..41270d1 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java @@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Texture; import ch.asynk.rustanddust.RustAndDust; import ch.asynk.rustanddust.engine.Tile; +import ch.asynk.rustanddust.engine.Pawn; import ch.asynk.rustanddust.engine.Board; import ch.asynk.rustanddust.engine.Faction; import ch.asynk.rustanddust.engine.SelectedTile; @@ -76,9 +77,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) + public boolean isObjectiveFor(Tile tile, Pawn pawn) { - return objectives.containsKey(tile); + if (!objectives.containsKey(tile)) + return false; + + return (objectives.get(tile).faction() != pawn.getFaction()); } @Override |