diff options
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/Pawn.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Map.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Unit.java | 9 |
3 files changed, 11 insertions, 1 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/Pawn.java b/core/src/ch/asynk/rustanddust/engine/Pawn.java index 09b49aa..f21c9b9 100644 --- a/core/src/ch/asynk/rustanddust/engine/Pawn.java +++ b/core/src/ch/asynk/rustanddust/engine/Pawn.java @@ -48,6 +48,7 @@ public abstract class Pawn implements Moveable, Disposable public abstract int getFlankSides(); public abstract int getEngagementRangeFrom(Tile tile); public abstract int getDefense(Tile tile); + public abstract boolean preventDefenseOn(Tile tile); public abstract boolean isUnit(); public abstract boolean isA(PawnId id); diff --git a/core/src/ch/asynk/rustanddust/game/Map.java b/core/src/ch/asynk/rustanddust/game/Map.java index 62f5723..e4f44e6 100644 --- a/core/src/ch/asynk/rustanddust/game/Map.java +++ b/core/src/ch/asynk/rustanddust/game/Map.java @@ -494,7 +494,7 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS mayReroll = true; if (unit.isFlankAttack()) flankAttack = true; - if (unit.isA(Unit.UnitType.INFANTRY)) + if (unit.preventDefenseOn(e.defender.getTile())) terrainBonus = false; if (night) { if (distance < unit.attackDistance()) diff --git a/core/src/ch/asynk/rustanddust/game/Unit.java b/core/src/ch/asynk/rustanddust/game/Unit.java index cbc3842..36e6a69 100644 --- a/core/src/ch/asynk/rustanddust/game/Unit.java +++ b/core/src/ch/asynk/rustanddust/game/Unit.java @@ -182,6 +182,15 @@ public class Unit extends HeadedPawn } @Override + public boolean preventDefenseOn(Tile tile) + { + if (isA(UnitType.INFANTRY) && (tile.isA(Terrain.WOODS) || tile.isA(Terrain.TOWN))) + return true; + + return false; + } + + @Override public boolean isUnit() { return true; |