diff options
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 1 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Unit.java | 12 |
2 files changed, 10 insertions, 3 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index eb5953f..e623d3b 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -49,6 +49,7 @@ public abstract class Pawn implements Moveable, Disposable public abstract boolean isHq(); public abstract boolean isHqOf(Pawn other); public abstract boolean isUnit(); + public abstract boolean isHardTarget(); public abstract boolean canMove(); public abstract boolean canRotate(); diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java index f047de4..822472a 100644 --- a/core/src/ch/asynk/tankontank/game/Unit.java +++ b/core/src/ch/asynk/tankontank/game/Unit.java @@ -127,6 +127,12 @@ public class Unit extends HeadedPawn } @Override + public boolean isHardTarget() + { + return ((type == UnitType.HARD_TARGET) || (type == UnitType.HARD_TARGET_HQ)); + } + + @Override public boolean isHqOf(Pawn other) { if ((id == UnitId.GE_PANZER_IV_HQ) && (((Unit)other).id == UnitId.GE_PANZER_IV)) return true; @@ -144,21 +150,21 @@ public class Unit extends HeadedPawn @Override public boolean canRotate() { - if (type == UnitType.HARD_TARGET) return !hasMoved; + if (isHardTarget()) return !hasMoved; return (!hasMoved && !hasFired); } @Override public boolean canMove() { - if (type == UnitType.HARD_TARGET) return !hasMoved; + if (isHardTarget()) return !hasMoved; return (!hasMoved && !hasFired); } @Override public boolean canAttack() { - if (type == UnitType.HARD_TARGET) return !hasFired; + if (isHardTarget()) return !hasFired; return (!hasMoved && !hasFired); } |