diff options
Diffstat (limited to 'core/src/ch')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/Objective.java | 5 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/ObjectiveSet.java | 12 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/map/Map0Hex.java | 5 |
3 files changed, 18 insertions, 4 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/Objective.java b/core/src/ch/asynk/rustanddust/engine/Objective.java index de1c7d3..d10f446 100644 --- a/core/src/ch/asynk/rustanddust/engine/Objective.java +++ b/core/src/ch/asynk/rustanddust/engine/Objective.java @@ -23,6 +23,11 @@ public class Objective return curFaction; } + public boolean persistent() + { + return persistent; + } + public boolean set(Faction faction) { if (faction == curFaction) diff --git a/core/src/ch/asynk/rustanddust/engine/ObjectiveSet.java b/core/src/ch/asynk/rustanddust/engine/ObjectiveSet.java index 1536360..61feba6 100644 --- a/core/src/ch/asynk/rustanddust/engine/ObjectiveSet.java +++ b/core/src/ch/asynk/rustanddust/engine/ObjectiveSet.java @@ -34,6 +34,18 @@ public class ObjectiveSet extends HashMap<Tile, Objective> return n; } + public boolean isObjectiveFor(Tile tile, Pawn pawn) + { + Objective objective = get(tile); + if (objective == null) + return false; + + if (objective.faction() == pawn.getFaction()) + return false; + + return (objective.persistent()); + } + public Faction claim(Tile tile, Faction faction) { Objective objective = get(tile); diff --git a/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java b/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java index 41270d1..77780cd 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map0Hex.java @@ -79,10 +79,7 @@ public abstract class Map0Hex extends Board implements ObjectiveSet.ObjectiveCb @Override public boolean isObjectiveFor(Tile tile, Pawn pawn) { - if (!objectives.containsKey(tile)) - return false; - - return (objectives.get(tile).faction() != pawn.getFaction()); + return objectives.isObjectiveFor(tile, pawn); } @Override |