diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-05 14:23:03 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-05 14:23:03 +0100 |
commit | 9ef6e1b0bb5e8d8098b2be7daae7e77e4dab55d5 (patch) | |
tree | c791a661af5876d199db9d3a727eb2ee99ed88f1 /core/src/ch | |
parent | 25033e52443218e53104220a834bebd1cb385f3c (diff) | |
download | RustAndDust-9ef6e1b0bb5e8d8098b2be7daae7e77e4dab55d5.zip RustAndDust-9ef6e1b0bb5e8d8098b2be7daae7e77e4dab55d5.tar.gz |
add and use Pawn.preventDefenseOn(Tile)
Diffstat (limited to 'core/src/ch')
-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; |