diff options
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Unit.java | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index 16a74e6..ba4a2bd 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -110,6 +110,7 @@ public abstract class Pawn implements Moveable, Disposable public abstract int getAngleOfAttack(); public abstract int getFlankSides(); public abstract int getEngagementRangeFrom(Tile tile); + public abstract int getDefense(Tile tile); public abstract boolean isUnit(); public abstract boolean isA(PawnId id); diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java index 468589e..c3d613e 100644 --- a/core/src/ch/asynk/tankontank/game/Unit.java +++ b/core/src/ch/asynk/tankontank/game/Unit.java @@ -148,6 +148,15 @@ public class Unit extends HeadedPawn } @Override + public int getDefense(Tile tile) + { + if (!isHardTarget() && (tile.isA(Hex.Terrain.HILLS) || tile.isA(Hex.Terrain.WOODS) || tile.isA(Hex.Terrain.TOWN))) + return cdef; + + return def; + } + + @Override public boolean isUnit() { return true; |